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