]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
Update llvm to trunk r256633.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Headers / altivec.h
1 /*===---- altivec.h - Standard header for type generic math ---------------===*\
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  *
21 \*===----------------------------------------------------------------------===*/
22
23 #ifndef __ALTIVEC_H
24 #define __ALTIVEC_H
25
26 #ifndef __ALTIVEC__
27 #error "AltiVec support not enabled"
28 #endif
29
30 /* constants for mapping CR6 bits to predicate result. */
31
32 #define __CR6_EQ 0
33 #define __CR6_EQ_REV 1
34 #define __CR6_LT 2
35 #define __CR6_LT_REV 3
36
37 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39 static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
40                                                 vector signed char __b,
41                                                 vector unsigned char __c);
42
43 static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
44                                                   vector unsigned char __b,
45                                                   vector unsigned char __c);
46
47 static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
48                                               vector bool char __b,
49                                               vector unsigned char __c);
50
51 static vector short __ATTRS_o_ai vec_perm(vector signed short __a,
52                                           vector signed short __b,
53                                           vector unsigned char __c);
54
55 static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
56                                                    vector unsigned short __b,
57                                                    vector unsigned char __c);
58
59 static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
60                                                vector bool short __b,
61                                                vector unsigned char __c);
62
63 static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
64                                           vector unsigned char __c);
65
66 static vector int __ATTRS_o_ai vec_perm(vector signed int __a,
67                                         vector signed int __b,
68                                         vector unsigned char __c);
69
70 static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
71                                                  vector unsigned int __b,
72                                                  vector unsigned char __c);
73
74 static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
75                                              vector bool int __b,
76                                              vector unsigned char __c);
77
78 static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
79                                           vector unsigned char __c);
80
81 #ifdef __VSX__
82 static vector long long __ATTRS_o_ai vec_perm(vector signed long long __a,
83                                               vector signed long long __b,
84                                               vector unsigned char __c);
85
86 static vector unsigned long long __ATTRS_o_ai
87 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
88          vector unsigned char __c);
89
90 static vector bool long long __ATTRS_o_ai
91 vec_perm(vector bool long long __a, vector bool long long __b,
92          vector unsigned char __c);
93
94 static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
95                                            vector unsigned char __c);
96 #endif
97
98 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
99                                                  vector unsigned char __b);
100
101 /* vec_abs */
102
103 #define __builtin_altivec_abs_v16qi vec_abs
104 #define __builtin_altivec_abs_v8hi vec_abs
105 #define __builtin_altivec_abs_v4si vec_abs
106
107 static vector signed char __ATTRS_o_ai vec_abs(vector signed char __a) {
108   return __builtin_altivec_vmaxsb(__a, -__a);
109 }
110
111 static vector signed short __ATTRS_o_ai vec_abs(vector signed short __a) {
112   return __builtin_altivec_vmaxsh(__a, -__a);
113 }
114
115 static vector signed int __ATTRS_o_ai vec_abs(vector signed int __a) {
116   return __builtin_altivec_vmaxsw(__a, -__a);
117 }
118
119 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
120 static vector signed long long __ATTRS_o_ai
121 vec_abs(vector signed long long __a) {
122   return __builtin_altivec_vmaxsd(__a, -__a);
123 }
124 #endif
125
126 static vector float __ATTRS_o_ai vec_abs(vector float __a) {
127   vector unsigned int __res =
128       (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
129   return (vector float)__res;
130 }
131
132 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
133 static vector double __ATTRS_o_ai vec_abs(vector double __a) {
134   vector unsigned long long __res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF };
135   __res &= (vector unsigned int)__a;
136   return (vector double)__res;
137 }
138 #endif
139
140 /* vec_abss */ 
141 #define __builtin_altivec_abss_v16qi vec_abss
142 #define __builtin_altivec_abss_v8hi vec_abss
143 #define __builtin_altivec_abss_v4si vec_abss
144
145 static vector signed char __ATTRS_o_ai vec_abss(vector signed char __a) {
146   return __builtin_altivec_vmaxsb(
147       __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
148 }
149
150 static vector signed short __ATTRS_o_ai vec_abss(vector signed short __a) {
151   return __builtin_altivec_vmaxsh(
152       __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
153 }
154
155 static vector signed int __ATTRS_o_ai vec_abss(vector signed int __a) {
156   return __builtin_altivec_vmaxsw(
157       __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
158 }
159
160 /* vec_add */
161
162 static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
163                                                vector signed char __b) {
164   return __a + __b;
165 }
166
167 static vector signed char __ATTRS_o_ai vec_add(vector bool char __a,
168                                                vector signed char __b) {
169   return (vector signed char)__a + __b;
170 }
171
172 static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
173                                                vector bool char __b) {
174   return __a + (vector signed char)__b;
175 }
176
177 static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
178                                                  vector unsigned char __b) {
179   return __a + __b;
180 }
181
182 static vector unsigned char __ATTRS_o_ai vec_add(vector bool char __a,
183                                                  vector unsigned char __b) {
184   return (vector unsigned char)__a + __b;
185 }
186
187 static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
188                                                  vector bool char __b) {
189   return __a + (vector unsigned char)__b;
190 }
191
192 static vector short __ATTRS_o_ai vec_add(vector short __a, vector short __b) {
193   return __a + __b;
194 }
195
196 static vector short __ATTRS_o_ai vec_add(vector bool short __a,
197                                          vector short __b) {
198   return (vector short)__a + __b;
199 }
200
201 static vector short __ATTRS_o_ai vec_add(vector short __a,
202                                          vector bool short __b) {
203   return __a + (vector short)__b;
204 }
205
206 static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
207                                                   vector unsigned short __b) {
208   return __a + __b;
209 }
210
211 static vector unsigned short __ATTRS_o_ai vec_add(vector bool short __a,
212                                                   vector unsigned short __b) {
213   return (vector unsigned short)__a + __b;
214 }
215
216 static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
217                                                   vector bool short __b) {
218   return __a + (vector unsigned short)__b;
219 }
220
221 static vector int __ATTRS_o_ai vec_add(vector int __a, vector int __b) {
222   return __a + __b;
223 }
224
225 static vector int __ATTRS_o_ai vec_add(vector bool int __a, vector int __b) {
226   return (vector int)__a + __b;
227 }
228
229 static vector int __ATTRS_o_ai vec_add(vector int __a, vector bool int __b) {
230   return __a + (vector int)__b;
231 }
232
233 static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
234                                                 vector unsigned int __b) {
235   return __a + __b;
236 }
237
238 static vector unsigned int __ATTRS_o_ai vec_add(vector bool int __a,
239                                                 vector unsigned int __b) {
240   return (vector unsigned int)__a + __b;
241 }
242
243 static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
244                                                 vector bool int __b) {
245   return __a + (vector unsigned int)__b;
246 }
247
248 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
249 static vector signed long long __ATTRS_o_ai
250 vec_add(vector signed long long __a, vector signed long long __b) {
251   return __a + __b;
252 }
253
254 static vector unsigned long long __ATTRS_o_ai
255 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
256   return __a + __b;
257 }
258
259 static vector signed __int128 __ATTRS_o_ai vec_add(vector signed __int128 __a,
260                                                    vector signed __int128 __b) {
261   return __a + __b;
262 }
263
264 static vector unsigned __int128 __ATTRS_o_ai
265 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
266   return __a + __b;
267 }
268 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
269
270 static vector float __ATTRS_o_ai vec_add(vector float __a, vector float __b) {
271   return __a + __b;
272 }
273
274 #ifdef __VSX__
275 static vector double __ATTRS_o_ai
276 vec_add(vector double __a, vector double __b) {
277   return __a + __b;
278 }
279 #endif // __VSX__
280
281 /* vec_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 #ifdef __LITTLE_ENDIAN__
6567   return vec_perm(
6568       __b, __a,
6569       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6570                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6571                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6572                              31 - __d));
6573 #else
6574   return vec_perm(
6575       __a, __b,
6576       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6577                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6578                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6579 #endif
6580 }
6581
6582 static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
6583                                                  vector unsigned char __b,
6584                                                  unsigned const int __c) {
6585   unsigned char __d = __c & 0x0F;
6586 #ifdef __LITTLE_ENDIAN__
6587   return vec_perm(
6588       __b, __a,
6589       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6590                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6591                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6592                              31 - __d));
6593 #else
6594   return vec_perm(
6595       __a, __b,
6596       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6597                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6598                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6599 #endif
6600 }
6601
6602 static vector bool char __ATTRS_o_ai vec_sld(vector bool char __a,
6603                                              vector bool char __b,
6604                                              unsigned const int __c) {
6605   unsigned char __d = __c & 0x0F;
6606 #ifdef __LITTLE_ENDIAN__
6607   return vec_perm(
6608       __b, __a,
6609       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6610                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6611                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6612                              31 - __d));
6613 #else
6614   return vec_perm(
6615       __a, __b,
6616       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6617                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6618                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6619 #endif
6620 }
6621
6622 static vector signed short __ATTRS_o_ai vec_sld(vector signed short __a,
6623                                                 vector signed short __b,
6624                                                 unsigned const int __c) {
6625   unsigned char __d = __c & 0x0F;
6626 #ifdef __LITTLE_ENDIAN__
6627   return vec_perm(
6628       __b, __a,
6629       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6630                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6631                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6632                              31 - __d));
6633 #else
6634   return vec_perm(
6635       __a, __b,
6636       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6637                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6638                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6639 #endif
6640 }
6641
6642 static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
6643                                                   vector unsigned short __b,
6644                                                   unsigned const int __c) {
6645   unsigned char __d = __c & 0x0F;
6646 #ifdef __LITTLE_ENDIAN__
6647   return vec_perm(
6648       __b, __a,
6649       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6650                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6651                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6652                              31 - __d));
6653 #else
6654   return vec_perm(
6655       __a, __b,
6656       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6657                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6658                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6659 #endif
6660 }
6661
6662 static vector bool short __ATTRS_o_ai vec_sld(vector bool short __a,
6663                                               vector bool short __b,
6664                                               unsigned const int __c) {
6665   unsigned char __d = __c & 0x0F;
6666 #ifdef __LITTLE_ENDIAN__
6667   return vec_perm(
6668       __b, __a,
6669       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6670                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6671                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6672                              31 - __d));
6673 #else
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 #endif
6680 }
6681
6682 static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
6683                                          unsigned const int __c) {
6684   unsigned char __d = __c & 0x0F;
6685 #ifdef __LITTLE_ENDIAN__
6686   return vec_perm(
6687       __b, __a,
6688       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6689                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6690                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6691                              31 - __d));
6692 #else
6693   return vec_perm(
6694       __a, __b,
6695       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6696                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6697                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6698 #endif
6699 }
6700
6701 static vector signed int __ATTRS_o_ai vec_sld(vector signed int __a,
6702                                               vector signed int __b,
6703                                               unsigned const int __c) {
6704   unsigned char __d = __c & 0x0F;
6705 #ifdef __LITTLE_ENDIAN__
6706   return vec_perm(
6707       __b, __a,
6708       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6709                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6710                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6711                              31 - __d));
6712 #else
6713   return vec_perm(
6714       __a, __b,
6715       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6716                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6717                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6718 #endif
6719 }
6720
6721 static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
6722                                                 vector unsigned int __b,
6723                                                 unsigned const int __c) {
6724   unsigned char __d = __c & 0x0F;
6725 #ifdef __LITTLE_ENDIAN__
6726   return vec_perm(
6727       __b, __a,
6728       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6729                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6730                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6731                              31 - __d));
6732 #else
6733   return vec_perm(
6734       __a, __b,
6735       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6736                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6737                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6738 #endif
6739 }
6740
6741 static vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
6742                                             vector bool int __b,
6743                                             unsigned const int __c) {
6744   unsigned char __d = __c & 0x0F;
6745 #ifdef __LITTLE_ENDIAN__
6746   return vec_perm(
6747       __b, __a,
6748       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6749                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6750                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6751                              31 - __d));
6752 #else
6753   return vec_perm(
6754       __a, __b,
6755       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6756                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6757                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6758 #endif
6759 }
6760
6761 static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
6762                                          unsigned const int __c) {
6763   unsigned char __d = __c & 0x0F;
6764 #ifdef __LITTLE_ENDIAN__
6765   return vec_perm(
6766       __b, __a,
6767       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6768                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6769                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6770                              31 - __d));
6771 #else
6772   return vec_perm(
6773       __a, __b,
6774       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6775                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6776                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6777 #endif
6778 }
6779
6780 /* vec_vsldoi */
6781
6782 static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
6783                                                   vector signed char __b,
6784                                                   unsigned char __c) {
6785   unsigned char __d = __c & 0x0F;
6786 #ifdef __LITTLE_ENDIAN__
6787   return vec_perm(
6788       __b, __a,
6789       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6790                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6791                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6792                              31 - __d));
6793 #else
6794   return vec_perm(
6795       __a, __b,
6796       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6797                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6798                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6799 #endif
6800 }
6801
6802 static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
6803                                                     vector unsigned char __b,
6804                                                     unsigned char __c) {
6805   unsigned char __d = __c & 0x0F;
6806 #ifdef __LITTLE_ENDIAN__
6807   return vec_perm(
6808       __b, __a,
6809       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6810                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6811                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6812                              31 - __d));
6813 #else
6814   return vec_perm(
6815       __a, __b,
6816       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6817                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6818                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6819 #endif
6820 }
6821
6822 static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
6823                                             unsigned char __c) {
6824   unsigned char __d = __c & 0x0F;
6825 #ifdef __LITTLE_ENDIAN__
6826   return vec_perm(
6827       __b, __a,
6828       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6829                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6830                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6831                              31 - __d));
6832 #else
6833   return vec_perm(
6834       __a, __b,
6835       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6836                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6837                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6838 #endif
6839 }
6840
6841 static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
6842                                                      vector unsigned short __b,
6843                                                      unsigned char __c) {
6844   unsigned char __d = __c & 0x0F;
6845 #ifdef __LITTLE_ENDIAN__
6846   return vec_perm(
6847       __b, __a,
6848       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6849                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6850                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6851                              31 - __d));
6852 #else
6853   return vec_perm(
6854       __a, __b,
6855       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6856                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6857                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6858 #endif
6859 }
6860
6861 static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
6862                                             unsigned char __c) {
6863   unsigned char __d = __c & 0x0F;
6864 #ifdef __LITTLE_ENDIAN__
6865   return vec_perm(
6866       __b, __a,
6867       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6868                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6869                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6870                              31 - __d));
6871 #else
6872   return vec_perm(
6873       __a, __b,
6874       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6875                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6876                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6877 #endif
6878 }
6879
6880 static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
6881                                           unsigned char __c) {
6882   unsigned char __d = __c & 0x0F;
6883 #ifdef __LITTLE_ENDIAN__
6884   return vec_perm(
6885       __b, __a,
6886       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6887                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6888                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6889                              31 - __d));
6890 #else
6891   return vec_perm(
6892       __a, __b,
6893       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6894                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6895                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6896 #endif
6897 }
6898
6899 static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
6900                                                    vector unsigned int __b,
6901                                                    unsigned char __c) {
6902   unsigned char __d = __c & 0x0F;
6903 #ifdef __LITTLE_ENDIAN__
6904   return vec_perm(
6905       __b, __a,
6906       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6907                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6908                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6909                              31 - __d));
6910 #else
6911   return vec_perm(
6912       __a, __b,
6913       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6914                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6915                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6916 #endif
6917 }
6918
6919 static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
6920                                             unsigned char __c) {
6921   unsigned char __d = __c & 0x0F;
6922 #ifdef __LITTLE_ENDIAN__
6923   return vec_perm(
6924       __b, __a,
6925       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6926                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6927                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6928                              31 - __d));
6929 #else
6930   return vec_perm(
6931       __a, __b,
6932       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6933                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6934                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6935 #endif
6936 }
6937
6938 /* vec_sll */
6939
6940 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
6941                                                vector unsigned char __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_sll(vector signed char __a,
6947                                                vector unsigned short __b) {
6948   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
6949                                                    (vector int)__b);
6950 }
6951
6952 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
6953                                                vector unsigned int __b) {
6954   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
6955                                                    (vector int)__b);
6956 }
6957
6958 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
6959                                                  vector unsigned char __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_sll(vector unsigned char __a,
6965                                                  vector unsigned short __b) {
6966   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
6967                                                      (vector int)__b);
6968 }
6969
6970 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
6971                                                  vector unsigned int __b) {
6972   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
6973                                                      (vector int)__b);
6974 }
6975
6976 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
6977                                              vector unsigned char __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_sll(vector bool char __a,
6983                                              vector unsigned short __b) {
6984   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
6985                                                  (vector int)__b);
6986 }
6987
6988 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
6989                                              vector unsigned int __b) {
6990   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
6991                                                  (vector int)__b);
6992 }
6993
6994 static vector short __ATTRS_o_ai vec_sll(vector short __a,
6995                                          vector unsigned char __b) {
6996   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
6997 }
6998
6999 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7000                                          vector unsigned short __b) {
7001   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7002 }
7003
7004 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7005                                          vector unsigned int __b) {
7006   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7007 }
7008
7009 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7010                                                   vector unsigned char __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_sll(vector unsigned short __a,
7016                                                   vector unsigned short __b) {
7017   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7018                                                       (vector int)__b);
7019 }
7020
7021 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7022                                                   vector unsigned int __b) {
7023   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7024                                                       (vector int)__b);
7025 }
7026
7027 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7028                                               vector unsigned char __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_sll(vector bool short __a,
7034                                               vector unsigned short __b) {
7035   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7036                                                   (vector int)__b);
7037 }
7038
7039 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7040                                               vector unsigned int __b) {
7041   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7042                                                   (vector int)__b);
7043 }
7044
7045 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7046                                          vector unsigned char __b) {
7047   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7048 }
7049
7050 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7051                                          vector unsigned short __b) {
7052   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7053 }
7054
7055 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7056                                          vector unsigned int __b) {
7057   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7058 }
7059
7060 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7061                                        vector unsigned char __b) {
7062   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7063 }
7064
7065 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7066                                        vector unsigned short __b) {
7067   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7068 }
7069
7070 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7071                                        vector unsigned int __b) {
7072   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7073 }
7074
7075 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7076                                                 vector unsigned char __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_sll(vector unsigned int __a,
7082                                                 vector unsigned short __b) {
7083   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7084                                                     (vector int)__b);
7085 }
7086
7087 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7088                                                 vector unsigned int __b) {
7089   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7090                                                     (vector int)__b);
7091 }
7092
7093 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7094                                             vector unsigned char __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_sll(vector bool int __a,
7100                                             vector unsigned short __b) {
7101   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7102                                                 (vector int)__b);
7103 }
7104
7105 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7106                                             vector unsigned int __b) {
7107   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7108                                                 (vector int)__b);
7109 }
7110
7111 /* vec_vsl */
7112
7113 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7114                                                vector unsigned char __b) {
7115   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7116                                                    (vector int)__b);
7117 }
7118
7119 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7120                                                vector unsigned short __b) {
7121   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7122                                                    (vector int)__b);
7123 }
7124
7125 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7126                                                vector unsigned int __b) {
7127   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7128                                                    (vector int)__b);
7129 }
7130
7131 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7132                                                  vector unsigned char __b) {
7133   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7134                                                      (vector int)__b);
7135 }
7136
7137 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7138                                                  vector unsigned short __b) {
7139   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7140                                                      (vector int)__b);
7141 }
7142
7143 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7144                                                  vector unsigned int __b) {
7145   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7146                                                      (vector int)__b);
7147 }
7148
7149 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7150                                              vector unsigned char __b) {
7151   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7152                                                  (vector int)__b);
7153 }
7154
7155 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7156                                              vector unsigned short __b) {
7157   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7158                                                  (vector int)__b);
7159 }
7160
7161 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7162                                              vector unsigned int __b) {
7163   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7164                                                  (vector int)__b);
7165 }
7166
7167 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7168                                          vector unsigned char __b) {
7169   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7170 }
7171
7172 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7173                                          vector unsigned short __b) {
7174   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7175 }
7176
7177 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7178                                          vector unsigned int __b) {
7179   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7180 }
7181
7182 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7183                                                   vector unsigned char __b) {
7184   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7185                                                       (vector int)__b);
7186 }
7187
7188 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7189                                                   vector unsigned short __b) {
7190   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7191                                                       (vector int)__b);
7192 }
7193
7194 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7195                                                   vector unsigned int __b) {
7196   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7197                                                       (vector int)__b);
7198 }
7199
7200 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7201                                               vector unsigned char __b) {
7202   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7203                                                   (vector int)__b);
7204 }
7205
7206 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7207                                               vector unsigned short __b) {
7208   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7209                                                   (vector int)__b);
7210 }
7211
7212 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7213                                               vector unsigned int __b) {
7214   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7215                                                   (vector int)__b);
7216 }
7217
7218 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7219                                          vector unsigned char __b) {
7220   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7221 }
7222
7223 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7224                                          vector unsigned short __b) {
7225   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7226 }
7227
7228 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7229                                          vector unsigned int __b) {
7230   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7231 }
7232
7233 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7234                                        vector unsigned char __b) {
7235   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7236 }
7237
7238 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7239                                        vector unsigned short __b) {
7240   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7241 }
7242
7243 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7244                                        vector unsigned int __b) {
7245   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7246 }
7247
7248 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7249                                                 vector unsigned char __b) {
7250   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7251                                                     (vector int)__b);
7252 }
7253
7254 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7255                                                 vector unsigned short __b) {
7256   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7257                                                     (vector int)__b);
7258 }
7259
7260 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7261                                                 vector unsigned int __b) {
7262   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7263                                                     (vector int)__b);
7264 }
7265
7266 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7267                                             vector unsigned char __b) {
7268   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7269                                                 (vector int)__b);
7270 }
7271
7272 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7273                                             vector unsigned short __b) {
7274   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7275                                                 (vector int)__b);
7276 }
7277
7278 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7279                                             vector unsigned int __b) {
7280   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7281                                                 (vector int)__b);
7282 }
7283
7284 /* vec_slo */
7285
7286 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7287                                                vector signed char __b) {
7288   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7289                                                     (vector int)__b);
7290 }
7291
7292 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7293                                                vector unsigned char __b) {
7294   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7295                                                     (vector int)__b);
7296 }
7297
7298 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7299                                                  vector signed char __b) {
7300   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7301                                                       (vector int)__b);
7302 }
7303
7304 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7305                                                  vector unsigned char __b) {
7306   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7307                                                       (vector int)__b);
7308 }
7309
7310 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7311                                          vector signed char __b) {
7312   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7313 }
7314
7315 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7316                                          vector unsigned char __b) {
7317   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7318 }
7319
7320 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7321                                                   vector signed char __b) {
7322   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7323                                                        (vector int)__b);
7324 }
7325
7326 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7327                                                   vector unsigned char __b) {
7328   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7329                                                        (vector int)__b);
7330 }
7331
7332 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7333                                          vector signed char __b) {
7334   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7335 }
7336
7337 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7338                                          vector unsigned char __b) {
7339   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7340 }
7341
7342 static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
7343   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7344 }
7345
7346 static vector int __ATTRS_o_ai vec_slo(vector int __a,
7347                                        vector unsigned char __b) {
7348   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7349 }
7350
7351 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7352                                                 vector signed char __b) {
7353   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7354                                                      (vector int)__b);
7355 }
7356
7357 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7358                                                 vector unsigned char __b) {
7359   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7360                                                      (vector int)__b);
7361 }
7362
7363 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7364                                          vector signed char __b) {
7365   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7366 }
7367
7368 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7369                                          vector unsigned char __b) {
7370   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7371 }
7372
7373 /* vec_vslo */
7374
7375 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7376                                                 vector signed char __b) {
7377   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7378                                                     (vector int)__b);
7379 }
7380
7381 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7382                                                 vector unsigned char __b) {
7383   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7384                                                     (vector int)__b);
7385 }
7386
7387 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7388                                                   vector signed char __b) {
7389   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7390                                                       (vector int)__b);
7391 }
7392
7393 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7394                                                   vector unsigned char __b) {
7395   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7396                                                       (vector int)__b);
7397 }
7398
7399 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7400                                           vector signed char __b) {
7401   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7402 }
7403
7404 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7405                                           vector unsigned char __b) {
7406   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7407 }
7408
7409 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7410                                                    vector signed char __b) {
7411   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7412                                                        (vector int)__b);
7413 }
7414
7415 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7416                                                    vector unsigned char __b) {
7417   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7418                                                        (vector int)__b);
7419 }
7420
7421 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7422                                           vector signed char __b) {
7423   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7424 }
7425
7426 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7427                                           vector unsigned char __b) {
7428   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7429 }
7430
7431 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7432                                         vector signed char __b) {
7433   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7434 }
7435
7436 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7437                                         vector unsigned char __b) {
7438   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7439 }
7440
7441 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7442                                                  vector signed char __b) {
7443   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7444                                                      (vector int)__b);
7445 }
7446
7447 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7448                                                  vector unsigned char __b) {
7449   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7450                                                      (vector int)__b);
7451 }
7452
7453 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7454                                           vector signed char __b) {
7455   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7456 }
7457
7458 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7459                                           vector unsigned char __b) {
7460   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7461 }
7462
7463 /* vec_splat */
7464
7465 static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
7466                                                  unsigned const int __b) {
7467   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7468 }
7469
7470 static vector unsigned char __ATTRS_o_ai vec_splat(vector unsigned char __a,
7471                                                    unsigned const int __b) {
7472   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7473 }
7474
7475 static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
7476                                                unsigned const int __b) {
7477   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7478 }
7479
7480 static vector signed short __ATTRS_o_ai vec_splat(vector signed short __a,
7481                                                   unsigned const int __b) {
7482   unsigned char b0 = (__b & 0x07) * 2;
7483   unsigned char b1 = b0 + 1;
7484   return vec_perm(__a, __a,
7485                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7486                                          b0, b1, b0, b1, b0, b1, b0, b1));
7487 }
7488
7489 static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
7490                                                     unsigned const int __b) {
7491   unsigned char b0 = (__b & 0x07) * 2;
7492   unsigned char b1 = b0 + 1;
7493   return vec_perm(__a, __a,
7494                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7495                                          b0, b1, b0, b1, b0, b1, b0, b1));
7496 }
7497
7498 static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
7499                                                 unsigned const int __b) {
7500   unsigned char b0 = (__b & 0x07) * 2;
7501   unsigned char b1 = b0 + 1;
7502   return vec_perm(__a, __a,
7503                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7504                                          b0, b1, b0, b1, b0, b1, b0, b1));
7505 }
7506
7507 static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
7508                                            unsigned const int __b) {
7509   unsigned char b0 = (__b & 0x07) * 2;
7510   unsigned char b1 = b0 + 1;
7511   return vec_perm(__a, __a,
7512                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7513                                          b0, b1, b0, b1, b0, b1, b0, b1));
7514 }
7515
7516 static vector signed int __ATTRS_o_ai vec_splat(vector signed int __a,
7517                                                 unsigned const int __b) {
7518   unsigned char b0 = (__b & 0x03) * 4;
7519   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7520   return vec_perm(__a, __a,
7521                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7522                                          b1, b2, b3, b0, b1, b2, b3));
7523 }
7524
7525 static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
7526                                                   unsigned const int __b) {
7527   unsigned char b0 = (__b & 0x03) * 4;
7528   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7529   return vec_perm(__a, __a,
7530                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7531                                          b1, b2, b3, b0, b1, b2, b3));
7532 }
7533
7534 static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
7535                                               unsigned const int __b) {
7536   unsigned char b0 = (__b & 0x03) * 4;
7537   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7538   return vec_perm(__a, __a,
7539                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7540                                          b1, b2, b3, b0, b1, b2, b3));
7541 }
7542
7543 static vector float __ATTRS_o_ai vec_splat(vector float __a,
7544                                            unsigned const int __b) {
7545   unsigned char b0 = (__b & 0x03) * 4;
7546   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7547   return vec_perm(__a, __a,
7548                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7549                                          b1, b2, b3, b0, b1, b2, b3));
7550 }
7551
7552 #ifdef __VSX__
7553 static vector double __ATTRS_o_ai vec_splat(vector double __a,
7554                                             unsigned const int __b) {
7555   unsigned char b0 = (__b & 0x01) * 8;
7556   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7557                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7558   return vec_perm(__a, __a,
7559                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7560                                          b0, b1, b2, b3, b4, b5, b6, b7));
7561 }
7562 static vector bool long long __ATTRS_o_ai vec_splat(vector bool long long __a,
7563                                                     unsigned const int __b) {
7564   unsigned char b0 = (__b & 0x01) * 8;
7565   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7566                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7567   return vec_perm(__a, __a,
7568                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7569                                          b0, b1, b2, b3, b4, b5, b6, b7));
7570 }
7571 static vector signed long long __ATTRS_o_ai
7572 vec_splat(vector signed long long __a, unsigned const int __b) {
7573   unsigned char b0 = (__b & 0x01) * 8;
7574   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7575                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7576   return vec_perm(__a, __a,
7577                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7578                                          b0, b1, b2, b3, b4, b5, b6, b7));
7579 }
7580 static vector unsigned long long __ATTRS_o_ai
7581 vec_splat(vector unsigned long long __a, unsigned const int __b) {
7582   unsigned char b0 = (__b & 0x01) * 8;
7583   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7584                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7585   return vec_perm(__a, __a,
7586                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7587                                          b0, b1, b2, b3, b4, b5, b6, b7));
7588 }
7589 #endif
7590
7591 /* vec_vspltb */
7592
7593 #define __builtin_altivec_vspltb vec_vspltb
7594
7595 static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
7596                                                   unsigned char __b) {
7597   return vec_perm(__a, __a, (vector unsigned char)(__b));
7598 }
7599
7600 static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
7601                                                     unsigned char __b) {
7602   return vec_perm(__a, __a, (vector unsigned char)(__b));
7603 }
7604
7605 static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
7606                                                 unsigned char __b) {
7607   return vec_perm(__a, __a, (vector unsigned char)(__b));
7608 }
7609
7610 /* vec_vsplth */
7611
7612 #define __builtin_altivec_vsplth vec_vsplth
7613
7614 static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
7615                                             unsigned char __b) {
7616   __b *= 2;
7617   unsigned char b1 = __b + 1;
7618   return vec_perm(__a, __a,
7619                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7620                                          __b, b1, __b, b1, __b, b1, __b, b1));
7621 }
7622
7623 static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
7624                                                      unsigned char __b) {
7625   __b *= 2;
7626   unsigned char b1 = __b + 1;
7627   return vec_perm(__a, __a,
7628                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7629                                          __b, b1, __b, b1, __b, b1, __b, b1));
7630 }
7631
7632 static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
7633                                                  unsigned char __b) {
7634   __b *= 2;
7635   unsigned char b1 = __b + 1;
7636   return vec_perm(__a, __a,
7637                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7638                                          __b, b1, __b, b1, __b, b1, __b, b1));
7639 }
7640
7641 static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
7642                                             unsigned char __b) {
7643   __b *= 2;
7644   unsigned char b1 = __b + 1;
7645   return vec_perm(__a, __a,
7646                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7647                                          __b, b1, __b, b1, __b, b1, __b, b1));
7648 }
7649
7650 /* vec_vspltw */
7651
7652 #define __builtin_altivec_vspltw vec_vspltw
7653
7654 static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
7655   __b *= 4;
7656   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7657   return vec_perm(__a, __a,
7658                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7659                                          b1, b2, b3, __b, b1, b2, b3));
7660 }
7661
7662 static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
7663                                                    unsigned char __b) {
7664   __b *= 4;
7665   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7666   return vec_perm(__a, __a,
7667                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7668                                          b1, b2, b3, __b, b1, b2, b3));
7669 }
7670
7671 static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
7672                                                unsigned char __b) {
7673   __b *= 4;
7674   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7675   return vec_perm(__a, __a,
7676                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7677                                          b1, b2, b3, __b, b1, b2, b3));
7678 }
7679
7680 static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
7681                                             unsigned char __b) {
7682   __b *= 4;
7683   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7684   return vec_perm(__a, __a,
7685                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7686                                          b1, b2, b3, __b, b1, b2, b3));
7687 }
7688
7689 /* vec_splat_s8 */
7690
7691 #define __builtin_altivec_vspltisb vec_splat_s8
7692
7693 // FIXME: parameter should be treated as 5-bit signed literal
7694 static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
7695   return (vector signed char)(__a);
7696 }
7697
7698 /* vec_vspltisb */
7699
7700 // FIXME: parameter should be treated as 5-bit signed literal
7701 static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
7702   return (vector signed char)(__a);
7703 }
7704
7705 /* vec_splat_s16 */
7706
7707 #define __builtin_altivec_vspltish vec_splat_s16
7708
7709 // FIXME: parameter should be treated as 5-bit signed literal
7710 static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
7711   return (vector short)(__a);
7712 }
7713
7714 /* vec_vspltish */
7715
7716 // FIXME: parameter should be treated as 5-bit signed literal
7717 static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
7718   return (vector short)(__a);
7719 }
7720
7721 /* vec_splat_s32 */
7722
7723 #define __builtin_altivec_vspltisw vec_splat_s32
7724
7725 // FIXME: parameter should be treated as 5-bit signed literal
7726 static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
7727   return (vector int)(__a);
7728 }
7729
7730 /* vec_vspltisw */
7731
7732 // FIXME: parameter should be treated as 5-bit signed literal
7733 static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
7734   return (vector int)(__a);
7735 }
7736
7737 /* vec_splat_u8 */
7738
7739 // FIXME: parameter should be treated as 5-bit signed literal
7740 static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
7741   return (vector unsigned char)(__a);
7742 }
7743
7744 /* vec_splat_u16 */
7745
7746 // FIXME: parameter should be treated as 5-bit signed literal
7747 static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
7748   return (vector unsigned short)(__a);
7749 }
7750
7751 /* vec_splat_u32 */
7752
7753 // FIXME: parameter should be treated as 5-bit signed literal
7754 static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
7755   return (vector unsigned int)(__a);
7756 }
7757
7758 /* vec_sr */
7759
7760 static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
7761                                               vector unsigned char __b) {
7762   vector unsigned char __res = (vector unsigned char)__a >> __b;
7763   return (vector signed char)__res;
7764 }
7765
7766 static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
7767                                                 vector unsigned char __b) {
7768   return __a >> __b;
7769 }
7770
7771 static vector signed short __ATTRS_o_ai vec_sr(vector signed short __a,
7772                                         vector unsigned short __b) {
7773   vector unsigned short __res = (vector unsigned short)__a >> __b;
7774   return (vector signed short)__res;
7775 }
7776
7777 static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
7778                                                  vector unsigned short __b) {
7779   return __a >> __b;
7780 }
7781
7782 static vector signed int __ATTRS_o_ai vec_sr(vector signed int __a,
7783                                              vector unsigned int __b) {
7784   vector unsigned int __res = (vector unsigned int)__a >> __b;
7785   return (vector signed int)__res;
7786 }
7787
7788 static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
7789                                                vector unsigned int __b) {
7790   return __a >> __b;
7791 }
7792
7793 #ifdef __POWER8_VECTOR__
7794 static vector signed long long __ATTRS_o_ai
7795 vec_sr(vector signed long long __a, vector unsigned long long __b) {
7796   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
7797   return (vector signed long long)__res;
7798 }
7799
7800 static vector unsigned long long __ATTRS_o_ai
7801 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
7802   return __a >> __b;
7803 }
7804 #endif
7805
7806 /* vec_vsrb */
7807
7808 #define __builtin_altivec_vsrb vec_vsrb
7809
7810 static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
7811                                                 vector unsigned char __b) {
7812   return __a >> (vector signed char)__b;
7813 }
7814
7815 static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
7816                                                   vector unsigned char __b) {
7817   return __a >> __b;
7818 }
7819
7820 /* vec_vsrh */
7821
7822 #define __builtin_altivec_vsrh vec_vsrh
7823
7824 static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
7825                                           vector unsigned short __b) {
7826   return __a >> (vector short)__b;
7827 }
7828
7829 static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
7830                                                    vector unsigned short __b) {
7831   return __a >> __b;
7832 }
7833
7834 /* vec_vsrw */
7835
7836 #define __builtin_altivec_vsrw vec_vsrw
7837
7838 static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
7839                                         vector unsigned int __b) {
7840   return __a >> (vector int)__b;
7841 }
7842
7843 static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
7844                                                  vector unsigned int __b) {
7845   return __a >> __b;
7846 }
7847
7848 /* vec_sra */
7849
7850 static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
7851                                                vector unsigned char __b) {
7852   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
7853 }
7854
7855 static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
7856                                                  vector unsigned char __b) {
7857   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
7858 }
7859
7860 static vector short __ATTRS_o_ai vec_sra(vector short __a,
7861                                          vector unsigned short __b) {
7862   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
7863 }
7864
7865 static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
7866                                                   vector unsigned short __b) {
7867   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
7868 }
7869
7870 static vector int __ATTRS_o_ai vec_sra(vector int __a,
7871                                        vector unsigned int __b) {
7872   return __builtin_altivec_vsraw(__a, __b);
7873 }
7874
7875 static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
7876                                                 vector unsigned int __b) {
7877   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
7878 }
7879
7880 #ifdef __POWER8_VECTOR__
7881 static vector signed long long __ATTRS_o_ai
7882 vec_sra(vector signed long long __a, vector unsigned long long __b) {
7883   return __a >> __b;
7884 }
7885
7886 static vector unsigned long long __ATTRS_o_ai
7887 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
7888   return (vector unsigned long long)((vector signed long long)__a >> __b);
7889 }
7890 #endif
7891
7892 /* vec_vsrab */
7893
7894 static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
7895                                                  vector unsigned char __b) {
7896   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
7897 }
7898
7899 static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
7900                                                    vector unsigned char __b) {
7901   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
7902 }
7903
7904 /* vec_vsrah */
7905
7906 static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
7907                                            vector unsigned short __b) {
7908   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
7909 }
7910
7911 static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
7912                                                     vector unsigned short __b) {
7913   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
7914 }
7915
7916 /* vec_vsraw */
7917
7918 static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
7919                                          vector unsigned int __b) {
7920   return __builtin_altivec_vsraw(__a, __b);
7921 }
7922
7923 static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
7924                                                   vector unsigned int __b) {
7925   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
7926 }
7927
7928 /* vec_srl */
7929
7930 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
7931                                                vector unsigned char __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_srl(vector signed char __a,
7937                                                vector unsigned short __b) {
7938   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
7939                                                    (vector int)__b);
7940 }
7941
7942 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
7943                                                vector unsigned int __b) {
7944   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
7945                                                    (vector int)__b);
7946 }
7947
7948 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
7949                                                  vector unsigned char __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_srl(vector unsigned char __a,
7955                                                  vector unsigned short __b) {
7956   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
7957                                                      (vector int)__b);
7958 }
7959
7960 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
7961                                                  vector unsigned int __b) {
7962   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
7963                                                      (vector int)__b);
7964 }
7965
7966 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
7967                                              vector unsigned char __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_srl(vector bool char __a,
7973                                              vector unsigned short __b) {
7974   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
7975                                                  (vector int)__b);
7976 }
7977
7978 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
7979                                              vector unsigned int __b) {
7980   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
7981                                                  (vector int)__b);
7982 }
7983
7984 static vector short __ATTRS_o_ai vec_srl(vector short __a,
7985                                          vector unsigned char __b) {
7986   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
7987 }
7988
7989 static vector short __ATTRS_o_ai vec_srl(vector short __a,
7990                                          vector unsigned short __b) {
7991   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
7992 }
7993
7994 static vector short __ATTRS_o_ai vec_srl(vector short __a,
7995                                          vector unsigned int __b) {
7996   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
7997 }
7998
7999 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8000                                                   vector unsigned char __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_srl(vector unsigned short __a,
8006                                                   vector unsigned short __b) {
8007   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8008                                                       (vector int)__b);
8009 }
8010
8011 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8012                                                   vector unsigned int __b) {
8013   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8014                                                       (vector int)__b);
8015 }
8016
8017 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8018                                               vector unsigned char __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_srl(vector bool short __a,
8024                                               vector unsigned short __b) {
8025   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8026                                                   (vector int)__b);
8027 }
8028
8029 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8030                                               vector unsigned int __b) {
8031   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8032                                                   (vector int)__b);
8033 }
8034
8035 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8036                                          vector unsigned char __b) {
8037   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8038 }
8039
8040 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8041                                          vector unsigned short __b) {
8042   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8043 }
8044
8045 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8046                                          vector unsigned int __b) {
8047   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8048 }
8049
8050 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8051                                        vector unsigned char __b) {
8052   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8053 }
8054
8055 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8056                                        vector unsigned short __b) {
8057   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8058 }
8059
8060 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8061                                        vector unsigned int __b) {
8062   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8063 }
8064
8065 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8066                                                 vector unsigned char __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_srl(vector unsigned int __a,
8072                                                 vector unsigned short __b) {
8073   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8074                                                     (vector int)__b);
8075 }
8076
8077 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8078                                                 vector unsigned int __b) {
8079   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8080                                                     (vector int)__b);
8081 }
8082
8083 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8084                                             vector unsigned char __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_srl(vector bool int __a,
8090                                             vector unsigned short __b) {
8091   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8092                                                 (vector int)__b);
8093 }
8094
8095 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8096                                             vector unsigned int __b) {
8097   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8098                                                 (vector int)__b);
8099 }
8100
8101 /* vec_vsr */
8102
8103 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8104                                                vector unsigned char __b) {
8105   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8106                                                    (vector int)__b);
8107 }
8108
8109 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8110                                                vector unsigned short __b) {
8111   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8112                                                    (vector int)__b);
8113 }
8114
8115 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8116                                                vector unsigned int __b) {
8117   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8118                                                    (vector int)__b);
8119 }
8120
8121 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8122                                                  vector unsigned char __b) {
8123   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8124                                                      (vector int)__b);
8125 }
8126
8127 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8128                                                  vector unsigned short __b) {
8129   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8130                                                      (vector int)__b);
8131 }
8132
8133 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8134                                                  vector unsigned int __b) {
8135   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8136                                                      (vector int)__b);
8137 }
8138
8139 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8140                                              vector unsigned char __b) {
8141   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8142                                                  (vector int)__b);
8143 }
8144
8145 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8146                                              vector unsigned short __b) {
8147   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8148                                                  (vector int)__b);
8149 }
8150
8151 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8152                                              vector unsigned int __b) {
8153   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8154                                                  (vector int)__b);
8155 }
8156
8157 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8158                                          vector unsigned char __b) {
8159   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8160 }
8161
8162 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8163                                          vector unsigned short __b) {
8164   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8165 }
8166
8167 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8168                                          vector unsigned int __b) {
8169   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8170 }
8171
8172 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8173                                                   vector unsigned char __b) {
8174   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8175                                                       (vector int)__b);
8176 }
8177
8178 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8179                                                   vector unsigned short __b) {
8180   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8181                                                       (vector int)__b);
8182 }
8183
8184 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8185                                                   vector unsigned int __b) {
8186   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8187                                                       (vector int)__b);
8188 }
8189
8190 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8191                                               vector unsigned char __b) {
8192   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8193                                                   (vector int)__b);
8194 }
8195
8196 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8197                                               vector unsigned short __b) {
8198   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8199                                                   (vector int)__b);
8200 }
8201
8202 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8203                                               vector unsigned int __b) {
8204   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8205                                                   (vector int)__b);
8206 }
8207
8208 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8209                                          vector unsigned char __b) {
8210   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8211 }
8212
8213 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8214                                          vector unsigned short __b) {
8215   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8216 }
8217
8218 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8219                                          vector unsigned int __b) {
8220   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8221 }
8222
8223 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8224                                        vector unsigned char __b) {
8225   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8226 }
8227
8228 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8229                                        vector unsigned short __b) {
8230   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8231 }
8232
8233 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8234                                        vector unsigned int __b) {
8235   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8236 }
8237
8238 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8239                                                 vector unsigned char __b) {
8240   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8241                                                     (vector int)__b);
8242 }
8243
8244 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8245                                                 vector unsigned short __b) {
8246   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8247                                                     (vector int)__b);
8248 }
8249
8250 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8251                                                 vector unsigned int __b) {
8252   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8253                                                     (vector int)__b);
8254 }
8255
8256 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8257                                             vector unsigned char __b) {
8258   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8259                                                 (vector int)__b);
8260 }
8261
8262 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8263                                             vector unsigned short __b) {
8264   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8265                                                 (vector int)__b);
8266 }
8267
8268 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8269                                             vector unsigned int __b) {
8270   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8271                                                 (vector int)__b);
8272 }
8273
8274 /* vec_sro */
8275
8276 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8277                                                vector signed char __b) {
8278   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8279                                                     (vector int)__b);
8280 }
8281
8282 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8283                                                vector unsigned char __b) {
8284   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8285                                                     (vector int)__b);
8286 }
8287
8288 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8289                                                  vector signed char __b) {
8290   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8291                                                       (vector int)__b);
8292 }
8293
8294 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8295                                                  vector unsigned char __b) {
8296   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8297                                                       (vector int)__b);
8298 }
8299
8300 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8301                                          vector signed char __b) {
8302   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8303 }
8304
8305 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8306                                          vector unsigned char __b) {
8307   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8308 }
8309
8310 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8311                                                   vector signed char __b) {
8312   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8313                                                        (vector int)__b);
8314 }
8315
8316 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8317                                                   vector unsigned char __b) {
8318   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8319                                                        (vector int)__b);
8320 }
8321
8322 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8323                                          vector signed char __b) {
8324   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8325 }
8326
8327 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8328                                          vector unsigned char __b) {
8329   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8330 }
8331
8332 static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
8333   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8334 }
8335
8336 static vector int __ATTRS_o_ai vec_sro(vector int __a,
8337                                        vector unsigned char __b) {
8338   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8339 }
8340
8341 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8342                                                 vector signed char __b) {
8343   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8344                                                      (vector int)__b);
8345 }
8346
8347 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8348                                                 vector unsigned char __b) {
8349   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8350                                                      (vector int)__b);
8351 }
8352
8353 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8354                                          vector signed char __b) {
8355   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8356 }
8357
8358 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8359                                          vector unsigned char __b) {
8360   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8361 }
8362
8363 /* vec_vsro */
8364
8365 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8366                                                 vector signed char __b) {
8367   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8368                                                     (vector int)__b);
8369 }
8370
8371 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8372                                                 vector unsigned char __b) {
8373   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8374                                                     (vector int)__b);
8375 }
8376
8377 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8378                                                   vector signed char __b) {
8379   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8380                                                       (vector int)__b);
8381 }
8382
8383 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8384                                                   vector unsigned char __b) {
8385   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8386                                                       (vector int)__b);
8387 }
8388
8389 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8390                                           vector signed char __b) {
8391   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8392 }
8393
8394 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8395                                           vector unsigned char __b) {
8396   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8397 }
8398
8399 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8400                                                    vector signed char __b) {
8401   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8402                                                        (vector int)__b);
8403 }
8404
8405 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8406                                                    vector unsigned char __b) {
8407   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8408                                                        (vector int)__b);
8409 }
8410
8411 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8412                                           vector signed char __b) {
8413   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8414 }
8415
8416 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8417                                           vector unsigned char __b) {
8418   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8419 }
8420
8421 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8422                                         vector signed char __b) {
8423   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8424 }
8425
8426 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8427                                         vector unsigned char __b) {
8428   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8429 }
8430
8431 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8432                                                  vector signed char __b) {
8433   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8434                                                      (vector int)__b);
8435 }
8436
8437 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8438                                                  vector unsigned char __b) {
8439   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8440                                                      (vector int)__b);
8441 }
8442
8443 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8444                                           vector signed char __b) {
8445   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8446 }
8447
8448 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8449                                           vector unsigned char __b) {
8450   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8451 }
8452
8453 /* vec_st */
8454
8455 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8456                                 vector signed char *__c) {
8457   __builtin_altivec_stvx((vector int)__a, __b, __c);
8458 }
8459
8460 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8461                                 signed char *__c) {
8462   __builtin_altivec_stvx((vector int)__a, __b, __c);
8463 }
8464
8465 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8466                                 vector unsigned char *__c) {
8467   __builtin_altivec_stvx((vector int)__a, __b, __c);
8468 }
8469
8470 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8471                                 unsigned char *__c) {
8472   __builtin_altivec_stvx((vector int)__a, __b, __c);
8473 }
8474
8475 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8476                                 signed char *__c) {
8477   __builtin_altivec_stvx((vector int)__a, __b, __c);
8478 }
8479
8480 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8481                                 unsigned char *__c) {
8482   __builtin_altivec_stvx((vector int)__a, __b, __c);
8483 }
8484
8485 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8486                                 vector bool char *__c) {
8487   __builtin_altivec_stvx((vector int)__a, __b, __c);
8488 }
8489
8490 static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
8491   __builtin_altivec_stvx((vector int)__a, __b, __c);
8492 }
8493
8494 static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
8495   __builtin_altivec_stvx((vector int)__a, __b, __c);
8496 }
8497
8498 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8499                                 vector unsigned short *__c) {
8500   __builtin_altivec_stvx((vector int)__a, __b, __c);
8501 }
8502
8503 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8504                                 unsigned short *__c) {
8505   __builtin_altivec_stvx((vector int)__a, __b, __c);
8506 }
8507
8508 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
8509   __builtin_altivec_stvx((vector int)__a, __b, __c);
8510 }
8511
8512 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8513                                 unsigned short *__c) {
8514   __builtin_altivec_stvx((vector int)__a, __b, __c);
8515 }
8516
8517 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8518                                 vector bool short *__c) {
8519   __builtin_altivec_stvx((vector int)__a, __b, __c);
8520 }
8521
8522 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
8523   __builtin_altivec_stvx((vector int)__a, __b, __c);
8524 }
8525
8526 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8527                                 unsigned short *__c) {
8528   __builtin_altivec_stvx((vector int)__a, __b, __c);
8529 }
8530
8531 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__c) {
8532   __builtin_altivec_stvx((vector int)__a, __b, __c);
8533 }
8534
8535 static void __ATTRS_o_ai vec_st(vector int __a, int __b, vector int *__c) {
8536   __builtin_altivec_stvx(__a, __b, __c);
8537 }
8538
8539 static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
8540   __builtin_altivec_stvx(__a, __b, __c);
8541 }
8542
8543 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8544                                 vector unsigned int *__c) {
8545   __builtin_altivec_stvx((vector int)__a, __b, __c);
8546 }
8547
8548 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8549                                 unsigned int *__c) {
8550   __builtin_altivec_stvx((vector int)__a, __b, __c);
8551 }
8552
8553 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b, int *__c) {
8554   __builtin_altivec_stvx((vector int)__a, __b, __c);
8555 }
8556
8557 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8558                                 unsigned int *__c) {
8559   __builtin_altivec_stvx((vector int)__a, __b, __c);
8560 }
8561
8562 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8563                                 vector bool int *__c) {
8564   __builtin_altivec_stvx((vector int)__a, __b, __c);
8565 }
8566
8567 static void __ATTRS_o_ai vec_st(vector float __a, int __b, vector float *__c) {
8568   __builtin_altivec_stvx((vector int)__a, __b, __c);
8569 }
8570
8571 static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
8572   __builtin_altivec_stvx((vector int)__a, __b, __c);
8573 }
8574
8575 /* vec_stvx */
8576
8577 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8578                                   vector signed char *__c) {
8579   __builtin_altivec_stvx((vector int)__a, __b, __c);
8580 }
8581
8582 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8583                                   signed char *__c) {
8584   __builtin_altivec_stvx((vector int)__a, __b, __c);
8585 }
8586
8587 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8588                                   vector unsigned char *__c) {
8589   __builtin_altivec_stvx((vector int)__a, __b, __c);
8590 }
8591
8592 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8593                                   unsigned char *__c) {
8594   __builtin_altivec_stvx((vector int)__a, __b, __c);
8595 }
8596
8597 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8598                                   signed char *__c) {
8599   __builtin_altivec_stvx((vector int)__a, __b, __c);
8600 }
8601
8602 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8603                                   unsigned char *__c) {
8604   __builtin_altivec_stvx((vector int)__a, __b, __c);
8605 }
8606
8607 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8608                                   vector bool char *__c) {
8609   __builtin_altivec_stvx((vector int)__a, __b, __c);
8610 }
8611
8612 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8613                                   vector short *__c) {
8614   __builtin_altivec_stvx((vector int)__a, __b, __c);
8615 }
8616
8617 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__c) {
8618   __builtin_altivec_stvx((vector int)__a, __b, __c);
8619 }
8620
8621 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8622                                   vector unsigned short *__c) {
8623   __builtin_altivec_stvx((vector int)__a, __b, __c);
8624 }
8625
8626 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8627                                   unsigned short *__c) {
8628   __builtin_altivec_stvx((vector int)__a, __b, __c);
8629 }
8630
8631 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, short *__c) {
8632   __builtin_altivec_stvx((vector int)__a, __b, __c);
8633 }
8634
8635 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8636                                   unsigned short *__c) {
8637   __builtin_altivec_stvx((vector int)__a, __b, __c);
8638 }
8639
8640 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8641                                   vector bool short *__c) {
8642   __builtin_altivec_stvx((vector int)__a, __b, __c);
8643 }
8644
8645 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
8646   __builtin_altivec_stvx((vector int)__a, __b, __c);
8647 }
8648
8649 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8650                                   unsigned short *__c) {
8651   __builtin_altivec_stvx((vector int)__a, __b, __c);
8652 }
8653
8654 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8655                                   vector pixel *__c) {
8656   __builtin_altivec_stvx((vector int)__a, __b, __c);
8657 }
8658
8659 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
8660   __builtin_altivec_stvx(__a, __b, __c);
8661 }
8662
8663 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
8664   __builtin_altivec_stvx(__a, __b, __c);
8665 }
8666
8667 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8668                                   vector unsigned int *__c) {
8669   __builtin_altivec_stvx((vector int)__a, __b, __c);
8670 }
8671
8672 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8673                                   unsigned int *__c) {
8674   __builtin_altivec_stvx((vector int)__a, __b, __c);
8675 }
8676
8677 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
8678   __builtin_altivec_stvx((vector int)__a, __b, __c);
8679 }
8680
8681 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8682                                   unsigned int *__c) {
8683   __builtin_altivec_stvx((vector int)__a, __b, __c);
8684 }
8685
8686 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8687                                   vector bool int *__c) {
8688   __builtin_altivec_stvx((vector int)__a, __b, __c);
8689 }
8690
8691 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8692                                   vector float *__c) {
8693   __builtin_altivec_stvx((vector int)__a, __b, __c);
8694 }
8695
8696 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
8697   __builtin_altivec_stvx((vector int)__a, __b, __c);
8698 }
8699
8700 /* vec_ste */
8701
8702 static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
8703                                  signed char *__c) {
8704   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8705 }
8706
8707 static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
8708                                  unsigned char *__c) {
8709   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8710 }
8711
8712 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8713                                  signed char *__c) {
8714   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8715 }
8716
8717 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8718                                  unsigned char *__c) {
8719   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8720 }
8721
8722 static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
8723   __builtin_altivec_stvehx(__a, __b, __c);
8724 }
8725
8726 static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
8727                                  unsigned short *__c) {
8728   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8729 }
8730
8731 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
8732   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8733 }
8734
8735 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8736                                  unsigned short *__c) {
8737   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8738 }
8739
8740 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
8741   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8742 }
8743
8744 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8745                                  unsigned short *__c) {
8746   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8747 }
8748
8749 static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
8750   __builtin_altivec_stvewx(__a, __b, __c);
8751 }
8752
8753 static void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
8754                                  unsigned int *__c) {
8755   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8756 }
8757
8758 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, int *__c) {
8759   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8760 }
8761
8762 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8763                                  unsigned int *__c) {
8764   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8765 }
8766
8767 static void __ATTRS_o_ai vec_ste(vector float __a, int __b, float *__c) {
8768   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8769 }
8770
8771 /* vec_stvebx */
8772
8773 static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
8774                                     signed char *__c) {
8775   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8776 }
8777
8778 static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
8779                                     unsigned char *__c) {
8780   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8781 }
8782
8783 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8784                                     signed char *__c) {
8785   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8786 }
8787
8788 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8789                                     unsigned char *__c) {
8790   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8791 }
8792
8793 /* vec_stvehx */
8794
8795 static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
8796   __builtin_altivec_stvehx(__a, __b, __c);
8797 }
8798
8799 static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
8800                                     unsigned short *__c) {
8801   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8802 }
8803
8804 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8805                                     short *__c) {
8806   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8807 }
8808
8809 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8810                                     unsigned short *__c) {
8811   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8812 }
8813
8814 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
8815   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8816 }
8817
8818 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
8819                                     unsigned short *__c) {
8820   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8821 }
8822
8823 /* vec_stvewx */
8824
8825 static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
8826   __builtin_altivec_stvewx(__a, __b, __c);
8827 }
8828
8829 static void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
8830                                     unsigned int *__c) {
8831   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8832 }
8833
8834 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
8835   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8836 }
8837
8838 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
8839                                     unsigned int *__c) {
8840   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8841 }
8842
8843 static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
8844   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8845 }
8846
8847 /* vec_stl */
8848
8849 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8850                                  vector signed char *__c) {
8851   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8852 }
8853
8854 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8855                                  signed char *__c) {
8856   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8857 }
8858
8859 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8860                                  vector unsigned char *__c) {
8861   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8862 }
8863
8864 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8865                                  unsigned char *__c) {
8866   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8867 }
8868
8869 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8870                                  signed char *__c) {
8871   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8872 }
8873
8874 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8875                                  unsigned char *__c) {
8876   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8877 }
8878
8879 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8880                                  vector bool char *__c) {
8881   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8882 }
8883
8884 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
8885   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8886 }
8887
8888 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
8889   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8890 }
8891
8892 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
8893                                  vector unsigned short *__c) {
8894   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8895 }
8896
8897 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
8898                                  unsigned short *__c) {
8899   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8900 }
8901
8902 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
8903   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8904 }
8905
8906 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
8907                                  unsigned short *__c) {
8908   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8909 }
8910
8911 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
8912                                  vector bool short *__c) {
8913   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8914 }
8915
8916 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
8917   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8918 }
8919
8920 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
8921                                  unsigned short *__c) {
8922   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8923 }
8924
8925 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__c) {
8926   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8927 }
8928
8929 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, vector int *__c) {
8930   __builtin_altivec_stvxl(__a, __b, __c);
8931 }
8932
8933 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
8934   __builtin_altivec_stvxl(__a, __b, __c);
8935 }
8936
8937 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
8938                                  vector unsigned int *__c) {
8939   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8940 }
8941
8942 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
8943                                  unsigned int *__c) {
8944   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8945 }
8946
8947 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, int *__c) {
8948   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8949 }
8950
8951 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
8952                                  unsigned int *__c) {
8953   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8954 }
8955
8956 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
8957                                  vector bool int *__c) {
8958   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8959 }
8960
8961 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, vector float *__c) {
8962   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8963 }
8964
8965 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, float *__c) {
8966   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8967 }
8968
8969 /* vec_stvxl */
8970
8971 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
8972                                    vector signed char *__c) {
8973   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8974 }
8975
8976 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
8977                                    signed char *__c) {
8978   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8979 }
8980
8981 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
8982                                    vector unsigned char *__c) {
8983   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8984 }
8985
8986 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
8987                                    unsigned char *__c) {
8988   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8989 }
8990
8991 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
8992                                    signed char *__c) {
8993   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8994 }
8995
8996 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
8997                                    unsigned char *__c) {
8998   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8999 }
9000
9001 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9002                                    vector bool char *__c) {
9003   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9004 }
9005
9006 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9007                                    vector short *__c) {
9008   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9009 }
9010
9011 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__c) {
9012   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9013 }
9014
9015 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9016                                    vector unsigned short *__c) {
9017   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9018 }
9019
9020 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9021                                    unsigned short *__c) {
9022   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9023 }
9024
9025 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, short *__c) {
9026   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9027 }
9028
9029 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9030                                    unsigned short *__c) {
9031   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9032 }
9033
9034 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9035                                    vector bool short *__c) {
9036   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9037 }
9038
9039 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
9040   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9041 }
9042
9043 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9044                                    unsigned short *__c) {
9045   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9046 }
9047
9048 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9049                                    vector pixel *__c) {
9050   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9051 }
9052
9053 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
9054   __builtin_altivec_stvxl(__a, __b, __c);
9055 }
9056
9057 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
9058   __builtin_altivec_stvxl(__a, __b, __c);
9059 }
9060
9061 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9062                                    vector unsigned int *__c) {
9063   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9064 }
9065
9066 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9067                                    unsigned int *__c) {
9068   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9069 }
9070
9071 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
9072   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9073 }
9074
9075 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9076                                    unsigned int *__c) {
9077   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9078 }
9079
9080 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9081                                    vector bool int *__c) {
9082   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9083 }
9084
9085 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9086                                    vector float *__c) {
9087   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9088 }
9089
9090 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
9091   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9092 }
9093
9094 /* vec_sub */
9095
9096 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9097                                                vector signed char __b) {
9098   return __a - __b;
9099 }
9100
9101 static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
9102                                                vector signed char __b) {
9103   return (vector signed char)__a - __b;
9104 }
9105
9106 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9107                                                vector bool char __b) {
9108   return __a - (vector signed char)__b;
9109 }
9110
9111 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9112                                                  vector unsigned char __b) {
9113   return __a - __b;
9114 }
9115
9116 static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
9117                                                  vector unsigned char __b) {
9118   return (vector unsigned char)__a - __b;
9119 }
9120
9121 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9122                                                  vector bool char __b) {
9123   return __a - (vector unsigned char)__b;
9124 }
9125
9126 static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
9127   return __a - __b;
9128 }
9129
9130 static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
9131                                          vector short __b) {
9132   return (vector short)__a - __b;
9133 }
9134
9135 static vector short __ATTRS_o_ai vec_sub(vector short __a,
9136                                          vector bool short __b) {
9137   return __a - (vector short)__b;
9138 }
9139
9140 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9141                                                   vector unsigned short __b) {
9142   return __a - __b;
9143 }
9144
9145 static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
9146                                                   vector unsigned short __b) {
9147   return (vector unsigned short)__a - __b;
9148 }
9149
9150 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9151                                                   vector bool short __b) {
9152   return __a - (vector unsigned short)__b;
9153 }
9154
9155 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
9156   return __a - __b;
9157 }
9158
9159 static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
9160   return (vector int)__a - __b;
9161 }
9162
9163 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
9164   return __a - (vector int)__b;
9165 }
9166
9167 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9168                                                 vector unsigned int __b) {
9169   return __a - __b;
9170 }
9171
9172 static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
9173                                                 vector unsigned int __b) {
9174   return (vector unsigned int)__a - __b;
9175 }
9176
9177 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9178                                                 vector bool int __b) {
9179   return __a - (vector unsigned int)__b;
9180 }
9181
9182 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9183 static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
9184                                                    vector signed __int128 __b) {
9185   return __a - __b;
9186 }
9187
9188 static vector unsigned __int128 __ATTRS_o_ai
9189 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9190   return __a - __b;
9191 }
9192 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9193
9194 static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
9195   return __a - __b;
9196 }
9197
9198 #ifdef __VSX__
9199 static vector double __ATTRS_o_ai
9200 vec_sub(vector double __a, vector double __b) {
9201   return __a - __b;
9202 }
9203 #endif
9204
9205 /* vec_vsububm */
9206
9207 #define __builtin_altivec_vsububm vec_vsububm
9208
9209 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9210                                                    vector signed char __b) {
9211   return __a - __b;
9212 }
9213
9214 static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9215                                                    vector signed char __b) {
9216   return (vector signed char)__a - __b;
9217 }
9218
9219 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9220                                                    vector bool char __b) {
9221   return __a - (vector signed char)__b;
9222 }
9223
9224 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9225                                                      vector unsigned char __b) {
9226   return __a - __b;
9227 }
9228
9229 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9230                                                      vector unsigned char __b) {
9231   return (vector unsigned char)__a - __b;
9232 }
9233
9234 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9235                                                      vector bool char __b) {
9236   return __a - (vector unsigned char)__b;
9237 }
9238
9239 /* vec_vsubuhm */
9240
9241 #define __builtin_altivec_vsubuhm vec_vsubuhm
9242
9243 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9244                                              vector short __b) {
9245   return __a - __b;
9246 }
9247
9248 static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
9249                                              vector short __b) {
9250   return (vector short)__a - __b;
9251 }
9252
9253 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9254                                              vector bool short __b) {
9255   return __a - (vector short)__b;
9256 }
9257
9258 static vector unsigned short __ATTRS_o_ai
9259 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
9260   return __a - __b;
9261 }
9262
9263 static vector unsigned short __ATTRS_o_ai
9264 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
9265   return (vector unsigned short)__a - __b;
9266 }
9267
9268 static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
9269                                                       vector bool short __b) {
9270   return __a - (vector unsigned short)__b;
9271 }
9272
9273 /* vec_vsubuwm */
9274
9275 #define __builtin_altivec_vsubuwm vec_vsubuwm
9276
9277 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
9278   return __a - __b;
9279 }
9280
9281 static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9282                                            vector int __b) {
9283   return (vector int)__a - __b;
9284 }
9285
9286 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9287                                            vector bool int __b) {
9288   return __a - (vector int)__b;
9289 }
9290
9291 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9292                                                     vector unsigned int __b) {
9293   return __a - __b;
9294 }
9295
9296 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9297                                                     vector unsigned int __b) {
9298   return (vector unsigned int)__a - __b;
9299 }
9300
9301 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9302                                                     vector bool int __b) {
9303   return __a - (vector unsigned int)__b;
9304 }
9305
9306 /* vec_vsubfp */
9307
9308 #define __builtin_altivec_vsubfp vec_vsubfp
9309
9310 static vector float __attribute__((__always_inline__))
9311 vec_vsubfp(vector float __a, vector float __b) {
9312   return __a - __b;
9313 }
9314
9315 /* vec_subc */
9316
9317 static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
9318                                                  vector unsigned int __b) {
9319   return __builtin_altivec_vsubcuw(__a, __b);
9320 }
9321
9322 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9323 static vector unsigned __int128 __ATTRS_o_ai
9324 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9325   return __builtin_altivec_vsubcuq(__a, __b);
9326 }
9327
9328 static vector signed __int128 __ATTRS_o_ai
9329 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
9330   return __builtin_altivec_vsubcuq(__a, __b);
9331 }
9332 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9333
9334 /* vec_vsubcuw */
9335
9336 static vector unsigned int __attribute__((__always_inline__))
9337 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
9338   return __builtin_altivec_vsubcuw(__a, __b);
9339 }
9340
9341 /* vec_subs */
9342
9343 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9344                                                 vector signed char __b) {
9345   return __builtin_altivec_vsubsbs(__a, __b);
9346 }
9347
9348 static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
9349                                                 vector signed char __b) {
9350   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9351 }
9352
9353 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9354                                                 vector bool char __b) {
9355   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9356 }
9357
9358 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9359                                                   vector unsigned char __b) {
9360   return __builtin_altivec_vsububs(__a, __b);
9361 }
9362
9363 static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
9364                                                   vector unsigned char __b) {
9365   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9366 }
9367
9368 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9369                                                   vector bool char __b) {
9370   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9371 }
9372
9373 static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
9374   return __builtin_altivec_vsubshs(__a, __b);
9375 }
9376
9377 static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
9378                                           vector short __b) {
9379   return __builtin_altivec_vsubshs((vector short)__a, __b);
9380 }
9381
9382 static vector short __ATTRS_o_ai vec_subs(vector short __a,
9383                                           vector bool short __b) {
9384   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9385 }
9386
9387 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9388                                                    vector unsigned short __b) {
9389   return __builtin_altivec_vsubuhs(__a, __b);
9390 }
9391
9392 static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
9393                                                    vector unsigned short __b) {
9394   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9395 }
9396
9397 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9398                                                    vector bool short __b) {
9399   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9400 }
9401
9402 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
9403   return __builtin_altivec_vsubsws(__a, __b);
9404 }
9405
9406 static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
9407   return __builtin_altivec_vsubsws((vector int)__a, __b);
9408 }
9409
9410 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
9411   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9412 }
9413
9414 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9415                                                  vector unsigned int __b) {
9416   return __builtin_altivec_vsubuws(__a, __b);
9417 }
9418
9419 static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
9420                                                  vector unsigned int __b) {
9421   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9422 }
9423
9424 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9425                                                  vector bool int __b) {
9426   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9427 }
9428
9429 /* vec_vsubsbs */
9430
9431 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9432                                                    vector signed char __b) {
9433   return __builtin_altivec_vsubsbs(__a, __b);
9434 }
9435
9436 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
9437                                                    vector signed char __b) {
9438   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9439 }
9440
9441 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9442                                                    vector bool char __b) {
9443   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9444 }
9445
9446 /* vec_vsububs */
9447
9448 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9449                                                      vector unsigned char __b) {
9450   return __builtin_altivec_vsububs(__a, __b);
9451 }
9452
9453 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
9454                                                      vector unsigned char __b) {
9455   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9456 }
9457
9458 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9459                                                      vector bool char __b) {
9460   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9461 }
9462
9463 /* vec_vsubshs */
9464
9465 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9466                                              vector short __b) {
9467   return __builtin_altivec_vsubshs(__a, __b);
9468 }
9469
9470 static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
9471                                              vector short __b) {
9472   return __builtin_altivec_vsubshs((vector short)__a, __b);
9473 }
9474
9475 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9476                                              vector bool short __b) {
9477   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9478 }
9479
9480 /* vec_vsubuhs */
9481
9482 static vector unsigned short __ATTRS_o_ai
9483 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
9484   return __builtin_altivec_vsubuhs(__a, __b);
9485 }
9486
9487 static vector unsigned short __ATTRS_o_ai
9488 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
9489   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9490 }
9491
9492 static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
9493                                                       vector bool short __b) {
9494   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9495 }
9496
9497 /* vec_vsubsws */
9498
9499 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
9500   return __builtin_altivec_vsubsws(__a, __b);
9501 }
9502
9503 static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
9504                                            vector int __b) {
9505   return __builtin_altivec_vsubsws((vector int)__a, __b);
9506 }
9507
9508 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9509                                            vector bool int __b) {
9510   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9511 }
9512
9513 /* vec_vsubuws */
9514
9515 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9516                                                     vector unsigned int __b) {
9517   return __builtin_altivec_vsubuws(__a, __b);
9518 }
9519
9520 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
9521                                                     vector unsigned int __b) {
9522   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9523 }
9524
9525 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9526                                                     vector bool int __b) {
9527   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9528 }
9529
9530 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9531 /* vec_vsubuqm */
9532
9533 static vector signed __int128 __ATTRS_o_ai
9534 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
9535   return __a - __b;
9536 }
9537
9538 static vector unsigned __int128 __ATTRS_o_ai
9539 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9540   return __a - __b;
9541 }
9542
9543 /* vec_vsubeuqm */
9544
9545 static vector signed __int128 __ATTRS_o_ai
9546 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9547              vector signed __int128 __c) {
9548   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9549 }
9550
9551 static vector unsigned __int128 __ATTRS_o_ai
9552 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9553              vector unsigned __int128 __c) {
9554   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9555 }
9556
9557 /* vec_vsubcuq */
9558
9559 static vector signed __int128 __ATTRS_o_ai
9560 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
9561   return __builtin_altivec_vsubcuq(__a, __b);
9562 }
9563
9564 static vector unsigned __int128 __ATTRS_o_ai
9565 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9566   return __builtin_altivec_vsubcuq(__a, __b);
9567 }
9568
9569 /* vec_vsubecuq */
9570
9571 static vector signed __int128 __ATTRS_o_ai
9572 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9573              vector signed __int128 __c) {
9574   return __builtin_altivec_vsubecuq(__a, __b, __c);
9575 }
9576
9577 static vector unsigned __int128 __ATTRS_o_ai
9578 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9579              vector unsigned __int128 __c) {
9580   return __builtin_altivec_vsubecuq(__a, __b, __c);
9581 }
9582 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9583
9584 /* vec_sum4s */
9585
9586 static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
9587                                          vector int __b) {
9588   return __builtin_altivec_vsum4sbs(__a, __b);
9589 }
9590
9591 static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
9592                                                   vector unsigned int __b) {
9593   return __builtin_altivec_vsum4ubs(__a, __b);
9594 }
9595
9596 static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
9597                                          vector int __b) {
9598   return __builtin_altivec_vsum4shs(__a, __b);
9599 }
9600
9601 /* vec_vsum4sbs */
9602
9603 static vector int __attribute__((__always_inline__))
9604 vec_vsum4sbs(vector signed char __a, vector int __b) {
9605   return __builtin_altivec_vsum4sbs(__a, __b);
9606 }
9607
9608 /* vec_vsum4ubs */
9609
9610 static vector unsigned int __attribute__((__always_inline__))
9611 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
9612   return __builtin_altivec_vsum4ubs(__a, __b);
9613 }
9614
9615 /* vec_vsum4shs */
9616
9617 static vector int __attribute__((__always_inline__))
9618 vec_vsum4shs(vector signed short __a, vector int __b) {
9619   return __builtin_altivec_vsum4shs(__a, __b);
9620 }
9621
9622 /* vec_sum2s */
9623
9624 /* The vsum2sws instruction has a big-endian bias, so that the second
9625    input vector and the result always reference big-endian elements
9626    1 and 3 (little-endian element 0 and 2).  For ease of porting the
9627    programmer wants elements 1 and 3 in both cases, so for little
9628    endian we must perform some permutes.  */
9629
9630 static vector signed int __attribute__((__always_inline__))
9631 vec_sum2s(vector int __a, vector int __b) {
9632 #ifdef __LITTLE_ENDIAN__
9633   vector int __c = (vector signed int)vec_perm(
9634       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9635                                        8, 9, 10, 11));
9636   __c = __builtin_altivec_vsum2sws(__a, __c);
9637   return (vector signed int)vec_perm(
9638       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9639                                        8, 9, 10, 11));
9640 #else
9641   return __builtin_altivec_vsum2sws(__a, __b);
9642 #endif
9643 }
9644
9645 /* vec_vsum2sws */
9646
9647 static vector signed int __attribute__((__always_inline__))
9648 vec_vsum2sws(vector int __a, vector int __b) {
9649 #ifdef __LITTLE_ENDIAN__
9650   vector int __c = (vector signed int)vec_perm(
9651       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9652                                        8, 9, 10, 11));
9653   __c = __builtin_altivec_vsum2sws(__a, __c);
9654   return (vector signed int)vec_perm(
9655       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9656                                        8, 9, 10, 11));
9657 #else
9658   return __builtin_altivec_vsum2sws(__a, __b);
9659 #endif
9660 }
9661
9662 /* vec_sums */
9663
9664 /* The vsumsws instruction has a big-endian bias, so that the second
9665    input vector and the result always reference big-endian element 3
9666    (little-endian element 0).  For ease of porting the programmer
9667    wants element 3 in both cases, so for little endian we must perform
9668    some permutes.  */
9669
9670 static vector signed int __attribute__((__always_inline__))
9671 vec_sums(vector signed int __a, vector signed int __b) {
9672 #ifdef __LITTLE_ENDIAN__
9673   __b = (vector signed int)vec_splat(__b, 3);
9674   __b = __builtin_altivec_vsumsws(__a, __b);
9675   return (vector signed int)(0, 0, 0, __b[0]);
9676 #else
9677   return __builtin_altivec_vsumsws(__a, __b);
9678 #endif
9679 }
9680
9681 /* vec_vsumsws */
9682
9683 static vector signed int __attribute__((__always_inline__))
9684 vec_vsumsws(vector signed int __a, vector signed int __b) {
9685 #ifdef __LITTLE_ENDIAN__
9686   __b = (vector signed int)vec_splat(__b, 3);
9687   __b = __builtin_altivec_vsumsws(__a, __b);
9688   return (vector signed int)(0, 0, 0, __b[0]);
9689 #else
9690   return __builtin_altivec_vsumsws(__a, __b);
9691 #endif
9692 }
9693
9694 /* vec_trunc */
9695
9696 static vector float __ATTRS_o_ai
9697 vec_trunc(vector float __a) {
9698 #ifdef __VSX__
9699   return __builtin_vsx_xvrspiz(__a);
9700 #else
9701   return __builtin_altivec_vrfiz(__a);
9702 #endif
9703 }
9704
9705 #ifdef __VSX__
9706 static vector double __ATTRS_o_ai vec_trunc(vector double __a) {
9707   return __builtin_vsx_xvrdpiz(__a);
9708 }
9709 #endif
9710
9711 /* vec_vrfiz */
9712
9713 static vector float __attribute__((__always_inline__))
9714 vec_vrfiz(vector float __a) {
9715   return __builtin_altivec_vrfiz(__a);
9716 }
9717
9718 /* vec_unpackh */
9719
9720 /* The vector unpack instructions all have a big-endian bias, so for
9721    little endian we must reverse the meanings of "high" and "low."  */
9722
9723 static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
9724 #ifdef __LITTLE_ENDIAN__
9725   return __builtin_altivec_vupklsb((vector char)__a);
9726 #else
9727   return __builtin_altivec_vupkhsb((vector char)__a);
9728 #endif
9729 }
9730
9731 static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
9732 #ifdef __LITTLE_ENDIAN__
9733   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9734 #else
9735   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9736 #endif
9737 }
9738
9739 static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
9740 #ifdef __LITTLE_ENDIAN__
9741   return __builtin_altivec_vupklsh(__a);
9742 #else
9743   return __builtin_altivec_vupkhsh(__a);
9744 #endif
9745 }
9746
9747 static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
9748 #ifdef __LITTLE_ENDIAN__
9749   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9750 #else
9751   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9752 #endif
9753 }
9754
9755 static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
9756 #ifdef __LITTLE_ENDIAN__
9757   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9758 #else
9759   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9760 #endif
9761 }
9762
9763 #ifdef __POWER8_VECTOR__
9764 static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
9765 #ifdef __LITTLE_ENDIAN__
9766   return __builtin_altivec_vupklsw(__a);
9767 #else
9768   return __builtin_altivec_vupkhsw(__a);
9769 #endif
9770 }
9771
9772 static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
9773 #ifdef __LITTLE_ENDIAN__
9774   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9775 #else
9776   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9777 #endif
9778 }
9779 #endif
9780
9781 /* vec_vupkhsb */
9782
9783 static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
9784 #ifdef __LITTLE_ENDIAN__
9785   return __builtin_altivec_vupklsb((vector char)__a);
9786 #else
9787   return __builtin_altivec_vupkhsb((vector char)__a);
9788 #endif
9789 }
9790
9791 static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
9792 #ifdef __LITTLE_ENDIAN__
9793   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9794 #else
9795   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9796 #endif
9797 }
9798
9799 /* vec_vupkhsh */
9800
9801 static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
9802 #ifdef __LITTLE_ENDIAN__
9803   return __builtin_altivec_vupklsh(__a);
9804 #else
9805   return __builtin_altivec_vupkhsh(__a);
9806 #endif
9807 }
9808
9809 static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
9810 #ifdef __LITTLE_ENDIAN__
9811   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9812 #else
9813   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9814 #endif
9815 }
9816
9817 static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
9818 #ifdef __LITTLE_ENDIAN__
9819   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9820 #else
9821   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9822 #endif
9823 }
9824
9825 /* vec_vupkhsw */
9826
9827 #ifdef __POWER8_VECTOR__
9828 static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
9829 #ifdef __LITTLE_ENDIAN__
9830   return __builtin_altivec_vupklsw(__a);
9831 #else
9832   return __builtin_altivec_vupkhsw(__a);
9833 #endif
9834 }
9835
9836 static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
9837 #ifdef __LITTLE_ENDIAN__
9838   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9839 #else
9840   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9841 #endif
9842 }
9843 #endif
9844
9845 /* vec_unpackl */
9846
9847 static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
9848 #ifdef __LITTLE_ENDIAN__
9849   return __builtin_altivec_vupkhsb((vector char)__a);
9850 #else
9851   return __builtin_altivec_vupklsb((vector char)__a);
9852 #endif
9853 }
9854
9855 static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
9856 #ifdef __LITTLE_ENDIAN__
9857   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9858 #else
9859   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9860 #endif
9861 }
9862
9863 static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
9864 #ifdef __LITTLE_ENDIAN__
9865   return __builtin_altivec_vupkhsh(__a);
9866 #else
9867   return __builtin_altivec_vupklsh(__a);
9868 #endif
9869 }
9870
9871 static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
9872 #ifdef __LITTLE_ENDIAN__
9873   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9874 #else
9875   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9876 #endif
9877 }
9878
9879 static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
9880 #ifdef __LITTLE_ENDIAN__
9881   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9882 #else
9883   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9884 #endif
9885 }
9886
9887 #ifdef __POWER8_VECTOR__
9888 static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
9889 #ifdef __LITTLE_ENDIAN__
9890   return __builtin_altivec_vupkhsw(__a);
9891 #else
9892   return __builtin_altivec_vupklsw(__a);
9893 #endif
9894 }
9895
9896 static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
9897 #ifdef __LITTLE_ENDIAN__
9898   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9899 #else
9900   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9901 #endif
9902 }
9903 #endif
9904
9905 /* vec_vupklsb */
9906
9907 static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
9908 #ifdef __LITTLE_ENDIAN__
9909   return __builtin_altivec_vupkhsb((vector char)__a);
9910 #else
9911   return __builtin_altivec_vupklsb((vector char)__a);
9912 #endif
9913 }
9914
9915 static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
9916 #ifdef __LITTLE_ENDIAN__
9917   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9918 #else
9919   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9920 #endif
9921 }
9922
9923 /* vec_vupklsh */
9924
9925 static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
9926 #ifdef __LITTLE_ENDIAN__
9927   return __builtin_altivec_vupkhsh(__a);
9928 #else
9929   return __builtin_altivec_vupklsh(__a);
9930 #endif
9931 }
9932
9933 static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
9934 #ifdef __LITTLE_ENDIAN__
9935   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9936 #else
9937   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9938 #endif
9939 }
9940
9941 static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
9942 #ifdef __LITTLE_ENDIAN__
9943   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9944 #else
9945   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9946 #endif
9947 }
9948
9949 /* vec_vupklsw */
9950
9951 #ifdef __POWER8_VECTOR__
9952 static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
9953 #ifdef __LITTLE_ENDIAN__
9954   return __builtin_altivec_vupkhsw(__a);
9955 #else
9956   return __builtin_altivec_vupklsw(__a);
9957 #endif
9958 }
9959
9960 static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
9961 #ifdef __LITTLE_ENDIAN__
9962   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9963 #else
9964   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9965 #endif
9966 }
9967 #endif
9968
9969 /* vec_vsx_ld */
9970
9971 #ifdef __VSX__
9972
9973 static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
9974                                                  const vector signed int *__b) {
9975   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
9976 }
9977
9978 static vector unsigned int __ATTRS_o_ai
9979 vec_vsx_ld(int __a, const vector unsigned int *__b) {
9980   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
9981 }
9982
9983 static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
9984   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
9985 }
9986
9987 static vector signed long long __ATTRS_o_ai
9988 vec_vsx_ld(int __a, const vector signed long long *__b) {
9989   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
9990 }
9991
9992 static vector unsigned long long __ATTRS_o_ai
9993 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
9994   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
9995 }
9996
9997 static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
9998                                              const vector double *__b) {
9999   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10000 }
10001
10002 #endif
10003
10004 /* vec_vsx_st */
10005
10006 #ifdef __VSX__
10007
10008 static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10009                                     vector signed int *__c) {
10010   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10011 }
10012
10013 static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10014                                     vector unsigned int *__c) {
10015   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10016 }
10017
10018 static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10019                                     vector float *__c) {
10020   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10021 }
10022
10023 static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
10024                                     vector signed long long *__c) {
10025   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10026 }
10027
10028 static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
10029                                     vector unsigned long long *__c) {
10030   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10031 }
10032
10033 static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10034                                     vector double *__c) {
10035   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10036 }
10037
10038 #endif
10039
10040 /* vec_xor */
10041
10042 #define __builtin_altivec_vxor vec_xor
10043
10044 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10045                                                vector signed char __b) {
10046   return __a ^ __b;
10047 }
10048
10049 static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
10050                                                vector signed char __b) {
10051   return (vector signed char)__a ^ __b;
10052 }
10053
10054 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10055                                                vector bool char __b) {
10056   return __a ^ (vector signed char)__b;
10057 }
10058
10059 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10060                                                  vector unsigned char __b) {
10061   return __a ^ __b;
10062 }
10063
10064 static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
10065                                                  vector unsigned char __b) {
10066   return (vector unsigned char)__a ^ __b;
10067 }
10068
10069 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10070                                                  vector bool char __b) {
10071   return __a ^ (vector unsigned char)__b;
10072 }
10073
10074 static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
10075                                              vector bool char __b) {
10076   return __a ^ __b;
10077 }
10078
10079 static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
10080   return __a ^ __b;
10081 }
10082
10083 static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
10084                                          vector short __b) {
10085   return (vector short)__a ^ __b;
10086 }
10087
10088 static vector short __ATTRS_o_ai vec_xor(vector short __a,
10089                                          vector bool short __b) {
10090   return __a ^ (vector short)__b;
10091 }
10092
10093 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10094                                                   vector unsigned short __b) {
10095   return __a ^ __b;
10096 }
10097
10098 static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
10099                                                   vector unsigned short __b) {
10100   return (vector unsigned short)__a ^ __b;
10101 }
10102
10103 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10104                                                   vector bool short __b) {
10105   return __a ^ (vector unsigned short)__b;
10106 }
10107
10108 static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
10109                                               vector bool short __b) {
10110   return __a ^ __b;
10111 }
10112
10113 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
10114   return __a ^ __b;
10115 }
10116
10117 static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
10118   return (vector int)__a ^ __b;
10119 }
10120
10121 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
10122   return __a ^ (vector int)__b;
10123 }
10124
10125 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10126                                                 vector unsigned int __b) {
10127   return __a ^ __b;
10128 }
10129
10130 static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
10131                                                 vector unsigned int __b) {
10132   return (vector unsigned int)__a ^ __b;
10133 }
10134
10135 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10136                                                 vector bool int __b) {
10137   return __a ^ (vector unsigned int)__b;
10138 }
10139
10140 static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
10141                                             vector bool int __b) {
10142   return __a ^ __b;
10143 }
10144
10145 static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
10146   vector unsigned int __res =
10147       (vector unsigned int)__a ^ (vector unsigned int)__b;
10148   return (vector float)__res;
10149 }
10150
10151 static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
10152                                          vector float __b) {
10153   vector unsigned int __res =
10154       (vector unsigned int)__a ^ (vector unsigned int)__b;
10155   return (vector float)__res;
10156 }
10157
10158 static vector float __ATTRS_o_ai vec_xor(vector float __a,
10159                                          vector bool int __b) {
10160   vector unsigned int __res =
10161       (vector unsigned int)__a ^ (vector unsigned int)__b;
10162   return (vector float)__res;
10163 }
10164
10165 #ifdef __VSX__
10166 static vector signed long long __ATTRS_o_ai
10167 vec_xor(vector signed long long __a, vector signed long long __b) {
10168   return __a ^ __b;
10169 }
10170
10171 static vector signed long long __ATTRS_o_ai
10172 vec_xor(vector bool long long __a, vector signed long long __b) {
10173   return (vector signed long long)__a ^ __b;
10174 }
10175
10176 static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
10177                                                     vector bool long long __b) {
10178   return __a ^ (vector signed long long)__b;
10179 }
10180
10181 static vector unsigned long long __ATTRS_o_ai
10182 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
10183   return __a ^ __b;
10184 }
10185
10186 static vector unsigned long long __ATTRS_o_ai
10187 vec_xor(vector bool long long __a, vector unsigned long long __b) {
10188   return (vector unsigned long long)__a ^ __b;
10189 }
10190
10191 static vector unsigned long long __ATTRS_o_ai
10192 vec_xor(vector unsigned long long __a, vector bool long long __b) {
10193   return __a ^ (vector unsigned long long)__b;
10194 }
10195
10196 static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
10197                                                   vector bool long long __b) {
10198   return __a ^ __b;
10199 }
10200
10201 static vector double __ATTRS_o_ai
10202 vec_xor(vector double __a, vector double __b) {
10203   return (vector double)((vector unsigned long long)__a ^
10204                           (vector unsigned long long)__b);
10205 }
10206
10207 static vector double __ATTRS_o_ai
10208 vec_xor(vector double __a, vector bool long long __b) {
10209   return (vector double)((vector unsigned long long)__a ^
10210                          (vector unsigned long long) __b);
10211 }
10212
10213 static vector double __ATTRS_o_ai
10214 vec_xor(vector bool long long __a, vector double __b) {
10215   return (vector double)((vector unsigned long long)__a ^
10216                          (vector unsigned long long)__b);
10217 }
10218 #endif
10219
10220 /* vec_vxor */
10221
10222 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10223                                                 vector signed char __b) {
10224   return __a ^ __b;
10225 }
10226
10227 static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
10228                                                 vector signed char __b) {
10229   return (vector signed char)__a ^ __b;
10230 }
10231
10232 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10233                                                 vector bool char __b) {
10234   return __a ^ (vector signed char)__b;
10235 }
10236
10237 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10238                                                   vector unsigned char __b) {
10239   return __a ^ __b;
10240 }
10241
10242 static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
10243                                                   vector unsigned char __b) {
10244   return (vector unsigned char)__a ^ __b;
10245 }
10246
10247 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10248                                                   vector bool char __b) {
10249   return __a ^ (vector unsigned char)__b;
10250 }
10251
10252 static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
10253                                               vector bool char __b) {
10254   return __a ^ __b;
10255 }
10256
10257 static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
10258   return __a ^ __b;
10259 }
10260
10261 static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
10262                                           vector short __b) {
10263   return (vector short)__a ^ __b;
10264 }
10265
10266 static vector short __ATTRS_o_ai vec_vxor(vector short __a,
10267                                           vector bool short __b) {
10268   return __a ^ (vector short)__b;
10269 }
10270
10271 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10272                                                    vector unsigned short __b) {
10273   return __a ^ __b;
10274 }
10275
10276 static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
10277                                                    vector unsigned short __b) {
10278   return (vector unsigned short)__a ^ __b;
10279 }
10280
10281 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10282                                                    vector bool short __b) {
10283   return __a ^ (vector unsigned short)__b;
10284 }
10285
10286 static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
10287                                                vector bool short __b) {
10288   return __a ^ __b;
10289 }
10290
10291 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
10292   return __a ^ __b;
10293 }
10294
10295 static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
10296   return (vector int)__a ^ __b;
10297 }
10298
10299 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
10300   return __a ^ (vector int)__b;
10301 }
10302
10303 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10304                                                  vector unsigned int __b) {
10305   return __a ^ __b;
10306 }
10307
10308 static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
10309                                                  vector unsigned int __b) {
10310   return (vector unsigned int)__a ^ __b;
10311 }
10312
10313 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10314                                                  vector bool int __b) {
10315   return __a ^ (vector unsigned int)__b;
10316 }
10317
10318 static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
10319                                              vector bool int __b) {
10320   return __a ^ __b;
10321 }
10322
10323 static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
10324   vector unsigned int __res =
10325       (vector unsigned int)__a ^ (vector unsigned int)__b;
10326   return (vector float)__res;
10327 }
10328
10329 static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
10330                                           vector float __b) {
10331   vector unsigned int __res =
10332       (vector unsigned int)__a ^ (vector unsigned int)__b;
10333   return (vector float)__res;
10334 }
10335
10336 static vector float __ATTRS_o_ai vec_vxor(vector float __a,
10337                                           vector bool int __b) {
10338   vector unsigned int __res =
10339       (vector unsigned int)__a ^ (vector unsigned int)__b;
10340   return (vector float)__res;
10341 }
10342
10343 #ifdef __VSX__
10344 static vector signed long long __ATTRS_o_ai
10345 vec_vxor(vector signed long long __a, vector signed long long __b) {
10346   return __a ^ __b;
10347 }
10348
10349 static vector signed long long __ATTRS_o_ai
10350 vec_vxor(vector bool long long __a, vector signed long long __b) {
10351   return (vector signed long long)__a ^ __b;
10352 }
10353
10354 static vector signed long long __ATTRS_o_ai
10355 vec_vxor(vector signed long long __a, vector bool long long __b) {
10356   return __a ^ (vector signed long long)__b;
10357 }
10358
10359 static vector unsigned long long __ATTRS_o_ai
10360 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
10361   return __a ^ __b;
10362 }
10363
10364 static vector unsigned long long __ATTRS_o_ai
10365 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
10366   return (vector unsigned long long)__a ^ __b;
10367 }
10368
10369 static vector unsigned long long __ATTRS_o_ai
10370 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
10371   return __a ^ (vector unsigned long long)__b;
10372 }
10373
10374 static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
10375                                                    vector bool long long __b) {
10376   return __a ^ __b;
10377 }
10378 #endif
10379
10380 /* ------------------------ extensions for CBEA ----------------------------- */
10381
10382 /* vec_extract */
10383
10384 static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
10385   return __a[__b];
10386 }
10387
10388 static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
10389                                               int __b) {
10390   return __a[__b];
10391 }
10392
10393 static short __ATTRS_o_ai vec_extract(vector short __a, int __b) {
10394   return __a[__b];
10395 }
10396
10397 static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
10398                                                int __b) {
10399   return __a[__b];
10400 }
10401
10402 static int __ATTRS_o_ai vec_extract(vector int __a, int __b) {
10403   return __a[__b];
10404 }
10405
10406 static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
10407   return __a[__b];
10408 }
10409
10410 static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
10411   return __a[__b];
10412 }
10413
10414 /* vec_insert */
10415
10416 static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
10417                                                   vector signed char __b,
10418                                                   int __c) {
10419   __b[__c] = __a;
10420   return __b;
10421 }
10422
10423 static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
10424                                                     vector unsigned char __b,
10425                                                     int __c) {
10426   __b[__c] = __a;
10427   return __b;
10428 }
10429
10430 static vector short __ATTRS_o_ai vec_insert(short __a, vector short __b,
10431                                             int __c) {
10432   __b[__c] = __a;
10433   return __b;
10434 }
10435
10436 static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
10437                                                      vector unsigned short __b,
10438                                                      int __c) {
10439   __b[__c] = __a;
10440   return __b;
10441 }
10442
10443 static vector int __ATTRS_o_ai vec_insert(int __a, vector int __b, int __c) {
10444   __b[__c] = __a;
10445   return __b;
10446 }
10447
10448 static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
10449                                                    vector unsigned int __b,
10450                                                    int __c) {
10451   __b[__c] = __a;
10452   return __b;
10453 }
10454
10455 static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
10456                                             int __c) {
10457   __b[__c] = __a;
10458   return __b;
10459 }
10460
10461 /* vec_lvlx */
10462
10463 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10464                                                 const signed char *__b) {
10465   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10466                   vec_lvsl(__a, __b));
10467 }
10468
10469 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10470                                                 const vector signed char *__b) {
10471   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10472                   vec_lvsl(__a, (unsigned char *)__b));
10473 }
10474
10475 static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
10476                                                   const unsigned char *__b) {
10477   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10478                   vec_lvsl(__a, __b));
10479 }
10480
10481 static vector unsigned char __ATTRS_o_ai
10482 vec_lvlx(int __a, const vector unsigned char *__b) {
10483   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10484                   vec_lvsl(__a, (unsigned char *)__b));
10485 }
10486
10487 static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
10488                                               const vector bool char *__b) {
10489   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
10490                   vec_lvsl(__a, (unsigned char *)__b));
10491 }
10492
10493 static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
10494   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10495 }
10496
10497 static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
10498   return vec_perm(vec_ld(__a, __b), (vector short)(0),
10499                   vec_lvsl(__a, (unsigned char *)__b));
10500 }
10501
10502 static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
10503                                                    const unsigned short *__b) {
10504   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10505                   vec_lvsl(__a, __b));
10506 }
10507
10508 static vector unsigned short __ATTRS_o_ai
10509 vec_lvlx(int __a, const vector unsigned short *__b) {
10510   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10511                   vec_lvsl(__a, (unsigned char *)__b));
10512 }
10513
10514 static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
10515                                                const vector bool short *__b) {
10516   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
10517                   vec_lvsl(__a, (unsigned char *)__b));
10518 }
10519
10520 static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
10521   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
10522                   vec_lvsl(__a, (unsigned char *)__b));
10523 }
10524
10525 static vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
10526   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10527 }
10528
10529 static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
10530   return vec_perm(vec_ld(__a, __b), (vector int)(0),
10531                   vec_lvsl(__a, (unsigned char *)__b));
10532 }
10533
10534 static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
10535                                                  const unsigned int *__b) {
10536   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10537                   vec_lvsl(__a, __b));
10538 }
10539
10540 static vector unsigned int __ATTRS_o_ai
10541 vec_lvlx(int __a, const vector unsigned int *__b) {
10542   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10543                   vec_lvsl(__a, (unsigned char *)__b));
10544 }
10545
10546 static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
10547                                              const vector bool int *__b) {
10548   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
10549                   vec_lvsl(__a, (unsigned char *)__b));
10550 }
10551
10552 static vector float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
10553   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10554 }
10555
10556 static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
10557   return vec_perm(vec_ld(__a, __b), (vector float)(0),
10558                   vec_lvsl(__a, (unsigned char *)__b));
10559 }
10560
10561 /* vec_lvlxl */
10562
10563 static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
10564                                                  const signed char *__b) {
10565   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10566                   vec_lvsl(__a, __b));
10567 }
10568
10569 static vector signed char __ATTRS_o_ai
10570 vec_lvlxl(int __a, const vector signed char *__b) {
10571   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10572                   vec_lvsl(__a, (unsigned char *)__b));
10573 }
10574
10575 static vector unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
10576                                                    const unsigned char *__b) {
10577   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10578                   vec_lvsl(__a, __b));
10579 }
10580
10581 static vector unsigned char __ATTRS_o_ai
10582 vec_lvlxl(int __a, const vector unsigned char *__b) {
10583   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10584                   vec_lvsl(__a, (unsigned char *)__b));
10585 }
10586
10587 static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
10588                                                const vector bool char *__b) {
10589   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
10590                   vec_lvsl(__a, (unsigned char *)__b));
10591 }
10592
10593 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
10594   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10595 }
10596
10597 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
10598   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
10599                   vec_lvsl(__a, (unsigned char *)__b));
10600 }
10601
10602 static vector unsigned short __ATTRS_o_ai vec_lvlxl(int __a,
10603                                                     const unsigned short *__b) {
10604   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10605                   vec_lvsl(__a, __b));
10606 }
10607
10608 static vector unsigned short __ATTRS_o_ai
10609 vec_lvlxl(int __a, const vector unsigned short *__b) {
10610   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10611                   vec_lvsl(__a, (unsigned char *)__b));
10612 }
10613
10614 static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
10615                                                 const vector bool short *__b) {
10616   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
10617                   vec_lvsl(__a, (unsigned char *)__b));
10618 }
10619
10620 static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
10621   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
10622                   vec_lvsl(__a, (unsigned char *)__b));
10623 }
10624
10625 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
10626   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10627 }
10628
10629 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
10630   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
10631                   vec_lvsl(__a, (unsigned char *)__b));
10632 }
10633
10634 static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
10635                                                   const unsigned int *__b) {
10636   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10637                   vec_lvsl(__a, __b));
10638 }
10639
10640 static vector unsigned int __ATTRS_o_ai
10641 vec_lvlxl(int __a, const vector unsigned int *__b) {
10642   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10643                   vec_lvsl(__a, (unsigned char *)__b));
10644 }
10645
10646 static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
10647                                               const vector bool int *__b) {
10648   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
10649                   vec_lvsl(__a, (unsigned char *)__b));
10650 }
10651
10652 static vector float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
10653   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10654 }
10655
10656 static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
10657   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
10658                   vec_lvsl(__a, (unsigned char *)__b));
10659 }
10660
10661 /* vec_lvrx */
10662
10663 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10664                                                 const signed char *__b) {
10665   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10666                   vec_lvsl(__a, __b));
10667 }
10668
10669 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10670                                                 const vector signed char *__b) {
10671   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10672                   vec_lvsl(__a, (unsigned char *)__b));
10673 }
10674
10675 static vector unsigned char __ATTRS_o_ai vec_lvrx(int __a,
10676                                                   const unsigned char *__b) {
10677   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10678                   vec_lvsl(__a, __b));
10679 }
10680
10681 static vector unsigned char __ATTRS_o_ai
10682 vec_lvrx(int __a, const vector unsigned char *__b) {
10683   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10684                   vec_lvsl(__a, (unsigned char *)__b));
10685 }
10686
10687 static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
10688                                               const vector bool char *__b) {
10689   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
10690                   vec_lvsl(__a, (unsigned char *)__b));
10691 }
10692
10693 static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
10694   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10695 }
10696
10697 static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
10698   return vec_perm((vector short)(0), vec_ld(__a, __b),
10699                   vec_lvsl(__a, (unsigned char *)__b));
10700 }
10701
10702 static vector unsigned short __ATTRS_o_ai vec_lvrx(int __a,
10703                                                    const unsigned short *__b) {
10704   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10705                   vec_lvsl(__a, __b));
10706 }
10707
10708 static vector unsigned short __ATTRS_o_ai
10709 vec_lvrx(int __a, const vector unsigned short *__b) {
10710   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10711                   vec_lvsl(__a, (unsigned char *)__b));
10712 }
10713
10714 static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
10715                                                const vector bool short *__b) {
10716   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
10717                   vec_lvsl(__a, (unsigned char *)__b));
10718 }
10719
10720 static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
10721   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
10722                   vec_lvsl(__a, (unsigned char *)__b));
10723 }
10724
10725 static vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
10726   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10727 }
10728
10729 static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
10730   return vec_perm((vector int)(0), vec_ld(__a, __b),
10731                   vec_lvsl(__a, (unsigned char *)__b));
10732 }
10733
10734 static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
10735                                                  const unsigned int *__b) {
10736   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10737                   vec_lvsl(__a, __b));
10738 }
10739
10740 static vector unsigned int __ATTRS_o_ai
10741 vec_lvrx(int __a, const vector unsigned int *__b) {
10742   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10743                   vec_lvsl(__a, (unsigned char *)__b));
10744 }
10745
10746 static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
10747                                              const vector bool int *__b) {
10748   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
10749                   vec_lvsl(__a, (unsigned char *)__b));
10750 }
10751
10752 static vector float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
10753   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10754 }
10755
10756 static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
10757   return vec_perm((vector float)(0), vec_ld(__a, __b),
10758                   vec_lvsl(__a, (unsigned char *)__b));
10759 }
10760
10761 /* vec_lvrxl */
10762
10763 static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
10764                                                  const signed char *__b) {
10765   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10766                   vec_lvsl(__a, __b));
10767 }
10768
10769 static vector signed char __ATTRS_o_ai
10770 vec_lvrxl(int __a, const vector signed char *__b) {
10771   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10772                   vec_lvsl(__a, (unsigned char *)__b));
10773 }
10774
10775 static vector unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
10776                                                    const unsigned char *__b) {
10777   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
10778                   vec_lvsl(__a, __b));
10779 }
10780
10781 static vector unsigned char __ATTRS_o_ai
10782 vec_lvrxl(int __a, const vector unsigned char *__b) {
10783   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
10784                   vec_lvsl(__a, (unsigned char *)__b));
10785 }
10786
10787 static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
10788                                                const vector bool char *__b) {
10789   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
10790                   vec_lvsl(__a, (unsigned char *)__b));
10791 }
10792
10793 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
10794   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
10795 }
10796
10797 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
10798   return vec_perm((vector short)(0), vec_ldl(__a, __b),
10799                   vec_lvsl(__a, (unsigned char *)__b));
10800 }
10801
10802 static vector unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
10803                                                     const unsigned short *__b) {
10804   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
10805                   vec_lvsl(__a, __b));
10806 }
10807
10808 static vector unsigned short __ATTRS_o_ai
10809 vec_lvrxl(int __a, const vector unsigned short *__b) {
10810   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
10811                   vec_lvsl(__a, (unsigned char *)__b));
10812 }
10813
10814 static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
10815                                                 const vector bool short *__b) {
10816   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
10817                   vec_lvsl(__a, (unsigned char *)__b));
10818 }
10819
10820 static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
10821   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
10822                   vec_lvsl(__a, (unsigned char *)__b));
10823 }
10824
10825 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
10826   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
10827 }
10828
10829 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
10830   return vec_perm((vector int)(0), vec_ldl(__a, __b),
10831                   vec_lvsl(__a, (unsigned char *)__b));
10832 }
10833
10834 static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
10835                                                   const unsigned int *__b) {
10836   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
10837                   vec_lvsl(__a, __b));
10838 }
10839
10840 static vector unsigned int __ATTRS_o_ai
10841 vec_lvrxl(int __a, const vector unsigned int *__b) {
10842   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
10843                   vec_lvsl(__a, (unsigned char *)__b));
10844 }
10845
10846 static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
10847                                               const vector bool int *__b) {
10848   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
10849                   vec_lvsl(__a, (unsigned char *)__b));
10850 }
10851
10852 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
10853   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
10854 }
10855
10856 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
10857   return vec_perm((vector float)(0), vec_ldl(__a, __b),
10858                   vec_lvsl(__a, (unsigned char *)__b));
10859 }
10860
10861 /* vec_stvlx */
10862
10863 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
10864                                    signed char *__c) {
10865   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10866                 __c);
10867 }
10868
10869 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
10870                                    vector signed char *__c) {
10871   return vec_st(
10872       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10873       __b, __c);
10874 }
10875
10876 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
10877                                    unsigned char *__c) {
10878   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10879                 __c);
10880 }
10881
10882 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
10883                                    vector unsigned char *__c) {
10884   return vec_st(
10885       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10886       __b, __c);
10887 }
10888
10889 static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
10890                                    vector bool char *__c) {
10891   return vec_st(
10892       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10893       __b, __c);
10894 }
10895
10896 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
10897   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10898                 __c);
10899 }
10900
10901 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
10902                                    vector short *__c) {
10903   return vec_st(
10904       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10905       __b, __c);
10906 }
10907
10908 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
10909                                    unsigned short *__c) {
10910   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10911                 __c);
10912 }
10913
10914 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
10915                                    vector unsigned short *__c) {
10916   return vec_st(
10917       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10918       __b, __c);
10919 }
10920
10921 static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
10922                                    vector bool short *__c) {
10923   return vec_st(
10924       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10925       __b, __c);
10926 }
10927
10928 static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
10929                                    vector pixel *__c) {
10930   return vec_st(
10931       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10932       __b, __c);
10933 }
10934
10935 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
10936   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10937                 __c);
10938 }
10939
10940 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__c) {
10941   return vec_st(
10942       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10943       __b, __c);
10944 }
10945
10946 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
10947                                    unsigned int *__c) {
10948   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10949                 __c);
10950 }
10951
10952 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
10953                                    vector unsigned int *__c) {
10954   return vec_st(
10955       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10956       __b, __c);
10957 }
10958
10959 static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
10960                                    vector bool int *__c) {
10961   return vec_st(
10962       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10963       __b, __c);
10964 }
10965
10966 static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
10967                                    vector float *__c) {
10968   return vec_st(
10969       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10970       __b, __c);
10971 }
10972
10973 /* vec_stvlxl */
10974
10975 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
10976                                     signed char *__c) {
10977   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10978                  __c);
10979 }
10980
10981 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
10982                                     vector signed char *__c) {
10983   return vec_stl(
10984       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10985       __b, __c);
10986 }
10987
10988 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
10989                                     unsigned char *__c) {
10990   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
10991                  __c);
10992 }
10993
10994 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
10995                                     vector unsigned char *__c) {
10996   return vec_stl(
10997       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
10998       __b, __c);
10999 }
11000
11001 static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
11002                                     vector bool char *__c) {
11003   return vec_stl(
11004       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11005       __b, __c);
11006 }
11007
11008 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
11009   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11010                  __c);
11011 }
11012
11013 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11014                                     vector short *__c) {
11015   return vec_stl(
11016       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11017       __b, __c);
11018 }
11019
11020 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11021                                     unsigned short *__c) {
11022   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11023                  __c);
11024 }
11025
11026 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11027                                     vector unsigned short *__c) {
11028   return vec_stl(
11029       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11030       __b, __c);
11031 }
11032
11033 static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
11034                                     vector bool short *__c) {
11035   return vec_stl(
11036       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11037       __b, __c);
11038 }
11039
11040 static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
11041                                     vector pixel *__c) {
11042   return vec_stl(
11043       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11044       __b, __c);
11045 }
11046
11047 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
11048   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11049                  __c);
11050 }
11051
11052 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__c) {
11053   return vec_stl(
11054       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11055       __b, __c);
11056 }
11057
11058 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11059                                     unsigned int *__c) {
11060   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11061                  __c);
11062 }
11063
11064 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11065                                     vector unsigned int *__c) {
11066   return vec_stl(
11067       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11068       __b, __c);
11069 }
11070
11071 static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
11072                                     vector bool int *__c) {
11073   return vec_stl(
11074       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11075       __b, __c);
11076 }
11077
11078 static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
11079                                     vector float *__c) {
11080   return vec_stl(
11081       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11082       __b, __c);
11083 }
11084
11085 /* vec_stvrx */
11086
11087 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11088                                    signed char *__c) {
11089   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11090                 __c);
11091 }
11092
11093 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11094                                    vector signed char *__c) {
11095   return vec_st(
11096       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11097       __b, __c);
11098 }
11099
11100 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11101                                    unsigned char *__c) {
11102   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11103                 __c);
11104 }
11105
11106 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11107                                    vector unsigned char *__c) {
11108   return vec_st(
11109       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11110       __b, __c);
11111 }
11112
11113 static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
11114                                    vector bool char *__c) {
11115   return vec_st(
11116       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11117       __b, __c);
11118 }
11119
11120 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
11121   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11122                 __c);
11123 }
11124
11125 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11126                                    vector short *__c) {
11127   return vec_st(
11128       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11129       __b, __c);
11130 }
11131
11132 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11133                                    unsigned short *__c) {
11134   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11135                 __c);
11136 }
11137
11138 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11139                                    vector unsigned short *__c) {
11140   return vec_st(
11141       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11142       __b, __c);
11143 }
11144
11145 static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
11146                                    vector bool short *__c) {
11147   return vec_st(
11148       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11149       __b, __c);
11150 }
11151
11152 static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
11153                                    vector pixel *__c) {
11154   return vec_st(
11155       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11156       __b, __c);
11157 }
11158
11159 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
11160   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11161                 __c);
11162 }
11163
11164 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__c) {
11165   return vec_st(
11166       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11167       __b, __c);
11168 }
11169
11170 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11171                                    unsigned int *__c) {
11172   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11173                 __c);
11174 }
11175
11176 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11177                                    vector unsigned int *__c) {
11178   return vec_st(
11179       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11180       __b, __c);
11181 }
11182
11183 static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
11184                                    vector bool int *__c) {
11185   return vec_st(
11186       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11187       __b, __c);
11188 }
11189
11190 static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
11191                                    vector float *__c) {
11192   return vec_st(
11193       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11194       __b, __c);
11195 }
11196
11197 /* vec_stvrxl */
11198
11199 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11200                                     signed char *__c) {
11201   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11202                  __c);
11203 }
11204
11205 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11206                                     vector signed char *__c) {
11207   return vec_stl(
11208       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11209       __b, __c);
11210 }
11211
11212 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11213                                     unsigned char *__c) {
11214   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11215                  __c);
11216 }
11217
11218 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11219                                     vector unsigned char *__c) {
11220   return vec_stl(
11221       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11222       __b, __c);
11223 }
11224
11225 static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
11226                                     vector bool char *__c) {
11227   return vec_stl(
11228       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11229       __b, __c);
11230 }
11231
11232 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
11233   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11234                  __c);
11235 }
11236
11237 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11238                                     vector short *__c) {
11239   return vec_stl(
11240       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11241       __b, __c);
11242 }
11243
11244 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11245                                     unsigned short *__c) {
11246   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11247                  __c);
11248 }
11249
11250 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11251                                     vector unsigned short *__c) {
11252   return vec_stl(
11253       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11254       __b, __c);
11255 }
11256
11257 static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
11258                                     vector bool short *__c) {
11259   return vec_stl(
11260       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11261       __b, __c);
11262 }
11263
11264 static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
11265                                     vector pixel *__c) {
11266   return vec_stl(
11267       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11268       __b, __c);
11269 }
11270
11271 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
11272   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11273                  __c);
11274 }
11275
11276 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__c) {
11277   return vec_stl(
11278       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11279       __b, __c);
11280 }
11281
11282 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11283                                     unsigned int *__c) {
11284   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11285                  __c);
11286 }
11287
11288 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11289                                     vector unsigned int *__c) {
11290   return vec_stl(
11291       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11292       __b, __c);
11293 }
11294
11295 static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
11296                                     vector bool int *__c) {
11297   return vec_stl(
11298       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11299       __b, __c);
11300 }
11301
11302 static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
11303                                     vector float *__c) {
11304   return vec_stl(
11305       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11306       __b, __c);
11307 }
11308
11309 /* vec_promote */
11310
11311 static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
11312   vector signed char __res = (vector signed char)(0);
11313   __res[__b] = __a;
11314   return __res;
11315 }
11316
11317 static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
11318                                                      int __b) {
11319   vector unsigned char __res = (vector unsigned char)(0);
11320   __res[__b] = __a;
11321   return __res;
11322 }
11323
11324 static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
11325   vector short __res = (vector short)(0);
11326   __res[__b] = __a;
11327   return __res;
11328 }
11329
11330 static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
11331                                                       int __b) {
11332   vector unsigned short __res = (vector unsigned short)(0);
11333   __res[__b] = __a;
11334   return __res;
11335 }
11336
11337 static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
11338   vector int __res = (vector int)(0);
11339   __res[__b] = __a;
11340   return __res;
11341 }
11342
11343 static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
11344   vector unsigned int __res = (vector unsigned int)(0);
11345   __res[__b] = __a;
11346   return __res;
11347 }
11348
11349 static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
11350   vector float __res = (vector float)(0);
11351   __res[__b] = __a;
11352   return __res;
11353 }
11354
11355 /* vec_splats */
11356
11357 static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
11358   return (vector signed char)(__a);
11359 }
11360
11361 static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
11362   return (vector unsigned char)(__a);
11363 }
11364
11365 static vector short __ATTRS_o_ai vec_splats(short __a) {
11366   return (vector short)(__a);
11367 }
11368
11369 static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
11370   return (vector unsigned short)(__a);
11371 }
11372
11373 static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
11374
11375 static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
11376   return (vector unsigned int)(__a);
11377 }
11378
11379 static vector float __ATTRS_o_ai vec_splats(float __a) {
11380   return (vector float)(__a);
11381 }
11382
11383 /* ----------------------------- predicates --------------------------------- */
11384
11385 /* vec_all_eq */
11386
11387 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11388                                    vector signed char __b) {
11389   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11390                                       (vector char)__b);
11391 }
11392
11393 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11394                                    vector bool char __b) {
11395   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11396                                       (vector char)__b);
11397 }
11398
11399 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11400                                    vector unsigned char __b) {
11401   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11402                                       (vector char)__b);
11403 }
11404
11405 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11406                                    vector bool char __b) {
11407   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11408                                       (vector char)__b);
11409 }
11410
11411 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11412                                    vector signed char __b) {
11413   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11414                                       (vector char)__b);
11415 }
11416
11417 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11418                                    vector unsigned char __b) {
11419   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11420                                       (vector char)__b);
11421 }
11422
11423 static int __ATTRS_o_ai vec_all_eq(vector bool char __a, vector bool char __b) {
11424   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11425                                       (vector char)__b);
11426 }
11427
11428 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
11429   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
11430 }
11431
11432 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
11433   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
11434 }
11435
11436 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11437                                    vector unsigned short __b) {
11438   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11439                                       (vector short)__b);
11440 }
11441
11442 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11443                                    vector bool short __b) {
11444   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11445                                       (vector short)__b);
11446 }
11447
11448 static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
11449   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11450                                       (vector short)__b);
11451 }
11452
11453 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11454                                    vector unsigned short __b) {
11455   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11456                                       (vector short)__b);
11457 }
11458
11459 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11460                                    vector bool short __b) {
11461   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11462                                       (vector short)__b);
11463 }
11464
11465 static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
11466   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11467                                       (vector short)__b);
11468 }
11469
11470 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
11471   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
11472 }
11473
11474 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
11475   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
11476 }
11477
11478 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11479                                    vector unsigned int __b) {
11480   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11481                                       (vector int)__b);
11482 }
11483
11484 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11485                                    vector bool int __b) {
11486   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11487                                       (vector int)__b);
11488 }
11489
11490 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
11491   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11492                                       (vector int)__b);
11493 }
11494
11495 static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
11496                                    vector unsigned int __b) {
11497   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11498                                       (vector int)__b);
11499 }
11500
11501 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
11502   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11503                                       (vector int)__b);
11504 }
11505
11506 #ifdef __POWER8_VECTOR__
11507 static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
11508                                    vector signed long long __b) {
11509   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11510 }
11511
11512 static int __ATTRS_o_ai vec_all_eq(vector long long __a,
11513                                    vector bool long long __b) {
11514   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11515 }
11516
11517 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11518                                    vector unsigned long long __b) {
11519   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11520                                       (vector long long)__b);
11521 }
11522
11523 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11524                                    vector bool long long __b) {
11525   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11526                                       (vector long long)__b);
11527 }
11528
11529 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11530                                    vector long long __b) {
11531   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11532                                       (vector long long)__b);
11533 }
11534
11535 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11536                                    vector unsigned long long __b) {
11537   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11538                                       (vector long long)__b);
11539 }
11540
11541 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11542                                    vector bool long long __b) {
11543   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11544                                       (vector long long)__b);
11545 }
11546 #endif
11547
11548 static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
11549   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
11550 }
11551
11552 /* vec_all_ge */
11553
11554 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11555                                    vector signed char __b) {
11556   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
11557 }
11558
11559 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11560                                    vector bool char __b) {
11561   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
11562 }
11563
11564 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11565                                    vector unsigned char __b) {
11566   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
11567 }
11568
11569 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11570                                    vector bool char __b) {
11571   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
11572 }
11573
11574 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11575                                    vector signed char __b) {
11576   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11577                                       (vector unsigned char)__a);
11578 }
11579
11580 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11581                                    vector unsigned char __b) {
11582   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
11583 }
11584
11585 static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
11586   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11587                                       (vector unsigned char)__a);
11588 }
11589
11590 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
11591   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
11592 }
11593
11594 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
11595   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
11596 }
11597
11598 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11599                                    vector unsigned short __b) {
11600   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
11601 }
11602
11603 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11604                                    vector bool short __b) {
11605   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11606                                       __a);
11607 }
11608
11609 static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
11610   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11611                                       (vector unsigned short)__a);
11612 }
11613
11614 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11615                                    vector unsigned short __b) {
11616   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
11617                                       (vector unsigned short)__a);
11618 }
11619
11620 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11621                                    vector bool short __b) {
11622   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11623                                       (vector unsigned short)__a);
11624 }
11625
11626 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
11627   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
11628 }
11629
11630 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
11631   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
11632 }
11633
11634 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11635                                    vector unsigned int __b) {
11636   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
11637 }
11638
11639 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11640                                    vector bool int __b) {
11641   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
11642 }
11643
11644 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
11645   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11646                                       (vector unsigned int)__a);
11647 }
11648
11649 static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
11650                                    vector unsigned int __b) {
11651   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
11652 }
11653
11654 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
11655   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11656                                       (vector unsigned int)__a);
11657 }
11658
11659 #ifdef __POWER8_VECTOR__
11660 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11661                                    vector signed long long __b) {
11662   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11663 }
11664 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11665                                    vector bool long long __b) {
11666   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11667                                       __a);
11668 }
11669
11670 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11671                                    vector unsigned long long __b) {
11672   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11673 }
11674
11675 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11676                                    vector bool long long __b) {
11677   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11678                                       __a);
11679 }
11680
11681 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11682                                    vector signed long long __b) {
11683   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11684                                       (vector unsigned long long)__a);
11685 }
11686
11687 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11688                                    vector unsigned long long __b) {
11689   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11690                                       (vector unsigned long long)__a);
11691 }
11692
11693 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11694                                    vector bool long long __b) {
11695   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11696                                       (vector unsigned long long)__a);
11697 }
11698 #endif
11699
11700 static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
11701   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
11702 }
11703
11704 /* vec_all_gt */
11705
11706 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11707                                    vector signed char __b) {
11708   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
11709 }
11710
11711 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11712                                    vector bool char __b) {
11713   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
11714 }
11715
11716 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11717                                    vector unsigned char __b) {
11718   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
11719 }
11720
11721 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11722                                    vector bool char __b) {
11723   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
11724 }
11725
11726 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
11727                                    vector signed char __b) {
11728   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
11729                                       (vector unsigned char)__b);
11730 }
11731
11732 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
11733                                    vector unsigned char __b) {
11734   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
11735 }
11736
11737 static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
11738   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
11739                                       (vector unsigned char)__b);
11740 }
11741
11742 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
11743   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
11744 }
11745
11746 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
11747   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
11748 }
11749
11750 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
11751                                    vector unsigned short __b) {
11752   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
11753 }
11754
11755 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
11756                                    vector bool short __b) {
11757   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
11758                                       (vector unsigned short)__b);
11759 }
11760
11761 static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
11762   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
11763                                       (vector unsigned short)__b);
11764 }
11765
11766 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
11767                                    vector unsigned short __b) {
11768   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
11769                                       __b);
11770 }
11771
11772 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
11773                                    vector bool short __b) {
11774   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
11775                                       (vector unsigned short)__b);
11776 }
11777
11778 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
11779   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
11780 }
11781
11782 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
11783   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
11784 }
11785
11786 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
11787                                    vector unsigned int __b) {
11788   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
11789 }
11790
11791 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
11792                                    vector bool int __b) {
11793   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
11794 }
11795
11796 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
11797   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
11798                                       (vector unsigned int)__b);
11799 }
11800
11801 static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
11802                                    vector unsigned int __b) {
11803   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
11804 }
11805
11806 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
11807   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
11808                                       (vector unsigned int)__b);
11809 }
11810
11811 #ifdef __POWER8_VECTOR__
11812 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
11813                                    vector signed long long __b) {
11814   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
11815 }
11816 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
11817                                    vector bool long long __b) {
11818   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
11819                                       (vector signed long long)__b);
11820 }
11821
11822 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
11823                                    vector unsigned long long __b) {
11824   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
11825 }
11826
11827 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
11828                                    vector bool long long __b) {
11829   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
11830                                       (vector unsigned long long)__b);
11831 }
11832
11833 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
11834                                    vector signed long long __b) {
11835   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11836                                       (vector unsigned long long)__b);
11837 }
11838
11839 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
11840                                    vector unsigned long long __b) {
11841   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11842                                       __b);
11843 }
11844
11845 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
11846                                    vector bool long long __b) {
11847   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11848                                       (vector unsigned long long)__b);
11849 }
11850 #endif
11851
11852 static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
11853   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
11854 }
11855
11856 /* vec_all_in */
11857
11858 static int __attribute__((__always_inline__))
11859 vec_all_in(vector float __a, vector float __b) {
11860   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
11861 }
11862
11863 /* vec_all_le */
11864
11865 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
11866                                    vector signed char __b) {
11867   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
11868 }
11869
11870 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
11871                                    vector bool char __b) {
11872   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
11873 }
11874
11875 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
11876                                    vector unsigned char __b) {
11877   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
11878 }
11879
11880 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
11881                                    vector bool char __b) {
11882   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
11883 }
11884
11885 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
11886                                    vector signed char __b) {
11887   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
11888                                       (vector unsigned char)__b);
11889 }
11890
11891 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
11892                                    vector unsigned char __b) {
11893   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
11894 }
11895
11896 static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
11897   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
11898                                       (vector unsigned char)__b);
11899 }
11900
11901 static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
11902   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
11903 }
11904
11905 static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
11906   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
11907 }
11908
11909 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
11910                                    vector unsigned short __b) {
11911   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
11912 }
11913
11914 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
11915                                    vector bool short __b) {
11916   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
11917                                       (vector unsigned short)__b);
11918 }
11919
11920 static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
11921   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
11922                                       (vector unsigned short)__b);
11923 }
11924
11925 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
11926                                    vector unsigned short __b) {
11927   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
11928                                       __b);
11929 }
11930
11931 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
11932                                    vector bool short __b) {
11933   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
11934                                       (vector unsigned short)__b);
11935 }
11936
11937 static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
11938   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
11939 }
11940
11941 static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
11942   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
11943 }
11944
11945 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
11946                                    vector unsigned int __b) {
11947   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
11948 }
11949
11950 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
11951                                    vector bool int __b) {
11952   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
11953 }
11954
11955 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
11956   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
11957                                       (vector unsigned int)__b);
11958 }
11959
11960 static int __ATTRS_o_ai vec_all_le(vector bool int __a,
11961                                    vector unsigned int __b) {
11962   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
11963 }
11964
11965 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
11966   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
11967                                       (vector unsigned int)__b);
11968 }
11969
11970 #ifdef __POWER8_VECTOR__
11971 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
11972                                    vector signed long long __b) {
11973   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
11974 }
11975
11976 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
11977                                    vector unsigned long long __b) {
11978   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
11979 }
11980
11981 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
11982                                    vector bool long long __b) {
11983   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
11984                                       (vector signed long long)__b);
11985 }
11986
11987 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
11988                                    vector bool long long __b) {
11989   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
11990                                       (vector unsigned long long)__b);
11991 }
11992
11993 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
11994                                    vector signed long long __b) {
11995   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
11996                                       (vector unsigned long long)__b);
11997 }
11998
11999 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12000                                    vector unsigned long long __b) {
12001   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12002                                       __b);
12003 }
12004
12005 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12006                                    vector bool long long __b) {
12007   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12008                                       (vector unsigned long long)__b);
12009 }
12010 #endif
12011
12012 static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
12013   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
12014 }
12015
12016 /* vec_all_lt */
12017
12018 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12019                                    vector signed char __b) {
12020   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
12021 }
12022
12023 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12024                                    vector bool char __b) {
12025   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
12026 }
12027
12028 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12029                                    vector unsigned char __b) {
12030   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
12031 }
12032
12033 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12034                                    vector bool char __b) {
12035   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
12036 }
12037
12038 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12039                                    vector signed char __b) {
12040   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12041                                       (vector unsigned char)__a);
12042 }
12043
12044 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12045                                    vector unsigned char __b) {
12046   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
12047 }
12048
12049 static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
12050   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12051                                       (vector unsigned char)__a);
12052 }
12053
12054 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
12055   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
12056 }
12057
12058 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
12059   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
12060 }
12061
12062 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12063                                    vector unsigned short __b) {
12064   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
12065 }
12066
12067 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12068                                    vector bool short __b) {
12069   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12070                                       __a);
12071 }
12072
12073 static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
12074   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12075                                       (vector unsigned short)__a);
12076 }
12077
12078 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12079                                    vector unsigned short __b) {
12080   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
12081                                       (vector unsigned short)__a);
12082 }
12083
12084 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12085                                    vector bool short __b) {
12086   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12087                                       (vector unsigned short)__a);
12088 }
12089
12090 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
12091   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
12092 }
12093
12094 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
12095   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
12096 }
12097
12098 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12099                                    vector unsigned int __b) {
12100   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
12101 }
12102
12103 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12104                                    vector bool int __b) {
12105   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
12106 }
12107
12108 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
12109   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12110                                       (vector unsigned int)__a);
12111 }
12112
12113 static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12114                                    vector unsigned int __b) {
12115   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
12116 }
12117
12118 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
12119   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12120                                       (vector unsigned int)__a);
12121 }
12122
12123 #ifdef __POWER8_VECTOR__
12124 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12125                                    vector signed long long __b) {
12126   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12127 }
12128
12129 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12130                                    vector unsigned long long __b) {
12131   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12132 }
12133
12134 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12135                                    vector bool long long __b) {
12136   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12137                                       __a);
12138 }
12139
12140 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12141                                    vector bool long long __b) {
12142   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12143                                       __a);
12144 }
12145
12146 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12147                                    vector signed long long __b) {
12148   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12149                                       (vector unsigned long long)__a);
12150 }
12151
12152 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12153                                    vector unsigned long long __b) {
12154   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12155                                       (vector unsigned long long)__a);
12156 }
12157
12158 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12159                                    vector bool long long __b) {
12160   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12161                                       (vector unsigned long long)__a);
12162 }
12163 #endif
12164
12165 static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
12166   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
12167 }
12168
12169 /* vec_all_nan */
12170
12171 static int __attribute__((__always_inline__)) vec_all_nan(vector float __a) {
12172   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
12173 }
12174
12175 /* vec_all_ne */
12176
12177 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12178                                    vector signed char __b) {
12179   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12180                                       (vector char)__b);
12181 }
12182
12183 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12184                                    vector bool char __b) {
12185   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12186                                       (vector char)__b);
12187 }
12188
12189 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12190                                    vector unsigned char __b) {
12191   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12192                                       (vector char)__b);
12193 }
12194
12195 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12196                                    vector bool char __b) {
12197   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12198                                       (vector char)__b);
12199 }
12200
12201 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12202                                    vector signed char __b) {
12203   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12204                                       (vector char)__b);
12205 }
12206
12207 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12208                                    vector unsigned char __b) {
12209   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12210                                       (vector char)__b);
12211 }
12212
12213 static int __ATTRS_o_ai vec_all_ne(vector bool char __a, vector bool char __b) {
12214   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12215                                       (vector char)__b);
12216 }
12217
12218 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
12219   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
12220 }
12221
12222 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
12223   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
12224 }
12225
12226 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12227                                    vector unsigned short __b) {
12228   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12229                                       (vector short)__b);
12230 }
12231
12232 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12233                                    vector bool short __b) {
12234   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12235                                       (vector short)__b);
12236 }
12237
12238 static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
12239   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12240                                       (vector short)__b);
12241 }
12242
12243 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12244                                    vector unsigned short __b) {
12245   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12246                                       (vector short)__b);
12247 }
12248
12249 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12250                                    vector bool short __b) {
12251   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12252                                       (vector short)__b);
12253 }
12254
12255 static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
12256   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12257                                       (vector short)__b);
12258 }
12259
12260 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
12261   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
12262 }
12263
12264 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
12265   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
12266 }
12267
12268 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12269                                    vector unsigned int __b) {
12270   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12271                                       (vector int)__b);
12272 }
12273
12274 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12275                                    vector bool int __b) {
12276   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12277                                       (vector int)__b);
12278 }
12279
12280 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
12281   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12282                                       (vector int)__b);
12283 }
12284
12285 static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
12286                                    vector unsigned int __b) {
12287   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12288                                       (vector int)__b);
12289 }
12290
12291 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
12292   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12293                                       (vector int)__b);
12294 }
12295
12296 #ifdef __POWER8_VECTOR__
12297 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12298                                    vector signed long long __b) {
12299   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12300 }
12301
12302 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12303                                    vector unsigned long long __b) {
12304   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12305                                       (vector long long)__b);
12306 }
12307
12308 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12309                                    vector bool long long __b) {
12310   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12311                                       (vector signed long long)__b);
12312 }
12313
12314 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12315                                    vector bool long long __b) {
12316   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12317                                       (vector signed long long)__b);
12318 }
12319
12320 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12321                                    vector signed long long __b) {
12322   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12323                                       (vector signed long long)__b);
12324 }
12325
12326 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12327                                    vector unsigned long long __b) {
12328   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12329                                       (vector signed long long)__b);
12330 }
12331
12332 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12333                                    vector bool long long __b) {
12334   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12335                                       (vector signed long long)__b);
12336 }
12337 #endif
12338
12339 static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
12340   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
12341 }
12342
12343 /* vec_all_nge */
12344
12345 static int __attribute__((__always_inline__))
12346 vec_all_nge(vector float __a, vector float __b) {
12347   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
12348 }
12349
12350 /* vec_all_ngt */
12351
12352 static int __attribute__((__always_inline__))
12353 vec_all_ngt(vector float __a, vector float __b) {
12354   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
12355 }
12356
12357 /* vec_all_nle */
12358
12359 static int __attribute__((__always_inline__))
12360 vec_all_nle(vector float __a, vector float __b) {
12361   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
12362 }
12363
12364 /* vec_all_nlt */
12365
12366 static int __attribute__((__always_inline__))
12367 vec_all_nlt(vector float __a, vector float __b) {
12368   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
12369 }
12370
12371 /* vec_all_numeric */
12372
12373 static int __attribute__((__always_inline__))
12374 vec_all_numeric(vector float __a) {
12375   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
12376 }
12377
12378 /* vec_any_eq */
12379
12380 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12381                                    vector signed char __b) {
12382   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12383                                       (vector char)__b);
12384 }
12385
12386 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12387                                    vector bool char __b) {
12388   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12389                                       (vector char)__b);
12390 }
12391
12392 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12393                                    vector unsigned char __b) {
12394   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12395                                       (vector char)__b);
12396 }
12397
12398 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12399                                    vector bool char __b) {
12400   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12401                                       (vector char)__b);
12402 }
12403
12404 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12405                                    vector signed char __b) {
12406   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12407                                       (vector char)__b);
12408 }
12409
12410 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12411                                    vector unsigned char __b) {
12412   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12413                                       (vector char)__b);
12414 }
12415
12416 static int __ATTRS_o_ai vec_any_eq(vector bool char __a, vector bool char __b) {
12417   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12418                                       (vector char)__b);
12419 }
12420
12421 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
12422   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
12423 }
12424
12425 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
12426   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
12427 }
12428
12429 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12430                                    vector unsigned short __b) {
12431   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12432                                       (vector short)__b);
12433 }
12434
12435 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12436                                    vector bool short __b) {
12437   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12438                                       (vector short)__b);
12439 }
12440
12441 static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
12442   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12443                                       (vector short)__b);
12444 }
12445
12446 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12447                                    vector unsigned short __b) {
12448   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12449                                       (vector short)__b);
12450 }
12451
12452 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12453                                    vector bool short __b) {
12454   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12455                                       (vector short)__b);
12456 }
12457
12458 static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
12459   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12460                                       (vector short)__b);
12461 }
12462
12463 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
12464   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
12465 }
12466
12467 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
12468   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
12469 }
12470
12471 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12472                                    vector unsigned int __b) {
12473   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12474                                       (vector int)__b);
12475 }
12476
12477 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12478                                    vector bool int __b) {
12479   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12480                                       (vector int)__b);
12481 }
12482
12483 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
12484   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12485                                       (vector int)__b);
12486 }
12487
12488 static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
12489                                    vector unsigned int __b) {
12490   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12491                                       (vector int)__b);
12492 }
12493
12494 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
12495   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12496                                       (vector int)__b);
12497 }
12498
12499 #ifdef __POWER8_VECTOR__
12500 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12501                                    vector signed long long __b) {
12502   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12503 }
12504
12505 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12506                                    vector unsigned long long __b) {
12507   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12508                                       (vector long long)__b);
12509 }
12510
12511 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12512                                    vector bool long long __b) {
12513   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12514                                       (vector signed long long)__b);
12515 }
12516
12517 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12518                                    vector bool long long __b) {
12519   return __builtin_altivec_vcmpequd_p(
12520       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12521 }
12522
12523 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12524                                    vector signed long long __b) {
12525   return __builtin_altivec_vcmpequd_p(
12526       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12527 }
12528
12529 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12530                                    vector unsigned long long __b) {
12531   return __builtin_altivec_vcmpequd_p(
12532       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12533 }
12534
12535 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12536                                    vector bool long long __b) {
12537   return __builtin_altivec_vcmpequd_p(
12538       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12539 }
12540 #endif
12541
12542 static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
12543   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
12544 }
12545
12546 /* vec_any_ge */
12547
12548 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12549                                    vector signed char __b) {
12550   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
12551 }
12552
12553 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12554                                    vector bool char __b) {
12555   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
12556                                       __a);
12557 }
12558
12559 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12560                                    vector unsigned char __b) {
12561   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
12562 }
12563
12564 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12565                                    vector bool char __b) {
12566   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12567                                       __a);
12568 }
12569
12570 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12571                                    vector signed char __b) {
12572   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12573                                       (vector unsigned char)__a);
12574 }
12575
12576 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12577                                    vector unsigned char __b) {
12578   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
12579                                       (vector unsigned char)__a);
12580 }
12581
12582 static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
12583   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12584                                       (vector unsigned char)__a);
12585 }
12586
12587 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
12588   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
12589 }
12590
12591 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
12592   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
12593 }
12594
12595 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12596                                    vector unsigned short __b) {
12597   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
12598 }
12599
12600 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12601                                    vector bool short __b) {
12602   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12603                                       __a);
12604 }
12605
12606 static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
12607   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12608                                       (vector unsigned short)__a);
12609 }
12610
12611 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12612                                    vector unsigned short __b) {
12613   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
12614                                       (vector unsigned short)__a);
12615 }
12616
12617 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12618                                    vector bool short __b) {
12619   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12620                                       (vector unsigned short)__a);
12621 }
12622
12623 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
12624   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
12625 }
12626
12627 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
12628   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
12629 }
12630
12631 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12632                                    vector unsigned int __b) {
12633   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
12634 }
12635
12636 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12637                                    vector bool int __b) {
12638   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12639                                       __a);
12640 }
12641
12642 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
12643   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12644                                       (vector unsigned int)__a);
12645 }
12646
12647 static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
12648                                    vector unsigned int __b) {
12649   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
12650                                       (vector unsigned int)__a);
12651 }
12652
12653 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
12654   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12655                                       (vector unsigned int)__a);
12656 }
12657
12658 #ifdef __POWER8_VECTOR__
12659 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
12660                                    vector signed long long __b) {
12661   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
12662 }
12663
12664 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
12665                                    vector unsigned long long __b) {
12666   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
12667 }
12668
12669 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
12670                                    vector bool long long __b) {
12671   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
12672                                       (vector signed long long)__b, __a);
12673 }
12674
12675 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
12676                                    vector bool long long __b) {
12677   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12678                                       (vector unsigned long long)__b, __a);
12679 }
12680
12681 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
12682                                    vector signed long long __b) {
12683   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12684                                       (vector unsigned long long)__b,
12685                                       (vector unsigned long long)__a);
12686 }
12687
12688 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
12689                                    vector unsigned long long __b) {
12690   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
12691                                       (vector unsigned long long)__a);
12692 }
12693
12694 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
12695                                    vector bool long long __b) {
12696   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12697                                       (vector unsigned long long)__b,
12698                                       (vector unsigned long long)__a);
12699 }
12700 #endif
12701
12702 static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
12703   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
12704 }
12705
12706 /* vec_any_gt */
12707
12708 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
12709                                    vector signed char __b) {
12710   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
12711 }
12712
12713 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
12714                                    vector bool char __b) {
12715   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
12716                                       (vector signed char)__b);
12717 }
12718
12719 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
12720                                    vector unsigned char __b) {
12721   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
12722 }
12723
12724 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
12725                                    vector bool char __b) {
12726   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
12727                                       (vector unsigned char)__b);
12728 }
12729
12730 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
12731                                    vector signed char __b) {
12732   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
12733                                       (vector unsigned char)__b);
12734 }
12735
12736 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
12737                                    vector unsigned char __b) {
12738   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
12739                                       __b);
12740 }
12741
12742 static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
12743   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
12744                                       (vector unsigned char)__b);
12745 }
12746
12747 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
12748   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
12749 }
12750
12751 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
12752   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
12753 }
12754
12755 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
12756                                    vector unsigned short __b) {
12757   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
12758 }
12759
12760 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
12761                                    vector bool short __b) {
12762   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
12763                                       (vector unsigned short)__b);
12764 }
12765
12766 static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
12767   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
12768                                       (vector unsigned short)__b);
12769 }
12770
12771 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
12772                                    vector unsigned short __b) {
12773   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
12774                                       __b);
12775 }
12776
12777 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
12778                                    vector bool short __b) {
12779   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
12780                                       (vector unsigned short)__b);
12781 }
12782
12783 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
12784   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
12785 }
12786
12787 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
12788   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
12789 }
12790
12791 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
12792                                    vector unsigned int __b) {
12793   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
12794 }
12795
12796 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
12797                                    vector bool int __b) {
12798   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
12799                                       (vector unsigned int)__b);
12800 }
12801
12802 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
12803   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
12804                                       (vector unsigned int)__b);
12805 }
12806
12807 static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
12808                                    vector unsigned int __b) {
12809   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
12810                                       __b);
12811 }
12812
12813 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
12814   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
12815                                       (vector unsigned int)__b);
12816 }
12817
12818 #ifdef __POWER8_VECTOR__
12819 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
12820                                    vector signed long long __b) {
12821   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
12822 }
12823
12824 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
12825                                    vector unsigned long long __b) {
12826   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
12827 }
12828
12829 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
12830                                    vector bool long long __b) {
12831   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
12832                                       (vector signed long long)__b);
12833 }
12834
12835 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
12836                                    vector bool long long __b) {
12837   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
12838                                       (vector unsigned long long)__b);
12839 }
12840
12841 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
12842                                    vector signed long long __b) {
12843   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12844                                       (vector unsigned long long)__a,
12845                                       (vector unsigned long long)__b);
12846 }
12847
12848 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
12849                                    vector unsigned long long __b) {
12850   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12851                                       (vector unsigned long long)__a, __b);
12852 }
12853
12854 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
12855                                    vector bool long long __b) {
12856   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12857                                       (vector unsigned long long)__a,
12858                                       (vector unsigned long long)__b);
12859 }
12860 #endif
12861
12862 static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
12863   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
12864 }
12865
12866 /* vec_any_le */
12867
12868 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
12869                                    vector signed char __b) {
12870   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
12871 }
12872
12873 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
12874                                    vector bool char __b) {
12875   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
12876                                       (vector signed char)__b);
12877 }
12878
12879 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
12880                                    vector unsigned char __b) {
12881   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
12882 }
12883
12884 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
12885                                    vector bool char __b) {
12886   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
12887                                       (vector unsigned char)__b);
12888 }
12889
12890 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
12891                                    vector signed char __b) {
12892   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
12893                                       (vector unsigned char)__b);
12894 }
12895
12896 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
12897                                    vector unsigned char __b) {
12898   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
12899                                       __b);
12900 }
12901
12902 static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
12903   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
12904                                       (vector unsigned char)__b);
12905 }
12906
12907 static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
12908   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
12909 }
12910
12911 static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
12912   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
12913 }
12914
12915 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
12916                                    vector unsigned short __b) {
12917   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
12918 }
12919
12920 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
12921                                    vector bool short __b) {
12922   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
12923                                       (vector unsigned short)__b);
12924 }
12925
12926 static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
12927   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
12928                                       (vector unsigned short)__b);
12929 }
12930
12931 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
12932                                    vector unsigned short __b) {
12933   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
12934                                       __b);
12935 }
12936
12937 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
12938                                    vector bool short __b) {
12939   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
12940                                       (vector unsigned short)__b);
12941 }
12942
12943 static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
12944   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
12945 }
12946
12947 static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
12948   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
12949 }
12950
12951 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
12952                                    vector unsigned int __b) {
12953   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
12954 }
12955
12956 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
12957                                    vector bool int __b) {
12958   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
12959                                       (vector unsigned int)__b);
12960 }
12961
12962 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
12963   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
12964                                       (vector unsigned int)__b);
12965 }
12966
12967 static int __ATTRS_o_ai vec_any_le(vector bool int __a,
12968                                    vector unsigned int __b) {
12969   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
12970                                       __b);
12971 }
12972
12973 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
12974   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
12975                                       (vector unsigned int)__b);
12976 }
12977
12978 #ifdef __POWER8_VECTOR__
12979 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
12980                                    vector signed long long __b) {
12981   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
12982 }
12983
12984 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
12985                                    vector unsigned long long __b) {
12986   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
12987 }
12988
12989 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
12990                                    vector bool long long __b) {
12991   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
12992                                       (vector signed long long)__b);
12993 }
12994
12995 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
12996                                    vector bool long long __b) {
12997   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
12998                                       (vector unsigned long long)__b);
12999 }
13000
13001 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13002                                    vector signed long long __b) {
13003   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13004                                       (vector unsigned long long)__a,
13005                                       (vector unsigned long long)__b);
13006 }
13007
13008 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13009                                    vector unsigned long long __b) {
13010   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13011                                       (vector unsigned long long)__a, __b);
13012 }
13013
13014 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13015                                    vector bool long long __b) {
13016   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13017                                       (vector unsigned long long)__a,
13018                                       (vector unsigned long long)__b);
13019 }
13020 #endif
13021
13022 static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
13023   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
13024 }
13025
13026 /* vec_any_lt */
13027
13028 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13029                                    vector signed char __b) {
13030   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
13031 }
13032
13033 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13034                                    vector bool char __b) {
13035   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
13036                                       __a);
13037 }
13038
13039 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13040                                    vector unsigned char __b) {
13041   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
13042 }
13043
13044 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13045                                    vector bool char __b) {
13046   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13047                                       __a);
13048 }
13049
13050 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13051                                    vector signed char __b) {
13052   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13053                                       (vector unsigned char)__a);
13054 }
13055
13056 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13057                                    vector unsigned char __b) {
13058   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
13059                                       (vector unsigned char)__a);
13060 }
13061
13062 static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
13063   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13064                                       (vector unsigned char)__a);
13065 }
13066
13067 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
13068   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
13069 }
13070
13071 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
13072   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
13073 }
13074
13075 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13076                                    vector unsigned short __b) {
13077   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
13078 }
13079
13080 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13081                                    vector bool short __b) {
13082   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13083                                       __a);
13084 }
13085
13086 static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
13087   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13088                                       (vector unsigned short)__a);
13089 }
13090
13091 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13092                                    vector unsigned short __b) {
13093   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
13094                                       (vector unsigned short)__a);
13095 }
13096
13097 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13098                                    vector bool short __b) {
13099   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13100                                       (vector unsigned short)__a);
13101 }
13102
13103 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
13104   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
13105 }
13106
13107 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
13108   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
13109 }
13110
13111 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13112                                    vector unsigned int __b) {
13113   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
13114 }
13115
13116 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13117                                    vector bool int __b) {
13118   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13119                                       __a);
13120 }
13121
13122 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
13123   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13124                                       (vector unsigned int)__a);
13125 }
13126
13127 static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
13128                                    vector unsigned int __b) {
13129   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
13130                                       (vector unsigned int)__a);
13131 }
13132
13133 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
13134   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13135                                       (vector unsigned int)__a);
13136 }
13137
13138 #ifdef __POWER8_VECTOR__
13139 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13140                                    vector signed long long __b) {
13141   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13142 }
13143
13144 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13145                                    vector unsigned long long __b) {
13146   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13147 }
13148
13149 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13150                                    vector bool long long __b) {
13151   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13152                                       (vector signed long long)__b, __a);
13153 }
13154
13155 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13156                                    vector bool long long __b) {
13157   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13158                                       (vector unsigned long long)__b, __a);
13159 }
13160
13161 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13162                                    vector signed long long __b) {
13163   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13164                                       (vector unsigned long long)__b,
13165                                       (vector unsigned long long)__a);
13166 }
13167
13168 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13169                                    vector unsigned long long __b) {
13170   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13171                                       (vector unsigned long long)__a);
13172 }
13173
13174 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13175                                    vector bool long long __b) {
13176   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13177                                       (vector unsigned long long)__b,
13178                                       (vector unsigned long long)__a);
13179 }
13180 #endif
13181
13182 static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
13183   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
13184 }
13185
13186 /* vec_any_nan */
13187
13188 static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
13189   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
13190 }
13191
13192 /* vec_any_ne */
13193
13194 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13195                                    vector signed char __b) {
13196   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13197                                       (vector char)__b);
13198 }
13199
13200 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13201                                    vector bool char __b) {
13202   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13203                                       (vector char)__b);
13204 }
13205
13206 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13207                                    vector unsigned char __b) {
13208   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13209                                       (vector char)__b);
13210 }
13211
13212 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13213                                    vector bool char __b) {
13214   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13215                                       (vector char)__b);
13216 }
13217
13218 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13219                                    vector signed char __b) {
13220   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13221                                       (vector char)__b);
13222 }
13223
13224 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13225                                    vector unsigned char __b) {
13226   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13227                                       (vector char)__b);
13228 }
13229
13230 static int __ATTRS_o_ai vec_any_ne(vector bool char __a, vector bool char __b) {
13231   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13232                                       (vector char)__b);
13233 }
13234
13235 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
13236   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
13237 }
13238
13239 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
13240   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
13241 }
13242
13243 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13244                                    vector unsigned short __b) {
13245   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13246                                       (vector short)__b);
13247 }
13248
13249 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13250                                    vector bool short __b) {
13251   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13252                                       (vector short)__b);
13253 }
13254
13255 static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
13256   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13257                                       (vector short)__b);
13258 }
13259
13260 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13261                                    vector unsigned short __b) {
13262   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13263                                       (vector short)__b);
13264 }
13265
13266 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13267                                    vector bool short __b) {
13268   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13269                                       (vector short)__b);
13270 }
13271
13272 static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
13273   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13274                                       (vector short)__b);
13275 }
13276
13277 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
13278   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
13279 }
13280
13281 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
13282   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
13283 }
13284
13285 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13286                                    vector unsigned int __b) {
13287   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13288                                       (vector int)__b);
13289 }
13290
13291 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13292                                    vector bool int __b) {
13293   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13294                                       (vector int)__b);
13295 }
13296
13297 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
13298   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13299                                       (vector int)__b);
13300 }
13301
13302 static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
13303                                    vector unsigned int __b) {
13304   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13305                                       (vector int)__b);
13306 }
13307
13308 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
13309   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13310                                       (vector int)__b);
13311 }
13312
13313 #ifdef __POWER8_VECTOR__
13314 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13315                                    vector signed long long __b) {
13316   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13317 }
13318
13319 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13320                                    vector unsigned long long __b) {
13321   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13322                                       (vector long long)__b);
13323 }
13324
13325 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13326                                    vector bool long long __b) {
13327   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13328                                       (vector signed long long)__b);
13329 }
13330
13331 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13332                                    vector bool long long __b) {
13333   return __builtin_altivec_vcmpequd_p(
13334       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13335 }
13336
13337 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13338                                    vector signed long long __b) {
13339   return __builtin_altivec_vcmpequd_p(
13340       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13341 }
13342
13343 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13344                                    vector unsigned long long __b) {
13345   return __builtin_altivec_vcmpequd_p(
13346       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13347 }
13348
13349 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13350                                    vector bool long long __b) {
13351   return __builtin_altivec_vcmpequd_p(
13352       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13353 }
13354 #endif
13355
13356 static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
13357   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
13358 }
13359
13360 /* vec_any_nge */
13361
13362 static int __attribute__((__always_inline__))
13363 vec_any_nge(vector float __a, vector float __b) {
13364   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
13365 }
13366
13367 /* vec_any_ngt */
13368
13369 static int __attribute__((__always_inline__))
13370 vec_any_ngt(vector float __a, vector float __b) {
13371   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
13372 }
13373
13374 /* vec_any_nle */
13375
13376 static int __attribute__((__always_inline__))
13377 vec_any_nle(vector float __a, vector float __b) {
13378   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
13379 }
13380
13381 /* vec_any_nlt */
13382
13383 static int __attribute__((__always_inline__))
13384 vec_any_nlt(vector float __a, vector float __b) {
13385   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
13386 }
13387
13388 /* vec_any_numeric */
13389
13390 static int __attribute__((__always_inline__))
13391 vec_any_numeric(vector float __a) {
13392   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
13393 }
13394
13395 /* vec_any_out */
13396
13397 static int __attribute__((__always_inline__))
13398 vec_any_out(vector float __a, vector float __b) {
13399   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
13400 }
13401
13402 /* Power 8 Crypto functions
13403 Note: We diverge from the current GCC implementation with regard
13404 to cryptography and related functions as follows:
13405 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13406 - The remaining ones are only available on Power8 and up so
13407   require -mpower8-vector
13408 The justification for this is that export requirements require that
13409 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13410 support). As a result, we need to be able to turn off support for those.
13411 The remaining ones (currently controlled by -mcrypto for GCC) still
13412 need to be provided on compliant hardware even if Vector.Crypto is not
13413 provided.
13414 FIXME: the naming convention for the builtins will be adjusted due
13415 to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
13416 removed with -mno-crypto). This is under development.
13417 */
13418 #ifdef __CRYPTO__
13419 static vector unsigned long long __attribute__((__always_inline__))
13420 __builtin_crypto_vsbox(vector unsigned long long __a) {
13421   return __builtin_altivec_crypto_vsbox(__a);
13422 }
13423
13424 static vector unsigned long long __attribute__((__always_inline__))
13425 __builtin_crypto_vcipher(vector unsigned long long __a,
13426                          vector unsigned long long __b) {
13427   return __builtin_altivec_crypto_vcipher(__a, __b);
13428 }
13429
13430 static vector unsigned long long __attribute__((__always_inline__))
13431 __builtin_crypto_vcipherlast(vector unsigned long long __a,
13432                              vector unsigned long long __b) {
13433   return __builtin_altivec_crypto_vcipherlast(__a, __b);
13434 }
13435
13436 static vector unsigned long long __attribute__((__always_inline__))
13437 __builtin_crypto_vncipher(vector unsigned long long __a,
13438                           vector unsigned long long __b) {
13439   return __builtin_altivec_crypto_vncipher(__a, __b);
13440 }
13441
13442 static vector unsigned long long __attribute__((__always_inline__))
13443 __builtin_crypto_vncipherlast(vector unsigned long long __a,
13444                               vector unsigned long long __b) {
13445   return __builtin_altivec_crypto_vncipherlast(__a, __b);
13446 }
13447
13448 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13449 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13450 #endif
13451
13452 #ifdef __POWER8_VECTOR__
13453 static vector unsigned char __ATTRS_o_ai
13454 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
13455                           vector unsigned char __c) {
13456   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13457 }
13458
13459 static vector unsigned short __ATTRS_o_ai
13460 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
13461                           vector unsigned short __c) {
13462   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
13463       (vector unsigned char)__a, (vector unsigned char)__b,
13464       (vector unsigned char)__c);
13465 }
13466
13467 static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
13468     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
13469   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
13470       (vector unsigned char)__a, (vector unsigned char)__b,
13471       (vector unsigned char)__c);
13472 }
13473
13474 static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
13475     vector unsigned long long __a, vector unsigned long long __b,
13476     vector unsigned long long __c) {
13477   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
13478       (vector unsigned char)__a, (vector unsigned char)__b,
13479       (vector unsigned char)__c);
13480 }
13481
13482 static vector unsigned char __ATTRS_o_ai
13483 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
13484   return __builtin_altivec_crypto_vpmsumb(__a, __b);
13485 }
13486
13487 static vector unsigned short __ATTRS_o_ai
13488 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
13489   return __builtin_altivec_crypto_vpmsumh(__a, __b);
13490 }
13491
13492 static vector unsigned int __ATTRS_o_ai
13493 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
13494   return __builtin_altivec_crypto_vpmsumw(__a, __b);
13495 }
13496
13497 static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpmsumb(
13498     vector unsigned long long __a, vector unsigned long long __b) {
13499   return __builtin_altivec_crypto_vpmsumd(__a, __b);
13500 }
13501
13502 static vector signed char __ATTRS_o_ai vec_vgbbd (vector signed char __a)
13503 {
13504   return __builtin_altivec_vgbbd((vector unsigned char) __a);
13505 }
13506
13507 static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a)
13508 {
13509   return __builtin_altivec_vgbbd(__a);
13510 }
13511
13512 static vector long long __ATTRS_o_ai
13513 vec_vbpermq (vector signed char __a, vector signed char __b)
13514 {
13515   return __builtin_altivec_vbpermq((vector unsigned char) __a,
13516                                    (vector unsigned char) __b);
13517 }
13518
13519 static vector long long __ATTRS_o_ai
13520 vec_vbpermq (vector unsigned char __a, vector unsigned char __b)
13521 {
13522   return __builtin_altivec_vbpermq(__a, __b);
13523 }
13524 #endif
13525
13526 #undef __ATTRS_o_ai
13527
13528 #endif /* __ALTIVEC_H */