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
39static __inline__ vector signed char __ATTRS_o_ai vec_perm(
40    vector signed char __a, vector signed char __b, vector unsigned char __c);
41
42static __inline__ vector unsigned char __ATTRS_o_ai
43vec_perm(vector unsigned char __a, vector unsigned char __b,
44         vector unsigned char __c);
45
46static __inline__ vector bool char __ATTRS_o_ai
47vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
48
49static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
50                                                     vector signed short __b,
51                                                     vector unsigned char __c);
52
53static __inline__ vector unsigned short __ATTRS_o_ai
54vec_perm(vector unsigned short __a, vector unsigned short __b,
55         vector unsigned char __c);
56
57static __inline__ vector bool short __ATTRS_o_ai vec_perm(
58    vector bool short __a, vector bool short __b, vector unsigned char __c);
59
60static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
61                                                     vector pixel __b,
62                                                     vector unsigned char __c);
63
64static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
65                                                   vector signed int __b,
66                                                   vector unsigned char __c);
67
68static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
69    vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
70
71static __inline__ vector bool int __ATTRS_o_ai
72vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
73
74static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
75                                                     vector float __b,
76                                                     vector unsigned char __c);
77
78#ifdef __VSX__
79static __inline__ vector long long __ATTRS_o_ai
80vec_perm(vector signed long long __a, vector signed long long __b,
81         vector unsigned char __c);
82
83static __inline__ vector unsigned long long __ATTRS_o_ai
84vec_perm(vector unsigned long long __a, vector unsigned long long __b,
85         vector unsigned char __c);
86
87static __inline__ vector bool long long __ATTRS_o_ai
88vec_perm(vector bool long long __a, vector bool long long __b,
89         vector unsigned char __c);
90
91static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
92                                                      vector double __b,
93                                                      vector unsigned char __c);
94#endif
95
96static __inline__ vector unsigned char __ATTRS_o_ai
97vec_xor(vector unsigned char __a, vector unsigned char __b);
98
99/* vec_abs */
100
101#define __builtin_altivec_abs_v16qi vec_abs
102#define __builtin_altivec_abs_v8hi vec_abs
103#define __builtin_altivec_abs_v4si vec_abs
104
105static __inline__ vector signed char __ATTRS_o_ai
106vec_abs(vector signed char __a) {
107  return __builtin_altivec_vmaxsb(__a, -__a);
108}
109
110static __inline__ vector signed short __ATTRS_o_ai
111vec_abs(vector signed short __a) {
112  return __builtin_altivec_vmaxsh(__a, -__a);
113}
114
115static __inline__ vector signed int __ATTRS_o_ai
116vec_abs(vector signed int __a) {
117  return __builtin_altivec_vmaxsw(__a, -__a);
118}
119
120#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
121static __inline__ vector signed long long __ATTRS_o_ai
122vec_abs(vector signed long long __a) {
123  return __builtin_altivec_vmaxsd(__a, -__a);
124}
125#endif
126
127static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
128#ifdef __VSX__
129  return __builtin_vsx_xvabssp(__a);
130#else
131  vector unsigned int __res =
132      (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
133  return (vector float)__res;
134#endif
135}
136
137#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
138static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
139  return __builtin_vsx_xvabsdp(__a);
140}
141#endif
142
143/* vec_abss */
144#define __builtin_altivec_abss_v16qi vec_abss
145#define __builtin_altivec_abss_v8hi vec_abss
146#define __builtin_altivec_abss_v4si vec_abss
147
148static __inline__ vector signed char __ATTRS_o_ai
149vec_abss(vector signed char __a) {
150  return __builtin_altivec_vmaxsb(
151      __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
152}
153
154static __inline__ vector signed short __ATTRS_o_ai
155vec_abss(vector signed short __a) {
156  return __builtin_altivec_vmaxsh(
157      __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
158}
159
160static __inline__ vector signed int __ATTRS_o_ai
161vec_abss(vector signed int __a) {
162  return __builtin_altivec_vmaxsw(
163      __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
164}
165
166/* vec_absd */
167#if defined(__POWER9_VECTOR__)
168
169static __inline__ vector unsigned char __ATTRS_o_ai
170vec_absd(vector unsigned char __a, vector unsigned char __b) {
171  return __builtin_altivec_vabsdub(__a, __b);
172}
173
174static __inline__ vector unsigned short __ATTRS_o_ai
175vec_absd(vector unsigned short __a, vector unsigned short __b) {
176  return __builtin_altivec_vabsduh(__a, __b);
177}
178
179static __inline__ vector unsigned int __ATTRS_o_ai
180vec_absd(vector unsigned int __a,  vector unsigned int __b) {
181  return __builtin_altivec_vabsduw(__a, __b);
182}
183
184#endif /* End __POWER9_VECTOR__ */
185
186/* vec_add */
187
188static __inline__ vector signed char __ATTRS_o_ai
189vec_add(vector signed char __a, vector signed char __b) {
190  return __a + __b;
191}
192
193static __inline__ vector signed char __ATTRS_o_ai
194vec_add(vector bool char __a, vector signed char __b) {
195  return (vector signed char)__a + __b;
196}
197
198static __inline__ vector signed char __ATTRS_o_ai
199vec_add(vector signed char __a, vector bool char __b) {
200  return __a + (vector signed char)__b;
201}
202
203static __inline__ vector unsigned char __ATTRS_o_ai
204vec_add(vector unsigned char __a, vector unsigned char __b) {
205  return __a + __b;
206}
207
208static __inline__ vector unsigned char __ATTRS_o_ai
209vec_add(vector bool char __a, vector unsigned char __b) {
210  return (vector unsigned char)__a + __b;
211}
212
213static __inline__ vector unsigned char __ATTRS_o_ai
214vec_add(vector unsigned char __a, vector bool char __b) {
215  return __a + (vector unsigned char)__b;
216}
217
218static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
219                                                    vector short __b) {
220  return __a + __b;
221}
222
223static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
224                                                    vector short __b) {
225  return (vector short)__a + __b;
226}
227
228static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
229                                                    vector bool short __b) {
230  return __a + (vector short)__b;
231}
232
233static __inline__ vector unsigned short __ATTRS_o_ai
234vec_add(vector unsigned short __a, vector unsigned short __b) {
235  return __a + __b;
236}
237
238static __inline__ vector unsigned short __ATTRS_o_ai
239vec_add(vector bool short __a, vector unsigned short __b) {
240  return (vector unsigned short)__a + __b;
241}
242
243static __inline__ vector unsigned short __ATTRS_o_ai
244vec_add(vector unsigned short __a, vector bool short __b) {
245  return __a + (vector unsigned short)__b;
246}
247
248static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
249                                                  vector int __b) {
250  return __a + __b;
251}
252
253static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
254                                                  vector int __b) {
255  return (vector int)__a + __b;
256}
257
258static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
259                                                  vector bool int __b) {
260  return __a + (vector int)__b;
261}
262
263static __inline__ vector unsigned int __ATTRS_o_ai
264vec_add(vector unsigned int __a, vector unsigned int __b) {
265  return __a + __b;
266}
267
268static __inline__ vector unsigned int __ATTRS_o_ai
269vec_add(vector bool int __a, vector unsigned int __b) {
270  return (vector unsigned int)__a + __b;
271}
272
273static __inline__ vector unsigned int __ATTRS_o_ai
274vec_add(vector unsigned int __a, vector bool int __b) {
275  return __a + (vector unsigned int)__b;
276}
277
278#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
279static __inline__ vector signed long long __ATTRS_o_ai
280vec_add(vector signed long long __a, vector signed long long __b) {
281  return __a + __b;
282}
283
284static __inline__ vector unsigned long long __ATTRS_o_ai
285vec_add(vector unsigned long long __a, vector unsigned long long __b) {
286  return __a + __b;
287}
288
289static __inline__ vector signed __int128 __ATTRS_o_ai
290vec_add(vector signed __int128 __a, vector signed __int128 __b) {
291  return __a + __b;
292}
293
294static __inline__ vector unsigned __int128 __ATTRS_o_ai
295vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
296  return __a + __b;
297}
298#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
299
300static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
301                                                    vector float __b) {
302  return __a + __b;
303}
304
305#ifdef __VSX__
306static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
307                                                     vector double __b) {
308  return __a + __b;
309}
310#endif // __VSX__
311
312/* vec_adde */
313
314#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
315static __inline__ vector signed __int128 __ATTRS_o_ai
316vec_adde(vector signed __int128 __a, vector signed __int128 __b,
317         vector signed __int128 __c) {
318  return __builtin_altivec_vaddeuqm(__a, __b, __c);
319}
320
321static __inline__ vector unsigned __int128 __ATTRS_o_ai
322vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
323         vector unsigned __int128 __c) {
324  return __builtin_altivec_vaddeuqm(__a, __b, __c);
325}
326#endif
327
328/* vec_addec */
329
330#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
331static __inline__ vector signed __int128 __ATTRS_o_ai
332vec_addec(vector signed __int128 __a, vector signed __int128 __b,
333          vector signed __int128 __c) {
334  return __builtin_altivec_vaddecuq(__a, __b, __c);
335}
336
337static __inline__ vector unsigned __int128 __ATTRS_o_ai
338vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
339          vector unsigned __int128 __c) {
340  return __builtin_altivec_vaddecuq(__a, __b, __c);
341}
342#endif
343
344/* vec_vaddubm */
345
346#define __builtin_altivec_vaddubm vec_vaddubm
347
348static __inline__ vector signed char __ATTRS_o_ai
349vec_vaddubm(vector signed char __a, vector signed char __b) {
350  return __a + __b;
351}
352
353static __inline__ vector signed char __ATTRS_o_ai
354vec_vaddubm(vector bool char __a, vector signed char __b) {
355  return (vector signed char)__a + __b;
356}
357
358static __inline__ vector signed char __ATTRS_o_ai
359vec_vaddubm(vector signed char __a, vector bool char __b) {
360  return __a + (vector signed char)__b;
361}
362
363static __inline__ vector unsigned char __ATTRS_o_ai
364vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
365  return __a + __b;
366}
367
368static __inline__ vector unsigned char __ATTRS_o_ai
369vec_vaddubm(vector bool char __a, vector unsigned char __b) {
370  return (vector unsigned char)__a + __b;
371}
372
373static __inline__ vector unsigned char __ATTRS_o_ai
374vec_vaddubm(vector unsigned char __a, vector bool char __b) {
375  return __a + (vector unsigned char)__b;
376}
377
378/* vec_vadduhm */
379
380#define __builtin_altivec_vadduhm vec_vadduhm
381
382static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
383                                                        vector short __b) {
384  return __a + __b;
385}
386
387static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
388                                                        vector short __b) {
389  return (vector short)__a + __b;
390}
391
392static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
393                                                        vector bool short __b) {
394  return __a + (vector short)__b;
395}
396
397static __inline__ vector unsigned short __ATTRS_o_ai
398vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
399  return __a + __b;
400}
401
402static __inline__ vector unsigned short __ATTRS_o_ai
403vec_vadduhm(vector bool short __a, vector unsigned short __b) {
404  return (vector unsigned short)__a + __b;
405}
406
407static __inline__ vector unsigned short __ATTRS_o_ai
408vec_vadduhm(vector unsigned short __a, vector bool short __b) {
409  return __a + (vector unsigned short)__b;
410}
411
412/* vec_vadduwm */
413
414#define __builtin_altivec_vadduwm vec_vadduwm
415
416static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
417                                                      vector int __b) {
418  return __a + __b;
419}
420
421static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
422                                                      vector int __b) {
423  return (vector int)__a + __b;
424}
425
426static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
427                                                      vector bool int __b) {
428  return __a + (vector int)__b;
429}
430
431static __inline__ vector unsigned int __ATTRS_o_ai
432vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
433  return __a + __b;
434}
435
436static __inline__ vector unsigned int __ATTRS_o_ai
437vec_vadduwm(vector bool int __a, vector unsigned int __b) {
438  return (vector unsigned int)__a + __b;
439}
440
441static __inline__ vector unsigned int __ATTRS_o_ai
442vec_vadduwm(vector unsigned int __a, vector bool int __b) {
443  return __a + (vector unsigned int)__b;
444}
445
446/* vec_vaddfp */
447
448#define __builtin_altivec_vaddfp vec_vaddfp
449
450static __inline__ vector float __attribute__((__always_inline__))
451vec_vaddfp(vector float __a, vector float __b) {
452  return __a + __b;
453}
454
455/* vec_addc */
456
457static __inline__ vector signed int __ATTRS_o_ai
458vec_addc(vector signed int __a, vector signed int __b) {
459  return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
460                                                      (vector unsigned int)__b);
461}
462
463static __inline__ vector unsigned int __ATTRS_o_ai
464vec_addc(vector unsigned int __a, vector unsigned int __b) {
465  return __builtin_altivec_vaddcuw(__a, __b);
466}
467
468#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
469static __inline__ vector signed __int128 __ATTRS_o_ai
470vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
471  return (vector signed __int128)__builtin_altivec_vaddcuq(
472      (vector unsigned __int128)__a, (vector unsigned __int128)__b);
473}
474
475static __inline__ vector unsigned __int128 __ATTRS_o_ai
476vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
477  return __builtin_altivec_vaddcuq(__a, __b);
478}
479#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
480
481/* vec_vaddcuw */
482
483static __inline__ vector unsigned int __attribute__((__always_inline__))
484vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
485  return __builtin_altivec_vaddcuw(__a, __b);
486}
487
488/* vec_adds */
489
490static __inline__ vector signed char __ATTRS_o_ai
491vec_adds(vector signed char __a, vector signed char __b) {
492  return __builtin_altivec_vaddsbs(__a, __b);
493}
494
495static __inline__ vector signed char __ATTRS_o_ai
496vec_adds(vector bool char __a, vector signed char __b) {
497  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
498}
499
500static __inline__ vector signed char __ATTRS_o_ai
501vec_adds(vector signed char __a, vector bool char __b) {
502  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
503}
504
505static __inline__ vector unsigned char __ATTRS_o_ai
506vec_adds(vector unsigned char __a, vector unsigned char __b) {
507  return __builtin_altivec_vaddubs(__a, __b);
508}
509
510static __inline__ vector unsigned char __ATTRS_o_ai
511vec_adds(vector bool char __a, vector unsigned char __b) {
512  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
513}
514
515static __inline__ vector unsigned char __ATTRS_o_ai
516vec_adds(vector unsigned char __a, vector bool char __b) {
517  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
518}
519
520static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
521                                                     vector short __b) {
522  return __builtin_altivec_vaddshs(__a, __b);
523}
524
525static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
526                                                     vector short __b) {
527  return __builtin_altivec_vaddshs((vector short)__a, __b);
528}
529
530static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
531                                                     vector bool short __b) {
532  return __builtin_altivec_vaddshs(__a, (vector short)__b);
533}
534
535static __inline__ vector unsigned short __ATTRS_o_ai
536vec_adds(vector unsigned short __a, vector unsigned short __b) {
537  return __builtin_altivec_vadduhs(__a, __b);
538}
539
540static __inline__ vector unsigned short __ATTRS_o_ai
541vec_adds(vector bool short __a, vector unsigned short __b) {
542  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
543}
544
545static __inline__ vector unsigned short __ATTRS_o_ai
546vec_adds(vector unsigned short __a, vector bool short __b) {
547  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
548}
549
550static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
551                                                   vector int __b) {
552  return __builtin_altivec_vaddsws(__a, __b);
553}
554
555static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
556                                                   vector int __b) {
557  return __builtin_altivec_vaddsws((vector int)__a, __b);
558}
559
560static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
561                                                   vector bool int __b) {
562  return __builtin_altivec_vaddsws(__a, (vector int)__b);
563}
564
565static __inline__ vector unsigned int __ATTRS_o_ai
566vec_adds(vector unsigned int __a, vector unsigned int __b) {
567  return __builtin_altivec_vadduws(__a, __b);
568}
569
570static __inline__ vector unsigned int __ATTRS_o_ai
571vec_adds(vector bool int __a, vector unsigned int __b) {
572  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
573}
574
575static __inline__ vector unsigned int __ATTRS_o_ai
576vec_adds(vector unsigned int __a, vector bool int __b) {
577  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
578}
579
580/* vec_vaddsbs */
581
582static __inline__ vector signed char __ATTRS_o_ai
583vec_vaddsbs(vector signed char __a, vector signed char __b) {
584  return __builtin_altivec_vaddsbs(__a, __b);
585}
586
587static __inline__ vector signed char __ATTRS_o_ai
588vec_vaddsbs(vector bool char __a, vector signed char __b) {
589  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
590}
591
592static __inline__ vector signed char __ATTRS_o_ai
593vec_vaddsbs(vector signed char __a, vector bool char __b) {
594  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
595}
596
597/* vec_vaddubs */
598
599static __inline__ vector unsigned char __ATTRS_o_ai
600vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
601  return __builtin_altivec_vaddubs(__a, __b);
602}
603
604static __inline__ vector unsigned char __ATTRS_o_ai
605vec_vaddubs(vector bool char __a, vector unsigned char __b) {
606  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
607}
608
609static __inline__ vector unsigned char __ATTRS_o_ai
610vec_vaddubs(vector unsigned char __a, vector bool char __b) {
611  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
612}
613
614/* vec_vaddshs */
615
616static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
617                                                        vector short __b) {
618  return __builtin_altivec_vaddshs(__a, __b);
619}
620
621static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
622                                                        vector short __b) {
623  return __builtin_altivec_vaddshs((vector short)__a, __b);
624}
625
626static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
627                                                        vector bool short __b) {
628  return __builtin_altivec_vaddshs(__a, (vector short)__b);
629}
630
631/* vec_vadduhs */
632
633static __inline__ vector unsigned short __ATTRS_o_ai
634vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
635  return __builtin_altivec_vadduhs(__a, __b);
636}
637
638static __inline__ vector unsigned short __ATTRS_o_ai
639vec_vadduhs(vector bool short __a, vector unsigned short __b) {
640  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
641}
642
643static __inline__ vector unsigned short __ATTRS_o_ai
644vec_vadduhs(vector unsigned short __a, vector bool short __b) {
645  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
646}
647
648/* vec_vaddsws */
649
650static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
651                                                      vector int __b) {
652  return __builtin_altivec_vaddsws(__a, __b);
653}
654
655static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
656                                                      vector int __b) {
657  return __builtin_altivec_vaddsws((vector int)__a, __b);
658}
659
660static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
661                                                      vector bool int __b) {
662  return __builtin_altivec_vaddsws(__a, (vector int)__b);
663}
664
665/* vec_vadduws */
666
667static __inline__ vector unsigned int __ATTRS_o_ai
668vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
669  return __builtin_altivec_vadduws(__a, __b);
670}
671
672static __inline__ vector unsigned int __ATTRS_o_ai
673vec_vadduws(vector bool int __a, vector unsigned int __b) {
674  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
675}
676
677static __inline__ vector unsigned int __ATTRS_o_ai
678vec_vadduws(vector unsigned int __a, vector bool int __b) {
679  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
680}
681
682#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
683/* vec_vadduqm */
684
685static __inline__ vector signed __int128 __ATTRS_o_ai
686vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
687  return __a + __b;
688}
689
690static __inline__ vector unsigned __int128 __ATTRS_o_ai
691vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
692  return __a + __b;
693}
694
695/* vec_vaddeuqm */
696
697static __inline__ vector signed __int128 __ATTRS_o_ai
698vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
699             vector signed __int128 __c) {
700  return __builtin_altivec_vaddeuqm(__a, __b, __c);
701}
702
703static __inline__ vector unsigned __int128 __ATTRS_o_ai
704vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
705             vector unsigned __int128 __c) {
706  return __builtin_altivec_vaddeuqm(__a, __b, __c);
707}
708
709/* vec_vaddcuq */
710
711static __inline__ vector signed __int128 __ATTRS_o_ai
712vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
713  return __builtin_altivec_vaddcuq(__a, __b);
714}
715
716static __inline__ vector unsigned __int128 __ATTRS_o_ai
717vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
718  return __builtin_altivec_vaddcuq(__a, __b);
719}
720
721/* vec_vaddecuq */
722
723static __inline__ vector signed __int128 __ATTRS_o_ai
724vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
725             vector signed __int128 __c) {
726  return __builtin_altivec_vaddecuq(__a, __b, __c);
727}
728
729static __inline__ vector unsigned __int128 __ATTRS_o_ai
730vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
731             vector unsigned __int128 __c) {
732  return __builtin_altivec_vaddecuq(__a, __b, __c);
733}
734#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
735
736/* vec_and */
737
738#define __builtin_altivec_vand vec_and
739
740static __inline__ vector signed char __ATTRS_o_ai
741vec_and(vector signed char __a, vector signed char __b) {
742  return __a & __b;
743}
744
745static __inline__ vector signed char __ATTRS_o_ai
746vec_and(vector bool char __a, vector signed char __b) {
747  return (vector signed char)__a & __b;
748}
749
750static __inline__ vector signed char __ATTRS_o_ai
751vec_and(vector signed char __a, vector bool char __b) {
752  return __a & (vector signed char)__b;
753}
754
755static __inline__ vector unsigned char __ATTRS_o_ai
756vec_and(vector unsigned char __a, vector unsigned char __b) {
757  return __a & __b;
758}
759
760static __inline__ vector unsigned char __ATTRS_o_ai
761vec_and(vector bool char __a, vector unsigned char __b) {
762  return (vector unsigned char)__a & __b;
763}
764
765static __inline__ vector unsigned char __ATTRS_o_ai
766vec_and(vector unsigned char __a, vector bool char __b) {
767  return __a & (vector unsigned char)__b;
768}
769
770static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
771                                                        vector bool char __b) {
772  return __a & __b;
773}
774
775static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
776                                                    vector short __b) {
777  return __a & __b;
778}
779
780static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
781                                                    vector short __b) {
782  return (vector short)__a & __b;
783}
784
785static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
786                                                    vector bool short __b) {
787  return __a & (vector short)__b;
788}
789
790static __inline__ vector unsigned short __ATTRS_o_ai
791vec_and(vector unsigned short __a, vector unsigned short __b) {
792  return __a & __b;
793}
794
795static __inline__ vector unsigned short __ATTRS_o_ai
796vec_and(vector bool short __a, vector unsigned short __b) {
797  return (vector unsigned short)__a & __b;
798}
799
800static __inline__ vector unsigned short __ATTRS_o_ai
801vec_and(vector unsigned short __a, vector bool short __b) {
802  return __a & (vector unsigned short)__b;
803}
804
805static __inline__ vector bool short __ATTRS_o_ai
806vec_and(vector bool short __a, vector bool short __b) {
807  return __a & __b;
808}
809
810static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
811                                                  vector int __b) {
812  return __a & __b;
813}
814
815static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
816                                                  vector int __b) {
817  return (vector int)__a & __b;
818}
819
820static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
821                                                  vector bool int __b) {
822  return __a & (vector int)__b;
823}
824
825static __inline__ vector unsigned int __ATTRS_o_ai
826vec_and(vector unsigned int __a, vector unsigned int __b) {
827  return __a & __b;
828}
829
830static __inline__ vector unsigned int __ATTRS_o_ai
831vec_and(vector bool int __a, vector unsigned int __b) {
832  return (vector unsigned int)__a & __b;
833}
834
835static __inline__ vector unsigned int __ATTRS_o_ai
836vec_and(vector unsigned int __a, vector bool int __b) {
837  return __a & (vector unsigned int)__b;
838}
839
840static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
841                                                       vector bool int __b) {
842  return __a & __b;
843}
844
845static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
846                                                    vector float __b) {
847  vector unsigned int __res =
848      (vector unsigned int)__a & (vector unsigned int)__b;
849  return (vector float)__res;
850}
851
852static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
853                                                    vector float __b) {
854  vector unsigned int __res =
855      (vector unsigned int)__a & (vector unsigned int)__b;
856  return (vector float)__res;
857}
858
859static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
860                                                    vector bool int __b) {
861  vector unsigned int __res =
862      (vector unsigned int)__a & (vector unsigned int)__b;
863  return (vector float)__res;
864}
865
866#ifdef __VSX__
867static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
868                                                     vector double __b) {
869  vector unsigned long long __res =
870      (vector unsigned long long)__a & (vector unsigned long long)__b;
871  return (vector double)__res;
872}
873
874static __inline__ vector double __ATTRS_o_ai
875vec_and(vector double __a, vector bool long long __b) {
876  vector unsigned long long __res =
877      (vector unsigned long long)__a & (vector unsigned long long)__b;
878  return (vector double)__res;
879}
880
881static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
882                                                     vector double __b) {
883  vector unsigned long long __res =
884      (vector unsigned long long)__a & (vector unsigned long long)__b;
885  return (vector double)__res;
886}
887
888static __inline__ vector signed long long __ATTRS_o_ai
889vec_and(vector signed long long __a, vector signed long long __b) {
890  return __a & __b;
891}
892
893static __inline__ vector signed long long __ATTRS_o_ai
894vec_and(vector bool long long __a, vector signed long long __b) {
895  return (vector signed long long)__a & __b;
896}
897
898static __inline__ vector signed long long __ATTRS_o_ai
899vec_and(vector signed long long __a, vector bool long long __b) {
900  return __a & (vector signed long long)__b;
901}
902
903static __inline__ vector unsigned long long __ATTRS_o_ai
904vec_and(vector unsigned long long __a, vector unsigned long long __b) {
905  return __a & __b;
906}
907
908static __inline__ vector unsigned long long __ATTRS_o_ai
909vec_and(vector bool long long __a, vector unsigned long long __b) {
910  return (vector unsigned long long)__a & __b;
911}
912
913static __inline__ vector unsigned long long __ATTRS_o_ai
914vec_and(vector unsigned long long __a, vector bool long long __b) {
915  return __a & (vector unsigned long long)__b;
916}
917
918static __inline__ vector bool long long __ATTRS_o_ai
919vec_and(vector bool long long __a, vector bool long long __b) {
920  return __a & __b;
921}
922#endif
923
924/* vec_vand */
925
926static __inline__ vector signed char __ATTRS_o_ai
927vec_vand(vector signed char __a, vector signed char __b) {
928  return __a & __b;
929}
930
931static __inline__ vector signed char __ATTRS_o_ai
932vec_vand(vector bool char __a, vector signed char __b) {
933  return (vector signed char)__a & __b;
934}
935
936static __inline__ vector signed char __ATTRS_o_ai
937vec_vand(vector signed char __a, vector bool char __b) {
938  return __a & (vector signed char)__b;
939}
940
941static __inline__ vector unsigned char __ATTRS_o_ai
942vec_vand(vector unsigned char __a, vector unsigned char __b) {
943  return __a & __b;
944}
945
946static __inline__ vector unsigned char __ATTRS_o_ai
947vec_vand(vector bool char __a, vector unsigned char __b) {
948  return (vector unsigned char)__a & __b;
949}
950
951static __inline__ vector unsigned char __ATTRS_o_ai
952vec_vand(vector unsigned char __a, vector bool char __b) {
953  return __a & (vector unsigned char)__b;
954}
955
956static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
957                                                         vector bool char __b) {
958  return __a & __b;
959}
960
961static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
962                                                     vector short __b) {
963  return __a & __b;
964}
965
966static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
967                                                     vector short __b) {
968  return (vector short)__a & __b;
969}
970
971static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
972                                                     vector bool short __b) {
973  return __a & (vector short)__b;
974}
975
976static __inline__ vector unsigned short __ATTRS_o_ai
977vec_vand(vector unsigned short __a, vector unsigned short __b) {
978  return __a & __b;
979}
980
981static __inline__ vector unsigned short __ATTRS_o_ai
982vec_vand(vector bool short __a, vector unsigned short __b) {
983  return (vector unsigned short)__a & __b;
984}
985
986static __inline__ vector unsigned short __ATTRS_o_ai
987vec_vand(vector unsigned short __a, vector bool short __b) {
988  return __a & (vector unsigned short)__b;
989}
990
991static __inline__ vector bool short __ATTRS_o_ai
992vec_vand(vector bool short __a, vector bool short __b) {
993  return __a & __b;
994}
995
996static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
997                                                   vector int __b) {
998  return __a & __b;
999}
1000
1001static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1002                                                   vector int __b) {
1003  return (vector int)__a & __b;
1004}
1005
1006static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1007                                                   vector bool int __b) {
1008  return __a & (vector int)__b;
1009}
1010
1011static __inline__ vector unsigned int __ATTRS_o_ai
1012vec_vand(vector unsigned int __a, vector unsigned int __b) {
1013  return __a & __b;
1014}
1015
1016static __inline__ vector unsigned int __ATTRS_o_ai
1017vec_vand(vector bool int __a, vector unsigned int __b) {
1018  return (vector unsigned int)__a & __b;
1019}
1020
1021static __inline__ vector unsigned int __ATTRS_o_ai
1022vec_vand(vector unsigned int __a, vector bool int __b) {
1023  return __a & (vector unsigned int)__b;
1024}
1025
1026static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1027                                                        vector bool int __b) {
1028  return __a & __b;
1029}
1030
1031static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1032                                                     vector float __b) {
1033  vector unsigned int __res =
1034      (vector unsigned int)__a & (vector unsigned int)__b;
1035  return (vector float)__res;
1036}
1037
1038static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1039                                                     vector float __b) {
1040  vector unsigned int __res =
1041      (vector unsigned int)__a & (vector unsigned int)__b;
1042  return (vector float)__res;
1043}
1044
1045static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1046                                                     vector bool int __b) {
1047  vector unsigned int __res =
1048      (vector unsigned int)__a & (vector unsigned int)__b;
1049  return (vector float)__res;
1050}
1051
1052#ifdef __VSX__
1053static __inline__ vector signed long long __ATTRS_o_ai
1054vec_vand(vector signed long long __a, vector signed long long __b) {
1055  return __a & __b;
1056}
1057
1058static __inline__ vector signed long long __ATTRS_o_ai
1059vec_vand(vector bool long long __a, vector signed long long __b) {
1060  return (vector signed long long)__a & __b;
1061}
1062
1063static __inline__ vector signed long long __ATTRS_o_ai
1064vec_vand(vector signed long long __a, vector bool long long __b) {
1065  return __a & (vector signed long long)__b;
1066}
1067
1068static __inline__ vector unsigned long long __ATTRS_o_ai
1069vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1070  return __a & __b;
1071}
1072
1073static __inline__ vector unsigned long long __ATTRS_o_ai
1074vec_vand(vector bool long long __a, vector unsigned long long __b) {
1075  return (vector unsigned long long)__a & __b;
1076}
1077
1078static __inline__ vector unsigned long long __ATTRS_o_ai
1079vec_vand(vector unsigned long long __a, vector bool long long __b) {
1080  return __a & (vector unsigned long long)__b;
1081}
1082
1083static __inline__ vector bool long long __ATTRS_o_ai
1084vec_vand(vector bool long long __a, vector bool long long __b) {
1085  return __a & __b;
1086}
1087#endif
1088
1089/* vec_andc */
1090
1091#define __builtin_altivec_vandc vec_andc
1092
1093static __inline__ vector signed char __ATTRS_o_ai
1094vec_andc(vector signed char __a, vector signed char __b) {
1095  return __a & ~__b;
1096}
1097
1098static __inline__ vector signed char __ATTRS_o_ai
1099vec_andc(vector bool char __a, vector signed char __b) {
1100  return (vector signed char)__a & ~__b;
1101}
1102
1103static __inline__ vector signed char __ATTRS_o_ai
1104vec_andc(vector signed char __a, vector bool char __b) {
1105  return __a & ~(vector signed char)__b;
1106}
1107
1108static __inline__ vector unsigned char __ATTRS_o_ai
1109vec_andc(vector unsigned char __a, vector unsigned char __b) {
1110  return __a & ~__b;
1111}
1112
1113static __inline__ vector unsigned char __ATTRS_o_ai
1114vec_andc(vector bool char __a, vector unsigned char __b) {
1115  return (vector unsigned char)__a & ~__b;
1116}
1117
1118static __inline__ vector unsigned char __ATTRS_o_ai
1119vec_andc(vector unsigned char __a, vector bool char __b) {
1120  return __a & ~(vector unsigned char)__b;
1121}
1122
1123static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1124                                                         vector bool char __b) {
1125  return __a & ~__b;
1126}
1127
1128static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1129                                                     vector short __b) {
1130  return __a & ~__b;
1131}
1132
1133static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1134                                                     vector short __b) {
1135  return (vector short)__a & ~__b;
1136}
1137
1138static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1139                                                     vector bool short __b) {
1140  return __a & ~(vector short)__b;
1141}
1142
1143static __inline__ vector unsigned short __ATTRS_o_ai
1144vec_andc(vector unsigned short __a, vector unsigned short __b) {
1145  return __a & ~__b;
1146}
1147
1148static __inline__ vector unsigned short __ATTRS_o_ai
1149vec_andc(vector bool short __a, vector unsigned short __b) {
1150  return (vector unsigned short)__a & ~__b;
1151}
1152
1153static __inline__ vector unsigned short __ATTRS_o_ai
1154vec_andc(vector unsigned short __a, vector bool short __b) {
1155  return __a & ~(vector unsigned short)__b;
1156}
1157
1158static __inline__ vector bool short __ATTRS_o_ai
1159vec_andc(vector bool short __a, vector bool short __b) {
1160  return __a & ~__b;
1161}
1162
1163static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1164                                                   vector int __b) {
1165  return __a & ~__b;
1166}
1167
1168static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1169                                                   vector int __b) {
1170  return (vector int)__a & ~__b;
1171}
1172
1173static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1174                                                   vector bool int __b) {
1175  return __a & ~(vector int)__b;
1176}
1177
1178static __inline__ vector unsigned int __ATTRS_o_ai
1179vec_andc(vector unsigned int __a, vector unsigned int __b) {
1180  return __a & ~__b;
1181}
1182
1183static __inline__ vector unsigned int __ATTRS_o_ai
1184vec_andc(vector bool int __a, vector unsigned int __b) {
1185  return (vector unsigned int)__a & ~__b;
1186}
1187
1188static __inline__ vector unsigned int __ATTRS_o_ai
1189vec_andc(vector unsigned int __a, vector bool int __b) {
1190  return __a & ~(vector unsigned int)__b;
1191}
1192
1193static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1194                                                        vector bool int __b) {
1195  return __a & ~__b;
1196}
1197
1198static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1199                                                     vector float __b) {
1200  vector unsigned int __res =
1201      (vector unsigned int)__a & ~(vector unsigned int)__b;
1202  return (vector float)__res;
1203}
1204
1205static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1206                                                     vector float __b) {
1207  vector unsigned int __res =
1208      (vector unsigned int)__a & ~(vector unsigned int)__b;
1209  return (vector float)__res;
1210}
1211
1212static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1213                                                     vector bool int __b) {
1214  vector unsigned int __res =
1215      (vector unsigned int)__a & ~(vector unsigned int)__b;
1216  return (vector float)__res;
1217}
1218
1219#ifdef __VSX__
1220static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1221                                                      vector double __b) {
1222  vector unsigned long long __res =
1223      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1224  return (vector double)__res;
1225}
1226
1227static __inline__ vector double __ATTRS_o_ai
1228vec_andc(vector double __a, vector bool long long __b) {
1229  vector unsigned long long __res =
1230      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1231  return (vector double)__res;
1232}
1233
1234static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1235                                                      vector double __b) {
1236  vector unsigned long long __res =
1237      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1238  return (vector double)__res;
1239}
1240
1241static __inline__ vector signed long long __ATTRS_o_ai
1242vec_andc(vector signed long long __a, vector signed long long __b) {
1243  return __a & ~__b;
1244}
1245
1246static __inline__ vector signed long long __ATTRS_o_ai
1247vec_andc(vector bool long long __a, vector signed long long __b) {
1248  return (vector signed long long)__a & ~__b;
1249}
1250
1251static __inline__ vector signed long long __ATTRS_o_ai
1252vec_andc(vector signed long long __a, vector bool long long __b) {
1253  return __a & ~(vector signed long long)__b;
1254}
1255
1256static __inline__ vector unsigned long long __ATTRS_o_ai
1257vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1258  return __a & ~__b;
1259}
1260
1261static __inline__ vector unsigned long long __ATTRS_o_ai
1262vec_andc(vector bool long long __a, vector unsigned long long __b) {
1263  return (vector unsigned long long)__a & ~__b;
1264}
1265
1266static __inline__ vector unsigned long long __ATTRS_o_ai
1267vec_andc(vector unsigned long long __a, vector bool long long __b) {
1268  return __a & ~(vector unsigned long long)__b;
1269}
1270
1271static __inline__ vector bool long long __ATTRS_o_ai
1272vec_andc(vector bool long long __a, vector bool long long __b) {
1273  return __a & ~__b;
1274}
1275#endif
1276
1277/* vec_vandc */
1278
1279static __inline__ vector signed char __ATTRS_o_ai
1280vec_vandc(vector signed char __a, vector signed char __b) {
1281  return __a & ~__b;
1282}
1283
1284static __inline__ vector signed char __ATTRS_o_ai
1285vec_vandc(vector bool char __a, vector signed char __b) {
1286  return (vector signed char)__a & ~__b;
1287}
1288
1289static __inline__ vector signed char __ATTRS_o_ai
1290vec_vandc(vector signed char __a, vector bool char __b) {
1291  return __a & ~(vector signed char)__b;
1292}
1293
1294static __inline__ vector unsigned char __ATTRS_o_ai
1295vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1296  return __a & ~__b;
1297}
1298
1299static __inline__ vector unsigned char __ATTRS_o_ai
1300vec_vandc(vector bool char __a, vector unsigned char __b) {
1301  return (vector unsigned char)__a & ~__b;
1302}
1303
1304static __inline__ vector unsigned char __ATTRS_o_ai
1305vec_vandc(vector unsigned char __a, vector bool char __b) {
1306  return __a & ~(vector unsigned char)__b;
1307}
1308
1309static __inline__ vector bool char __ATTRS_o_ai
1310vec_vandc(vector bool char __a, vector bool char __b) {
1311  return __a & ~__b;
1312}
1313
1314static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1315                                                      vector short __b) {
1316  return __a & ~__b;
1317}
1318
1319static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1320                                                      vector short __b) {
1321  return (vector short)__a & ~__b;
1322}
1323
1324static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1325                                                      vector bool short __b) {
1326  return __a & ~(vector short)__b;
1327}
1328
1329static __inline__ vector unsigned short __ATTRS_o_ai
1330vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1331  return __a & ~__b;
1332}
1333
1334static __inline__ vector unsigned short __ATTRS_o_ai
1335vec_vandc(vector bool short __a, vector unsigned short __b) {
1336  return (vector unsigned short)__a & ~__b;
1337}
1338
1339static __inline__ vector unsigned short __ATTRS_o_ai
1340vec_vandc(vector unsigned short __a, vector bool short __b) {
1341  return __a & ~(vector unsigned short)__b;
1342}
1343
1344static __inline__ vector bool short __ATTRS_o_ai
1345vec_vandc(vector bool short __a, vector bool short __b) {
1346  return __a & ~__b;
1347}
1348
1349static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1350                                                    vector int __b) {
1351  return __a & ~__b;
1352}
1353
1354static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1355                                                    vector int __b) {
1356  return (vector int)__a & ~__b;
1357}
1358
1359static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1360                                                    vector bool int __b) {
1361  return __a & ~(vector int)__b;
1362}
1363
1364static __inline__ vector unsigned int __ATTRS_o_ai
1365vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1366  return __a & ~__b;
1367}
1368
1369static __inline__ vector unsigned int __ATTRS_o_ai
1370vec_vandc(vector bool int __a, vector unsigned int __b) {
1371  return (vector unsigned int)__a & ~__b;
1372}
1373
1374static __inline__ vector unsigned int __ATTRS_o_ai
1375vec_vandc(vector unsigned int __a, vector bool int __b) {
1376  return __a & ~(vector unsigned int)__b;
1377}
1378
1379static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1380                                                         vector bool int __b) {
1381  return __a & ~__b;
1382}
1383
1384static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1385                                                      vector float __b) {
1386  vector unsigned int __res =
1387      (vector unsigned int)__a & ~(vector unsigned int)__b;
1388  return (vector float)__res;
1389}
1390
1391static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1392                                                      vector float __b) {
1393  vector unsigned int __res =
1394      (vector unsigned int)__a & ~(vector unsigned int)__b;
1395  return (vector float)__res;
1396}
1397
1398static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1399                                                      vector bool int __b) {
1400  vector unsigned int __res =
1401      (vector unsigned int)__a & ~(vector unsigned int)__b;
1402  return (vector float)__res;
1403}
1404
1405#ifdef __VSX__
1406static __inline__ vector signed long long __ATTRS_o_ai
1407vec_vandc(vector signed long long __a, vector signed long long __b) {
1408  return __a & ~__b;
1409}
1410
1411static __inline__ vector signed long long __ATTRS_o_ai
1412vec_vandc(vector bool long long __a, vector signed long long __b) {
1413  return (vector signed long long)__a & ~__b;
1414}
1415
1416static __inline__ vector signed long long __ATTRS_o_ai
1417vec_vandc(vector signed long long __a, vector bool long long __b) {
1418  return __a & ~(vector signed long long)__b;
1419}
1420
1421static __inline__ vector unsigned long long __ATTRS_o_ai
1422vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1423  return __a & ~__b;
1424}
1425
1426static __inline__ vector unsigned long long __ATTRS_o_ai
1427vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1428  return (vector unsigned long long)__a & ~__b;
1429}
1430
1431static __inline__ vector unsigned long long __ATTRS_o_ai
1432vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1433  return __a & ~(vector unsigned long long)__b;
1434}
1435
1436static __inline__ vector bool long long __ATTRS_o_ai
1437vec_vandc(vector bool long long __a, vector bool long long __b) {
1438  return __a & ~__b;
1439}
1440#endif
1441
1442/* vec_avg */
1443
1444static __inline__ vector signed char __ATTRS_o_ai
1445vec_avg(vector signed char __a, vector signed char __b) {
1446  return __builtin_altivec_vavgsb(__a, __b);
1447}
1448
1449static __inline__ vector unsigned char __ATTRS_o_ai
1450vec_avg(vector unsigned char __a, vector unsigned char __b) {
1451  return __builtin_altivec_vavgub(__a, __b);
1452}
1453
1454static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1455                                                    vector short __b) {
1456  return __builtin_altivec_vavgsh(__a, __b);
1457}
1458
1459static __inline__ vector unsigned short __ATTRS_o_ai
1460vec_avg(vector unsigned short __a, vector unsigned short __b) {
1461  return __builtin_altivec_vavguh(__a, __b);
1462}
1463
1464static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1465                                                  vector int __b) {
1466  return __builtin_altivec_vavgsw(__a, __b);
1467}
1468
1469static __inline__ vector unsigned int __ATTRS_o_ai
1470vec_avg(vector unsigned int __a, vector unsigned int __b) {
1471  return __builtin_altivec_vavguw(__a, __b);
1472}
1473
1474/* vec_vavgsb */
1475
1476static __inline__ vector signed char __attribute__((__always_inline__))
1477vec_vavgsb(vector signed char __a, vector signed char __b) {
1478  return __builtin_altivec_vavgsb(__a, __b);
1479}
1480
1481/* vec_vavgub */
1482
1483static __inline__ vector unsigned char __attribute__((__always_inline__))
1484vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1485  return __builtin_altivec_vavgub(__a, __b);
1486}
1487
1488/* vec_vavgsh */
1489
1490static __inline__ vector short __attribute__((__always_inline__))
1491vec_vavgsh(vector short __a, vector short __b) {
1492  return __builtin_altivec_vavgsh(__a, __b);
1493}
1494
1495/* vec_vavguh */
1496
1497static __inline__ vector unsigned short __attribute__((__always_inline__))
1498vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1499  return __builtin_altivec_vavguh(__a, __b);
1500}
1501
1502/* vec_vavgsw */
1503
1504static __inline__ vector int __attribute__((__always_inline__))
1505vec_vavgsw(vector int __a, vector int __b) {
1506  return __builtin_altivec_vavgsw(__a, __b);
1507}
1508
1509/* vec_vavguw */
1510
1511static __inline__ vector unsigned int __attribute__((__always_inline__))
1512vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1513  return __builtin_altivec_vavguw(__a, __b);
1514}
1515
1516/* vec_ceil */
1517
1518static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1519#ifdef __VSX__
1520  return __builtin_vsx_xvrspip(__a);
1521#else
1522  return __builtin_altivec_vrfip(__a);
1523#endif
1524}
1525
1526#ifdef __VSX__
1527static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1528  return __builtin_vsx_xvrdpip(__a);
1529}
1530#endif
1531
1532/* vec_vrfip */
1533
1534static __inline__ vector float __attribute__((__always_inline__))
1535vec_vrfip(vector float __a) {
1536  return __builtin_altivec_vrfip(__a);
1537}
1538
1539/* vec_cmpb */
1540
1541static __inline__ vector int __attribute__((__always_inline__))
1542vec_cmpb(vector float __a, vector float __b) {
1543  return __builtin_altivec_vcmpbfp(__a, __b);
1544}
1545
1546/* vec_vcmpbfp */
1547
1548static __inline__ vector int __attribute__((__always_inline__))
1549vec_vcmpbfp(vector float __a, vector float __b) {
1550  return __builtin_altivec_vcmpbfp(__a, __b);
1551}
1552
1553/* vec_cmpeq */
1554
1555static __inline__ vector bool char __ATTRS_o_ai
1556vec_cmpeq(vector signed char __a, vector signed char __b) {
1557  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1558                                                      (vector char)__b);
1559}
1560
1561static __inline__ vector bool char __ATTRS_o_ai
1562vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1563  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1564                                                      (vector char)__b);
1565}
1566
1567static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1568                                                           vector short __b) {
1569  return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1570}
1571
1572static __inline__ vector bool short __ATTRS_o_ai
1573vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1574  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1575                                                       (vector short)__b);
1576}
1577
1578static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1579                                                         vector int __b) {
1580  return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1581}
1582
1583static __inline__ vector bool int __ATTRS_o_ai
1584vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1585  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1586                                                     (vector int)__b);
1587}
1588
1589#ifdef __POWER8_VECTOR__
1590static __inline__ vector bool long long __ATTRS_o_ai
1591vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1592  return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1593}
1594
1595static __inline__ vector bool long long __ATTRS_o_ai
1596vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1597  return (vector bool long long)__builtin_altivec_vcmpequd(
1598      (vector long long)__a, (vector long long)__b);
1599}
1600#endif
1601
1602static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1603                                                         vector float __b) {
1604#ifdef __VSX__
1605  return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1606#else
1607  return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1608#endif
1609}
1610
1611#ifdef __VSX__
1612static __inline__ vector bool long long __ATTRS_o_ai
1613vec_cmpeq(vector double __a, vector double __b) {
1614  return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1615}
1616#endif
1617
1618#ifdef __POWER9_VECTOR__
1619/* vec_cmpne */
1620
1621static __inline__ vector bool char __ATTRS_o_ai
1622vec_cmpne(vector bool char __a, vector bool char __b) {
1623  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1624                                                     (vector char)__b);
1625}
1626
1627static __inline__ vector bool char __ATTRS_o_ai
1628vec_cmpne(vector signed char __a, vector signed char __b) {
1629  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1630                                                     (vector char)__b);
1631}
1632
1633static __inline__ vector bool char __ATTRS_o_ai
1634vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1635  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1636                                                     (vector char)__b);
1637}
1638
1639static __inline__ vector bool short __ATTRS_o_ai
1640vec_cmpne(vector bool short __a, vector bool short __b) {
1641  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1642                                                      (vector short)__b);
1643}
1644
1645static __inline__ vector bool short __ATTRS_o_ai
1646vec_cmpne(vector signed short __a, vector signed short __b) {
1647  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1648                                                      (vector short)__b);
1649}
1650
1651static __inline__ vector bool short __ATTRS_o_ai
1652vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1653  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1654                                                      (vector short)__b);
1655}
1656
1657static __inline__ vector bool int __ATTRS_o_ai
1658vec_cmpne(vector bool int __a, vector bool int __b) {
1659  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1660                                                    (vector int)__b);
1661}
1662
1663static __inline__ vector bool int __ATTRS_o_ai
1664vec_cmpne(vector signed int __a, vector signed int __b) {
1665  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1666                                                    (vector int)__b);
1667}
1668
1669static __inline__ vector bool int __ATTRS_o_ai
1670vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1671  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1672                                                    (vector int)__b);
1673}
1674
1675static __inline__ vector bool long long __ATTRS_o_ai
1676vec_cmpne(vector bool long long __a, vector bool long long __b) {
1677  return (vector bool long long)
1678    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1679}
1680
1681static __inline__ vector bool long long __ATTRS_o_ai
1682vec_cmpne(vector signed long long __a, vector signed long long __b) {
1683  return (vector bool long long)
1684    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1685}
1686
1687static __inline__ vector bool long long __ATTRS_o_ai
1688vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
1689  return (vector bool long long)
1690    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1691}
1692
1693static __inline__ vector bool int __ATTRS_o_ai
1694vec_cmpne(vector float __a, vector float __b) {
1695  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1696                                                    (vector int)__b);
1697}
1698
1699static __inline__ vector bool long long __ATTRS_o_ai
1700vec_cmpne(vector double __a, vector double __b) {
1701  return (vector bool long long)
1702    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1703}
1704
1705/* vec_cmpnez */
1706
1707static __inline__ vector bool char __ATTRS_o_ai
1708vec_cmpnez(vector signed char __a, vector signed char __b) {
1709  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1710                                                      (vector char)__b);
1711}
1712
1713static __inline__ vector bool char __ATTRS_o_ai
1714vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1715  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1716                                                      (vector char)__b);
1717}
1718
1719static __inline__ vector bool short __ATTRS_o_ai
1720vec_cmpnez(vector signed short __a, vector signed short __b) {
1721  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1722                                                       (vector short)__b);
1723}
1724
1725static __inline__ vector bool short __ATTRS_o_ai
1726vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1727  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1728                                                       (vector short)__b);
1729}
1730
1731static __inline__ vector bool int __ATTRS_o_ai
1732vec_cmpnez(vector signed int __a, vector signed int __b) {
1733  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1734                                                     (vector int)__b);
1735}
1736
1737static __inline__ vector bool int __ATTRS_o_ai
1738vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1739  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1740                                                     (vector int)__b);
1741}
1742
1743static __inline__ signed int __ATTRS_o_ai
1744vec_cntlz_lsbb(vector signed char __a) {
1745#ifdef __LITTLE_ENDIAN__
1746  return __builtin_altivec_vctzlsbb(__a);
1747#else
1748  return __builtin_altivec_vclzlsbb(__a);
1749#endif
1750}
1751
1752static __inline__ signed int __ATTRS_o_ai
1753vec_cntlz_lsbb(vector unsigned char __a) {
1754#ifdef __LITTLE_ENDIAN__
1755  return __builtin_altivec_vctzlsbb(__a);
1756#else
1757  return __builtin_altivec_vclzlsbb(__a);
1758#endif
1759}
1760
1761static __inline__ signed int __ATTRS_o_ai
1762vec_cnttz_lsbb(vector signed char __a) {
1763#ifdef __LITTLE_ENDIAN__
1764  return __builtin_altivec_vclzlsbb(__a);
1765#else
1766  return __builtin_altivec_vctzlsbb(__a);
1767#endif
1768}
1769
1770static __inline__ signed int __ATTRS_o_ai
1771vec_cnttz_lsbb(vector unsigned char __a) {
1772#ifdef __LITTLE_ENDIAN__
1773  return __builtin_altivec_vclzlsbb(__a);
1774#else
1775  return __builtin_altivec_vctzlsbb(__a);
1776#endif
1777}
1778
1779static __inline__ vector unsigned int __ATTRS_o_ai
1780vec_parity_lsbb(vector unsigned int __a) {
1781  return __builtin_altivec_vprtybw(__a);
1782}
1783
1784static __inline__ vector unsigned int __ATTRS_o_ai
1785vec_parity_lsbb(vector signed int __a) {
1786  return __builtin_altivec_vprtybw(__a);
1787}
1788
1789static __inline__ vector unsigned __int128 __ATTRS_o_ai
1790vec_parity_lsbb(vector unsigned __int128 __a) {
1791  return __builtin_altivec_vprtybq(__a);
1792}
1793
1794static __inline__ vector unsigned __int128 __ATTRS_o_ai
1795vec_parity_lsbb(vector signed __int128 __a) {
1796  return __builtin_altivec_vprtybq(__a);
1797}
1798
1799static __inline__ vector unsigned long long __ATTRS_o_ai
1800vec_parity_lsbb(vector unsigned long long __a) {
1801  return __builtin_altivec_vprtybd(__a);
1802}
1803
1804static __inline__ vector unsigned long long __ATTRS_o_ai
1805vec_parity_lsbb(vector signed long long __a) {
1806  return __builtin_altivec_vprtybd(__a);
1807}
1808
1809#endif
1810
1811/* vec_cmpgt */
1812
1813static __inline__ vector bool char __ATTRS_o_ai
1814vec_cmpgt(vector signed char __a, vector signed char __b) {
1815  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1816}
1817
1818static __inline__ vector bool char __ATTRS_o_ai
1819vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1820  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1821}
1822
1823static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1824                                                           vector short __b) {
1825  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1826}
1827
1828static __inline__ vector bool short __ATTRS_o_ai
1829vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1830  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1831}
1832
1833static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1834                                                         vector int __b) {
1835  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1836}
1837
1838static __inline__ vector bool int __ATTRS_o_ai
1839vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1840  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1841}
1842
1843#ifdef __POWER8_VECTOR__
1844static __inline__ vector bool long long __ATTRS_o_ai
1845vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1846  return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1847}
1848
1849static __inline__ vector bool long long __ATTRS_o_ai
1850vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1851  return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1852}
1853#endif
1854
1855static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1856                                                         vector float __b) {
1857#ifdef __VSX__
1858  return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1859#else
1860  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1861#endif
1862}
1863
1864#ifdef __VSX__
1865static __inline__ vector bool long long __ATTRS_o_ai
1866vec_cmpgt(vector double __a, vector double __b) {
1867  return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1868}
1869#endif
1870
1871/* vec_cmpge */
1872
1873static __inline__ vector bool char __ATTRS_o_ai
1874vec_cmpge(vector signed char __a, vector signed char __b) {
1875  return ~(vec_cmpgt(__b, __a));
1876}
1877
1878static __inline__ vector bool char __ATTRS_o_ai
1879vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1880  return ~(vec_cmpgt(__b, __a));
1881}
1882
1883static __inline__ vector bool short __ATTRS_o_ai
1884vec_cmpge(vector signed short __a, vector signed short __b) {
1885  return ~(vec_cmpgt(__b, __a));
1886}
1887
1888static __inline__ vector bool short __ATTRS_o_ai
1889vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1890  return ~(vec_cmpgt(__b, __a));
1891}
1892
1893static __inline__ vector bool int __ATTRS_o_ai
1894vec_cmpge(vector signed int __a, vector signed int __b) {
1895  return ~(vec_cmpgt(__b, __a));
1896}
1897
1898static __inline__ vector bool int __ATTRS_o_ai
1899vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1900  return ~(vec_cmpgt(__b, __a));
1901}
1902
1903static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
1904                                                         vector float __b) {
1905#ifdef __VSX__
1906  return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
1907#else
1908  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1909#endif
1910}
1911
1912#ifdef __VSX__
1913static __inline__ vector bool long long __ATTRS_o_ai
1914vec_cmpge(vector double __a, vector double __b) {
1915  return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
1916}
1917#endif
1918
1919#ifdef __POWER8_VECTOR__
1920static __inline__ vector bool long long __ATTRS_o_ai
1921vec_cmpge(vector signed long long __a, vector signed long long __b) {
1922  return ~(vec_cmpgt(__b, __a));
1923}
1924
1925static __inline__ vector bool long long __ATTRS_o_ai
1926vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1927  return ~(vec_cmpgt(__b, __a));
1928}
1929#endif
1930
1931/* vec_vcmpgefp */
1932
1933static __inline__ vector bool int __attribute__((__always_inline__))
1934vec_vcmpgefp(vector float __a, vector float __b) {
1935  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1936}
1937
1938/* vec_vcmpgtsb */
1939
1940static __inline__ vector bool char __attribute__((__always_inline__))
1941vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
1942  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1943}
1944
1945/* vec_vcmpgtub */
1946
1947static __inline__ vector bool char __attribute__((__always_inline__))
1948vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
1949  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1950}
1951
1952/* vec_vcmpgtsh */
1953
1954static __inline__ vector bool short __attribute__((__always_inline__))
1955vec_vcmpgtsh(vector short __a, vector short __b) {
1956  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1957}
1958
1959/* vec_vcmpgtuh */
1960
1961static __inline__ vector bool short __attribute__((__always_inline__))
1962vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
1963  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1964}
1965
1966/* vec_vcmpgtsw */
1967
1968static __inline__ vector bool int __attribute__((__always_inline__))
1969vec_vcmpgtsw(vector int __a, vector int __b) {
1970  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1971}
1972
1973/* vec_vcmpgtuw */
1974
1975static __inline__ vector bool int __attribute__((__always_inline__))
1976vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
1977  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1978}
1979
1980/* vec_vcmpgtfp */
1981
1982static __inline__ vector bool int __attribute__((__always_inline__))
1983vec_vcmpgtfp(vector float __a, vector float __b) {
1984  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1985}
1986
1987/* vec_cmple */
1988
1989static __inline__ vector bool char __ATTRS_o_ai
1990vec_cmple(vector signed char __a, vector signed char __b) {
1991  return vec_cmpge(__b, __a);
1992}
1993
1994static __inline__ vector bool char __ATTRS_o_ai
1995vec_cmple(vector unsigned char __a, vector unsigned char __b) {
1996  return vec_cmpge(__b, __a);
1997}
1998
1999static __inline__ vector bool short __ATTRS_o_ai
2000vec_cmple(vector signed short __a, vector signed short __b) {
2001  return vec_cmpge(__b, __a);
2002}
2003
2004static __inline__ vector bool short __ATTRS_o_ai
2005vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2006  return vec_cmpge(__b, __a);
2007}
2008
2009static __inline__ vector bool int __ATTRS_o_ai
2010vec_cmple(vector signed int __a, vector signed int __b) {
2011  return vec_cmpge(__b, __a);
2012}
2013
2014static __inline__ vector bool int __ATTRS_o_ai
2015vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2016  return vec_cmpge(__b, __a);
2017}
2018
2019static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2020                                                         vector float __b) {
2021  return vec_cmpge(__b, __a);
2022}
2023
2024#ifdef __VSX__
2025static __inline__ vector bool long long __ATTRS_o_ai
2026vec_cmple(vector double __a, vector double __b) {
2027  return vec_cmpge(__b, __a);
2028}
2029#endif
2030
2031#ifdef __POWER8_VECTOR__
2032static __inline__ vector bool long long __ATTRS_o_ai
2033vec_cmple(vector signed long long __a, vector signed long long __b) {
2034  return vec_cmpge(__b, __a);
2035}
2036
2037static __inline__ vector bool long long __ATTRS_o_ai
2038vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2039  return vec_cmpge(__b, __a);
2040}
2041#endif
2042
2043/* vec_cmplt */
2044
2045static __inline__ vector bool char __ATTRS_o_ai
2046vec_cmplt(vector signed char __a, vector signed char __b) {
2047  return vec_cmpgt(__b, __a);
2048}
2049
2050static __inline__ vector bool char __ATTRS_o_ai
2051vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2052  return vec_cmpgt(__b, __a);
2053}
2054
2055static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2056                                                           vector short __b) {
2057  return vec_cmpgt(__b, __a);
2058}
2059
2060static __inline__ vector bool short __ATTRS_o_ai
2061vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2062  return vec_cmpgt(__b, __a);
2063}
2064
2065static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2066                                                         vector int __b) {
2067  return vec_cmpgt(__b, __a);
2068}
2069
2070static __inline__ vector bool int __ATTRS_o_ai
2071vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2072  return vec_cmpgt(__b, __a);
2073}
2074
2075static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2076                                                         vector float __b) {
2077  return vec_cmpgt(__b, __a);
2078}
2079
2080#ifdef __VSX__
2081static __inline__ vector bool long long __ATTRS_o_ai
2082vec_cmplt(vector double __a, vector double __b) {
2083  return vec_cmpgt(__b, __a);
2084}
2085#endif
2086
2087#ifdef __POWER8_VECTOR__
2088static __inline__ vector bool long long __ATTRS_o_ai
2089vec_cmplt(vector signed long long __a, vector signed long long __b) {
2090  return vec_cmpgt(__b, __a);
2091}
2092
2093static __inline__ vector bool long long __ATTRS_o_ai
2094vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2095  return vec_cmpgt(__b, __a);
2096}
2097
2098/* vec_popcnt */
2099
2100static __inline__ vector signed char __ATTRS_o_ai
2101vec_popcnt(vector signed char __a) {
2102  return __builtin_altivec_vpopcntb(__a);
2103}
2104static __inline__ vector unsigned char __ATTRS_o_ai
2105vec_popcnt(vector unsigned char __a) {
2106  return __builtin_altivec_vpopcntb(__a);
2107}
2108static __inline__ vector signed short __ATTRS_o_ai
2109vec_popcnt(vector signed short __a) {
2110  return __builtin_altivec_vpopcnth(__a);
2111}
2112static __inline__ vector unsigned short __ATTRS_o_ai
2113vec_popcnt(vector unsigned short __a) {
2114  return __builtin_altivec_vpopcnth(__a);
2115}
2116static __inline__ vector signed int __ATTRS_o_ai
2117vec_popcnt(vector signed int __a) {
2118  return __builtin_altivec_vpopcntw(__a);
2119}
2120static __inline__ vector unsigned int __ATTRS_o_ai
2121vec_popcnt(vector unsigned int __a) {
2122  return __builtin_altivec_vpopcntw(__a);
2123}
2124static __inline__ vector signed long long __ATTRS_o_ai
2125vec_popcnt(vector signed long long __a) {
2126  return __builtin_altivec_vpopcntd(__a);
2127}
2128static __inline__ vector unsigned long long __ATTRS_o_ai
2129vec_popcnt(vector unsigned long long __a) {
2130  return __builtin_altivec_vpopcntd(__a);
2131}
2132
2133/* vec_cntlz */
2134
2135static __inline__ vector signed char __ATTRS_o_ai
2136vec_cntlz(vector signed char __a) {
2137  return __builtin_altivec_vclzb(__a);
2138}
2139static __inline__ vector unsigned char __ATTRS_o_ai
2140vec_cntlz(vector unsigned char __a) {
2141  return __builtin_altivec_vclzb(__a);
2142}
2143static __inline__ vector signed short __ATTRS_o_ai
2144vec_cntlz(vector signed short __a) {
2145  return __builtin_altivec_vclzh(__a);
2146}
2147static __inline__ vector unsigned short __ATTRS_o_ai
2148vec_cntlz(vector unsigned short __a) {
2149  return __builtin_altivec_vclzh(__a);
2150}
2151static __inline__ vector signed int __ATTRS_o_ai
2152vec_cntlz(vector signed int __a) {
2153  return __builtin_altivec_vclzw(__a);
2154}
2155static __inline__ vector unsigned int __ATTRS_o_ai
2156vec_cntlz(vector unsigned int __a) {
2157  return __builtin_altivec_vclzw(__a);
2158}
2159static __inline__ vector signed long long __ATTRS_o_ai
2160vec_cntlz(vector signed long long __a) {
2161  return __builtin_altivec_vclzd(__a);
2162}
2163static __inline__ vector unsigned long long __ATTRS_o_ai
2164vec_cntlz(vector unsigned long long __a) {
2165  return __builtin_altivec_vclzd(__a);
2166}
2167#endif
2168
2169#ifdef __POWER9_VECTOR__
2170
2171/* vec_cnttz */
2172
2173static __inline__ vector signed char __ATTRS_o_ai
2174vec_cnttz(vector signed char __a) {
2175  return __builtin_altivec_vctzb(__a);
2176}
2177static __inline__ vector unsigned char __ATTRS_o_ai
2178vec_cnttz(vector unsigned char __a) {
2179  return __builtin_altivec_vctzb(__a);
2180}
2181static __inline__ vector signed short __ATTRS_o_ai
2182vec_cnttz(vector signed short __a) {
2183  return __builtin_altivec_vctzh(__a);
2184}
2185static __inline__ vector unsigned short __ATTRS_o_ai
2186vec_cnttz(vector unsigned short __a) {
2187  return __builtin_altivec_vctzh(__a);
2188}
2189static __inline__ vector signed int __ATTRS_o_ai
2190vec_cnttz(vector signed int __a) {
2191  return __builtin_altivec_vctzw(__a);
2192}
2193static __inline__ vector unsigned int __ATTRS_o_ai
2194vec_cnttz(vector unsigned int __a) {
2195  return __builtin_altivec_vctzw(__a);
2196}
2197static __inline__ vector signed long long __ATTRS_o_ai
2198vec_cnttz(vector signed long long __a) {
2199  return __builtin_altivec_vctzd(__a);
2200}
2201static __inline__ vector unsigned long long __ATTRS_o_ai
2202vec_cnttz(vector unsigned long long __a) {
2203  return __builtin_altivec_vctzd(__a);
2204}
2205
2206/* vec_first_match_index */
2207
2208static __inline__ unsigned __ATTRS_o_ai
2209vec_first_match_index(vector signed char __a, vector signed char __b) {
2210  vector unsigned long long __res =
2211#ifdef __LITTLE_ENDIAN__
2212    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2213#else
2214    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2215#endif
2216  if (__res[0] == 64) {
2217    return (__res[1] + 64) >> 3;
2218  }
2219  return __res[0] >> 3;
2220}
2221
2222static __inline__ unsigned __ATTRS_o_ai
2223vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2224  vector unsigned long long __res =
2225#ifdef __LITTLE_ENDIAN__
2226    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2227#else
2228    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2229#endif
2230  if (__res[0] == 64) {
2231    return (__res[1] + 64) >> 3;
2232  }
2233  return __res[0] >> 3;
2234}
2235
2236static __inline__ unsigned __ATTRS_o_ai
2237vec_first_match_index(vector signed short __a, vector signed short __b) {
2238  vector unsigned long long __res =
2239#ifdef __LITTLE_ENDIAN__
2240    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2241#else
2242    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2243#endif
2244  if (__res[0] == 64) {
2245    return (__res[1] + 64) >> 4;
2246  }
2247  return __res[0] >> 4;
2248}
2249
2250static __inline__ unsigned __ATTRS_o_ai
2251vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2252  vector unsigned long long __res =
2253#ifdef __LITTLE_ENDIAN__
2254    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2255#else
2256    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2257#endif
2258  if (__res[0] == 64) {
2259    return (__res[1] + 64) >> 4;
2260  }
2261  return __res[0] >> 4;
2262}
2263
2264static __inline__ unsigned __ATTRS_o_ai
2265vec_first_match_index(vector signed int __a, vector signed int __b) {
2266  vector unsigned long long __res =
2267#ifdef __LITTLE_ENDIAN__
2268    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2269#else
2270    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2271#endif
2272  if (__res[0] == 64) {
2273    return (__res[1] + 64) >> 5;
2274  }
2275  return __res[0] >> 5;
2276}
2277
2278static __inline__ unsigned __ATTRS_o_ai
2279vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2280  vector unsigned long long __res =
2281#ifdef __LITTLE_ENDIAN__
2282    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2283#else
2284    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2285#endif
2286  if (__res[0] == 64) {
2287    return (__res[1] + 64) >> 5;
2288  }
2289  return __res[0] >> 5;
2290}
2291
2292/* vec_first_match_or_eos_index */
2293
2294static __inline__ unsigned __ATTRS_o_ai
2295vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2296  /* Compare the result of the comparison of two vectors with either and OR the
2297     result. Either the elements are equal or one will equal the comparison
2298     result if either is zero.
2299  */
2300  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2301  vector bool char __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2302    vec_cmpeq(__tmp1, __b);
2303
2304  vector unsigned long long __res =
2305#ifdef __LITTLE_ENDIAN__
2306    vec_cnttz((vector unsigned long long)__tmp2);
2307#else
2308    vec_cntlz((vector unsigned long long)__tmp2);
2309#endif
2310  if (__res[0] == 64) {
2311    return (__res[1] + 64) >> 3;
2312  }
2313  return __res[0] >> 3;
2314}
2315
2316static __inline__ unsigned __ATTRS_o_ai
2317vec_first_match_or_eos_index(vector unsigned char __a,
2318                             vector unsigned char __b) {
2319  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2320  vector bool char __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2321    vec_cmpeq(__tmp1, __b);
2322
2323  vector unsigned long long __res =
2324#ifdef __LITTLE_ENDIAN__
2325    vec_cnttz((vector unsigned long long)__tmp2);
2326#else
2327    vec_cntlz((vector unsigned long long)__tmp2);
2328#endif
2329  if (__res[0] == 64) {
2330    return (__res[1] + 64) >> 3;
2331  }
2332  return __res[0] >> 3;
2333}
2334
2335static __inline__ unsigned __ATTRS_o_ai
2336vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2337  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2338  vector bool short __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2339    vec_cmpeq(__tmp1, __b);
2340
2341  vector unsigned long long __res =
2342#ifdef __LITTLE_ENDIAN__
2343    vec_cnttz((vector unsigned long long)__tmp2);
2344#else
2345    vec_cntlz((vector unsigned long long)__tmp2);
2346#endif
2347  if (__res[0] == 64) {
2348    return (__res[1] + 64) >> 4;
2349  }
2350  return __res[0] >> 4;
2351}
2352
2353static __inline__ unsigned __ATTRS_o_ai
2354vec_first_match_or_eos_index(vector unsigned short __a,
2355                             vector unsigned short __b) {
2356  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2357  vector bool short __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2358    vec_cmpeq(__tmp1, __b);
2359
2360  vector unsigned long long __res =
2361#ifdef __LITTLE_ENDIAN__
2362    vec_cnttz((vector unsigned long long)__tmp2);
2363#else
2364    vec_cntlz((vector unsigned long long)__tmp2);
2365#endif
2366  if (__res[0] == 64) {
2367    return (__res[1] + 64) >> 4;
2368  }
2369  return __res[0] >> 4;
2370}
2371
2372static __inline__ unsigned __ATTRS_o_ai
2373vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2374  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2375  vector bool int __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2376    vec_cmpeq(__tmp1, __b);
2377
2378  vector unsigned long long __res =
2379#ifdef __LITTLE_ENDIAN__
2380    vec_cnttz((vector unsigned long long)__tmp2);
2381#else
2382    vec_cntlz((vector unsigned long long)__tmp2);
2383#endif
2384  if (__res[0] == 64) {
2385    return (__res[1] + 64) >> 5;
2386  }
2387  return __res[0] >> 5;
2388}
2389
2390static __inline__ unsigned __ATTRS_o_ai
2391vec_first_match_or_eos_index(vector unsigned int __a,
2392                             vector unsigned int __b) {
2393  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2394  vector bool int __tmp2 = __tmp1 | vec_cmpeq(__tmp1, __a) |
2395    vec_cmpeq(__tmp1, __b);
2396
2397  vector unsigned long long __res =
2398#ifdef __LITTLE_ENDIAN__
2399    vec_cnttz((vector unsigned long long)__tmp2);
2400#else
2401    vec_cntlz((vector unsigned long long)__tmp2);
2402#endif
2403  if (__res[0] == 64) {
2404    return (__res[1] + 64) >> 5;
2405  }
2406  return __res[0] >> 5;
2407}
2408
2409/* vec_first_mismatch_index */
2410
2411static __inline__ unsigned __ATTRS_o_ai
2412vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2413  vector unsigned long long __res =
2414#ifdef __LITTLE_ENDIAN__
2415    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2416#else
2417    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2418#endif
2419  if (__res[0] == 64) {
2420    return (__res[1] + 64) >> 3;
2421  }
2422  return __res[0] >> 3;
2423}
2424
2425static __inline__ unsigned __ATTRS_o_ai
2426vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2427  vector unsigned long long __res =
2428#ifdef __LITTLE_ENDIAN__
2429    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2430#else
2431    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2432#endif
2433  if (__res[0] == 64) {
2434    return (__res[1] + 64) >> 3;
2435  }
2436  return __res[0] >> 3;
2437}
2438
2439static __inline__ unsigned __ATTRS_o_ai
2440vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2441  vector unsigned long long __res =
2442#ifdef __LITTLE_ENDIAN__
2443    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2444#else
2445    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2446#endif
2447  if (__res[0] == 64) {
2448    return (__res[1] + 64) >> 4;
2449  }
2450  return __res[0] >> 4;
2451}
2452
2453static __inline__ unsigned __ATTRS_o_ai
2454vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2455  vector unsigned long long __res =
2456#ifdef __LITTLE_ENDIAN__
2457    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2458#else
2459    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2460#endif
2461  if (__res[0] == 64) {
2462    return (__res[1] + 64) >> 4;
2463  }
2464  return __res[0] >> 4;
2465}
2466
2467static __inline__ unsigned __ATTRS_o_ai
2468vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2469  vector unsigned long long __res =
2470#ifdef __LITTLE_ENDIAN__
2471    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2472#else
2473    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2474#endif
2475  if (__res[0] == 64) {
2476    return (__res[1] + 64) >> 5;
2477  }
2478  return __res[0] >> 5;
2479}
2480
2481static __inline__ unsigned __ATTRS_o_ai
2482vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2483  vector unsigned long long __res =
2484#ifdef __LITTLE_ENDIAN__
2485    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2486#else
2487    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2488#endif
2489  if (__res[0] == 64) {
2490    return (__res[1] + 64) >> 5;
2491  }
2492  return __res[0] >> 5;
2493}
2494
2495/* vec_first_mismatch_or_eos_index */
2496
2497static __inline__ unsigned __ATTRS_o_ai
2498vec_first_mismatch_or_eos_index(vector signed char __a,
2499                                vector signed char __b) {
2500  vector unsigned long long __res =
2501#ifdef __LITTLE_ENDIAN__
2502    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2503#else
2504    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2505#endif
2506  if (__res[0] == 64) {
2507    return (__res[1] + 64) >> 3;
2508  }
2509  return __res[0] >> 3;
2510}
2511
2512static __inline__ unsigned __ATTRS_o_ai
2513vec_first_mismatch_or_eos_index(vector unsigned char __a,
2514                                vector unsigned char __b) {
2515  vector unsigned long long __res =
2516#ifdef __LITTLE_ENDIAN__
2517    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2518#else
2519    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2520#endif
2521  if (__res[0] == 64) {
2522    return (__res[1] + 64) >> 3;
2523  }
2524  return __res[0] >> 3;
2525}
2526
2527static __inline__ unsigned __ATTRS_o_ai
2528vec_first_mismatch_or_eos_index(vector signed short __a,
2529                                vector signed short __b) {
2530  vector unsigned long long __res =
2531#ifdef __LITTLE_ENDIAN__
2532    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2533#else
2534    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2535#endif
2536  if (__res[0] == 64) {
2537    return (__res[1] + 64) >> 4;
2538  }
2539  return __res[0] >> 4;
2540}
2541
2542static __inline__ unsigned __ATTRS_o_ai
2543vec_first_mismatch_or_eos_index(vector unsigned short __a,
2544                                vector unsigned short __b) {
2545  vector unsigned long long __res =
2546#ifdef __LITTLE_ENDIAN__
2547    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2548#else
2549    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2550#endif
2551  if (__res[0] == 64) {
2552    return (__res[1] + 64) >> 4;
2553  }
2554  return __res[0] >> 4;
2555}
2556
2557static __inline__ unsigned __ATTRS_o_ai
2558vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2559  vector unsigned long long __res =
2560#ifdef __LITTLE_ENDIAN__
2561    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2562#else
2563    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2564#endif
2565  if (__res[0] == 64) {
2566    return (__res[1] + 64) >> 5;
2567  }
2568  return __res[0] >> 5;
2569}
2570
2571static __inline__ unsigned __ATTRS_o_ai
2572vec_first_mismatch_or_eos_index(vector unsigned int __a,
2573                                vector unsigned int __b) {
2574  vector unsigned long long __res =
2575#ifdef __LITTLE_ENDIAN__
2576    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2577#else
2578    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2579#endif
2580  if (__res[0] == 64) {
2581    return (__res[1] + 64) >> 5;
2582  }
2583  return __res[0] >> 5;
2584}
2585
2586static __inline__ vector double  __ATTRS_o_ai
2587vec_insert_exp(vector double __a, vector unsigned long long __b) {
2588  return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2589}
2590
2591static __inline__ vector double  __ATTRS_o_ai
2592vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2593  return __builtin_vsx_xviexpdp(__a,__b);
2594}
2595
2596static __inline__ vector float  __ATTRS_o_ai
2597vec_insert_exp(vector float __a, vector unsigned int __b) {
2598  return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2599}
2600
2601static __inline__ vector float  __ATTRS_o_ai
2602vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2603  return __builtin_vsx_xviexpsp(__a,__b);
2604}
2605
2606#endif
2607
2608/* vec_cpsgn */
2609
2610#ifdef __VSX__
2611static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2612                                                      vector float __b) {
2613  return __builtin_vsx_xvcpsgnsp(__a, __b);
2614}
2615
2616static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
2617                                                       vector double __b) {
2618  return __builtin_vsx_xvcpsgndp(__a, __b);
2619}
2620#endif
2621
2622/* vec_ctf */
2623
2624static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
2625  return __builtin_altivec_vcfsx(__a, __b);
2626}
2627
2628static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a,
2629                                                    int __b) {
2630  return __builtin_altivec_vcfux((vector int)__a, __b);
2631}
2632
2633#ifdef __VSX__
2634static __inline__ vector double __ATTRS_o_ai
2635vec_ctf(vector unsigned long long __a, int __b) {
2636  vector double __ret = __builtin_convertvector(__a, vector double);
2637  __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
2638  return __ret;
2639}
2640
2641static __inline__ vector double __ATTRS_o_ai
2642vec_ctf(vector signed long long __a, int __b) {
2643  vector double __ret = __builtin_convertvector(__a, vector double);
2644  __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
2645  return __ret;
2646}
2647#endif
2648
2649/* vec_vcfsx */
2650
2651static __inline__ vector float __attribute__((__always_inline__))
2652vec_vcfsx(vector int __a, int __b) {
2653  return __builtin_altivec_vcfsx(__a, __b);
2654}
2655
2656/* vec_vcfux */
2657
2658static __inline__ vector float __attribute__((__always_inline__))
2659vec_vcfux(vector unsigned int __a, int __b) {
2660  return __builtin_altivec_vcfux((vector int)__a, __b);
2661}
2662
2663/* vec_cts */
2664
2665static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) {
2666  return __builtin_altivec_vctsxs(__a, __b);
2667}
2668
2669#ifdef __VSX__
2670static __inline__ vector signed long long __ATTRS_o_ai
2671vec_cts(vector double __a, int __b) {
2672  __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2673  return __builtin_convertvector(__a, vector signed long long);
2674}
2675#endif
2676
2677/* vec_vctsxs */
2678
2679static __inline__ vector int __attribute__((__always_inline__))
2680vec_vctsxs(vector float __a, int __b) {
2681  return __builtin_altivec_vctsxs(__a, __b);
2682}
2683
2684/* vec_ctu */
2685
2686static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a,
2687                                                           int __b) {
2688  return __builtin_altivec_vctuxs(__a, __b);
2689}
2690
2691#ifdef __VSX__
2692static __inline__ vector unsigned long long __ATTRS_o_ai
2693vec_ctu(vector double __a, int __b) {
2694  __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2695  return __builtin_convertvector(__a, vector unsigned long long);
2696}
2697#endif
2698
2699/* vec_vctuxs */
2700
2701static __inline__ vector unsigned int __attribute__((__always_inline__))
2702vec_vctuxs(vector float __a, int __b) {
2703  return __builtin_altivec_vctuxs(__a, __b);
2704}
2705
2706/* vec_double */
2707
2708#ifdef __VSX__
2709static __inline__ vector double __ATTRS_o_ai
2710vec_double(vector signed long long __a) {
2711  vector double __ret = {__a[0], __a[1]};
2712  return __ret;
2713}
2714
2715static __inline__ vector double __ATTRS_o_ai
2716vec_double(vector unsigned long long __a) {
2717  vector double __ret = {__a[0], __a[1]};
2718  return __ret;
2719}
2720#endif
2721
2722/* vec_div */
2723
2724/* Integer vector divides (vectors are scalarized, elements divided
2725   and the vectors reassembled).
2726*/
2727static __inline__ vector signed char __ATTRS_o_ai
2728vec_div(vector signed char __a, vector signed char __b) {
2729  return __a / __b;
2730}
2731
2732static __inline__ vector unsigned char __ATTRS_o_ai
2733vec_div(vector unsigned char __a, vector unsigned char __b) {
2734  return __a / __b;
2735}
2736
2737static __inline__ vector signed short __ATTRS_o_ai
2738vec_div(vector signed short __a, vector signed short __b) {
2739  return __a / __b;
2740}
2741
2742static __inline__ vector unsigned short __ATTRS_o_ai
2743vec_div(vector unsigned short __a, vector unsigned short __b) {
2744  return __a / __b;
2745}
2746
2747static __inline__ vector signed int __ATTRS_o_ai
2748vec_div(vector signed int __a, vector signed int __b) {
2749  return __a / __b;
2750}
2751
2752static __inline__ vector unsigned int __ATTRS_o_ai
2753vec_div(vector unsigned int __a, vector unsigned int __b) {
2754  return __a / __b;
2755}
2756
2757#ifdef __VSX__
2758static __inline__ vector signed long long __ATTRS_o_ai
2759vec_div(vector signed long long __a, vector signed long long __b) {
2760  return __a / __b;
2761}
2762
2763static __inline__ vector unsigned long long __ATTRS_o_ai
2764vec_div(vector unsigned long long __a, vector unsigned long long __b) {
2765  return __a / __b;
2766}
2767
2768static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
2769                                                    vector float __b) {
2770  return __a / __b;
2771}
2772
2773static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
2774                                                     vector double __b) {
2775  return __a / __b;
2776}
2777#endif
2778
2779/* vec_dss */
2780
2781static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
2782  __builtin_altivec_dss(__a);
2783}
2784
2785/* vec_dssall */
2786
2787static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
2788  __builtin_altivec_dssall();
2789}
2790
2791/* vec_dst */
2792#define vec_dst(__PTR, __CW, __STR) \
2793  __extension__(                    \
2794      { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
2795
2796/* vec_dstst */
2797#define vec_dstst(__PTR, __CW, __STR) \
2798  __extension__(                      \
2799      { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
2800
2801/* vec_dststt */
2802#define vec_dststt(__PTR, __CW, __STR) \
2803  __extension__(                       \
2804      { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
2805
2806/* vec_dstt */
2807#define vec_dstt(__PTR, __CW, __STR) \
2808  __extension__(                     \
2809      { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
2810
2811/* vec_eqv */
2812
2813#ifdef __POWER8_VECTOR__
2814static __inline__ vector signed char __ATTRS_o_ai
2815vec_eqv(vector signed char __a, vector signed char __b) {
2816  return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2817                                                  (vector unsigned int)__b);
2818}
2819
2820static __inline__ vector unsigned char __ATTRS_o_ai
2821vec_eqv(vector unsigned char __a, vector unsigned char __b) {
2822  return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2823                                                    (vector unsigned int)__b);
2824}
2825
2826static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
2827                                                        vector bool char __b) {
2828  return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2829                                                (vector unsigned int)__b);
2830}
2831
2832static __inline__ vector signed short __ATTRS_o_ai
2833vec_eqv(vector signed short __a, vector signed short __b) {
2834  return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2835                                                   (vector unsigned int)__b);
2836}
2837
2838static __inline__ vector unsigned short __ATTRS_o_ai
2839vec_eqv(vector unsigned short __a, vector unsigned short __b) {
2840  return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2841                                                     (vector unsigned int)__b);
2842}
2843
2844static __inline__ vector bool short __ATTRS_o_ai
2845vec_eqv(vector bool short __a, vector bool short __b) {
2846  return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2847                                                 (vector unsigned int)__b);
2848}
2849
2850static __inline__ vector signed int __ATTRS_o_ai
2851vec_eqv(vector signed int __a, vector signed int __b) {
2852  return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2853                                                 (vector unsigned int)__b);
2854}
2855
2856static __inline__ vector unsigned int __ATTRS_o_ai
2857vec_eqv(vector unsigned int __a, vector unsigned int __b) {
2858  return __builtin_vsx_xxleqv(__a, __b);
2859}
2860
2861static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
2862                                                       vector bool int __b) {
2863  return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2864                                               (vector unsigned int)__b);
2865}
2866
2867static __inline__ vector signed long long __ATTRS_o_ai
2868vec_eqv(vector signed long long __a, vector signed long long __b) {
2869  return (vector signed long long)__builtin_vsx_xxleqv(
2870      (vector unsigned int)__a, (vector unsigned int)__b);
2871}
2872
2873static __inline__ vector unsigned long long __ATTRS_o_ai
2874vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
2875  return (vector unsigned long long)__builtin_vsx_xxleqv(
2876      (vector unsigned int)__a, (vector unsigned int)__b);
2877}
2878
2879static __inline__ vector bool long long __ATTRS_o_ai
2880vec_eqv(vector bool long long __a, vector bool long long __b) {
2881  return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
2882                                                     (vector unsigned int)__b);
2883}
2884
2885static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
2886                                                    vector float __b) {
2887  return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
2888                                            (vector unsigned int)__b);
2889}
2890
2891static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
2892                                                     vector double __b) {
2893  return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
2894                                             (vector unsigned int)__b);
2895}
2896#endif
2897
2898/* vec_expte */
2899
2900static __inline__ vector float __attribute__((__always_inline__))
2901vec_expte(vector float __a) {
2902  return __builtin_altivec_vexptefp(__a);
2903}
2904
2905/* vec_vexptefp */
2906
2907static __inline__ vector float __attribute__((__always_inline__))
2908vec_vexptefp(vector float __a) {
2909  return __builtin_altivec_vexptefp(__a);
2910}
2911
2912/* vec_floor */
2913
2914static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
2915#ifdef __VSX__
2916  return __builtin_vsx_xvrspim(__a);
2917#else
2918  return __builtin_altivec_vrfim(__a);
2919#endif
2920}
2921
2922#ifdef __VSX__
2923static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
2924  return __builtin_vsx_xvrdpim(__a);
2925}
2926#endif
2927
2928/* vec_vrfim */
2929
2930static __inline__ vector float __attribute__((__always_inline__))
2931vec_vrfim(vector float __a) {
2932  return __builtin_altivec_vrfim(__a);
2933}
2934
2935/* vec_ld */
2936
2937static __inline__ vector signed char __ATTRS_o_ai
2938vec_ld(int __a, const vector signed char *__b) {
2939  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2940}
2941
2942static __inline__ vector signed char __ATTRS_o_ai
2943vec_ld(int __a, const signed char *__b) {
2944  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2945}
2946
2947static __inline__ vector unsigned char __ATTRS_o_ai
2948vec_ld(int __a, const vector unsigned char *__b) {
2949  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2950}
2951
2952static __inline__ vector unsigned char __ATTRS_o_ai
2953vec_ld(int __a, const unsigned char *__b) {
2954  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2955}
2956
2957static __inline__ vector bool char __ATTRS_o_ai
2958vec_ld(int __a, const vector bool char *__b) {
2959  return (vector bool char)__builtin_altivec_lvx(__a, __b);
2960}
2961
2962static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
2963                                                   const vector short *__b) {
2964  return (vector short)__builtin_altivec_lvx(__a, __b);
2965}
2966
2967static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
2968  return (vector short)__builtin_altivec_lvx(__a, __b);
2969}
2970
2971static __inline__ vector unsigned short __ATTRS_o_ai
2972vec_ld(int __a, const vector unsigned short *__b) {
2973  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2974}
2975
2976static __inline__ vector unsigned short __ATTRS_o_ai
2977vec_ld(int __a, const unsigned short *__b) {
2978  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2979}
2980
2981static __inline__ vector bool short __ATTRS_o_ai
2982vec_ld(int __a, const vector bool short *__b) {
2983  return (vector bool short)__builtin_altivec_lvx(__a, __b);
2984}
2985
2986static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
2987                                                   const vector pixel *__b) {
2988  return (vector pixel)__builtin_altivec_lvx(__a, __b);
2989}
2990
2991static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
2992                                                 const vector int *__b) {
2993  return (vector int)__builtin_altivec_lvx(__a, __b);
2994}
2995
2996static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
2997  return (vector int)__builtin_altivec_lvx(__a, __b);
2998}
2999
3000static __inline__ vector unsigned int __ATTRS_o_ai
3001vec_ld(int __a, const vector unsigned int *__b) {
3002  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3003}
3004
3005static __inline__ vector unsigned int __ATTRS_o_ai
3006vec_ld(int __a, const unsigned int *__b) {
3007  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3008}
3009
3010static __inline__ vector bool int __ATTRS_o_ai
3011vec_ld(int __a, const vector bool int *__b) {
3012  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3013}
3014
3015static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3016                                                   const vector float *__b) {
3017  return (vector float)__builtin_altivec_lvx(__a, __b);
3018}
3019
3020static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3021  return (vector float)__builtin_altivec_lvx(__a, __b);
3022}
3023
3024/* vec_lvx */
3025
3026static __inline__ vector signed char __ATTRS_o_ai
3027vec_lvx(int __a, const vector signed char *__b) {
3028  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3029}
3030
3031static __inline__ vector signed char __ATTRS_o_ai
3032vec_lvx(int __a, const signed char *__b) {
3033  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3034}
3035
3036static __inline__ vector unsigned char __ATTRS_o_ai
3037vec_lvx(int __a, const vector unsigned char *__b) {
3038  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3039}
3040
3041static __inline__ vector unsigned char __ATTRS_o_ai
3042vec_lvx(int __a, const unsigned char *__b) {
3043  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3044}
3045
3046static __inline__ vector bool char __ATTRS_o_ai
3047vec_lvx(int __a, const vector bool char *__b) {
3048  return (vector bool char)__builtin_altivec_lvx(__a, __b);
3049}
3050
3051static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3052                                                    const vector short *__b) {
3053  return (vector short)__builtin_altivec_lvx(__a, __b);
3054}
3055
3056static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3057  return (vector short)__builtin_altivec_lvx(__a, __b);
3058}
3059
3060static __inline__ vector unsigned short __ATTRS_o_ai
3061vec_lvx(int __a, const vector unsigned short *__b) {
3062  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3063}
3064
3065static __inline__ vector unsigned short __ATTRS_o_ai
3066vec_lvx(int __a, const unsigned short *__b) {
3067  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3068}
3069
3070static __inline__ vector bool short __ATTRS_o_ai
3071vec_lvx(int __a, const vector bool short *__b) {
3072  return (vector bool short)__builtin_altivec_lvx(__a, __b);
3073}
3074
3075static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3076                                                    const vector pixel *__b) {
3077  return (vector pixel)__builtin_altivec_lvx(__a, __b);
3078}
3079
3080static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3081                                                  const vector int *__b) {
3082  return (vector int)__builtin_altivec_lvx(__a, __b);
3083}
3084
3085static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3086  return (vector int)__builtin_altivec_lvx(__a, __b);
3087}
3088
3089static __inline__ vector unsigned int __ATTRS_o_ai
3090vec_lvx(int __a, const vector unsigned int *__b) {
3091  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3092}
3093
3094static __inline__ vector unsigned int __ATTRS_o_ai
3095vec_lvx(int __a, const unsigned int *__b) {
3096  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3097}
3098
3099static __inline__ vector bool int __ATTRS_o_ai
3100vec_lvx(int __a, const vector bool int *__b) {
3101  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3102}
3103
3104static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3105                                                    const vector float *__b) {
3106  return (vector float)__builtin_altivec_lvx(__a, __b);
3107}
3108
3109static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3110  return (vector float)__builtin_altivec_lvx(__a, __b);
3111}
3112
3113/* vec_lde */
3114
3115static __inline__ vector signed char __ATTRS_o_ai
3116vec_lde(int __a, const signed char *__b) {
3117  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3118}
3119
3120static __inline__ vector unsigned char __ATTRS_o_ai
3121vec_lde(int __a, const unsigned char *__b) {
3122  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3123}
3124
3125static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3126  return (vector short)__builtin_altivec_lvehx(__a, __b);
3127}
3128
3129static __inline__ vector unsigned short __ATTRS_o_ai
3130vec_lde(int __a, const unsigned short *__b) {
3131  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3132}
3133
3134static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3135  return (vector int)__builtin_altivec_lvewx(__a, __b);
3136}
3137
3138static __inline__ vector unsigned int __ATTRS_o_ai
3139vec_lde(int __a, const unsigned int *__b) {
3140  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3141}
3142
3143static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3144  return (vector float)__builtin_altivec_lvewx(__a, __b);
3145}
3146
3147/* vec_lvebx */
3148
3149static __inline__ vector signed char __ATTRS_o_ai
3150vec_lvebx(int __a, const signed char *__b) {
3151  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3152}
3153
3154static __inline__ vector unsigned char __ATTRS_o_ai
3155vec_lvebx(int __a, const unsigned char *__b) {
3156  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3157}
3158
3159/* vec_lvehx */
3160
3161static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3162                                                      const short *__b) {
3163  return (vector short)__builtin_altivec_lvehx(__a, __b);
3164}
3165
3166static __inline__ vector unsigned short __ATTRS_o_ai
3167vec_lvehx(int __a, const unsigned short *__b) {
3168  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3169}
3170
3171/* vec_lvewx */
3172
3173static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3174  return (vector int)__builtin_altivec_lvewx(__a, __b);
3175}
3176
3177static __inline__ vector unsigned int __ATTRS_o_ai
3178vec_lvewx(int __a, const unsigned int *__b) {
3179  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3180}
3181
3182static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3183                                                      const float *__b) {
3184  return (vector float)__builtin_altivec_lvewx(__a, __b);
3185}
3186
3187/* vec_ldl */
3188
3189static __inline__ vector signed char __ATTRS_o_ai
3190vec_ldl(int __a, const vector signed char *__b) {
3191  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3192}
3193
3194static __inline__ vector signed char __ATTRS_o_ai
3195vec_ldl(int __a, const signed char *__b) {
3196  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3197}
3198
3199static __inline__ vector unsigned char __ATTRS_o_ai
3200vec_ldl(int __a, const vector unsigned char *__b) {
3201  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3202}
3203
3204static __inline__ vector unsigned char __ATTRS_o_ai
3205vec_ldl(int __a, const unsigned char *__b) {
3206  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3207}
3208
3209static __inline__ vector bool char __ATTRS_o_ai
3210vec_ldl(int __a, const vector bool char *__b) {
3211  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3212}
3213
3214static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3215                                                    const vector short *__b) {
3216  return (vector short)__builtin_altivec_lvxl(__a, __b);
3217}
3218
3219static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3220  return (vector short)__builtin_altivec_lvxl(__a, __b);
3221}
3222
3223static __inline__ vector unsigned short __ATTRS_o_ai
3224vec_ldl(int __a, const vector unsigned short *__b) {
3225  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3226}
3227
3228static __inline__ vector unsigned short __ATTRS_o_ai
3229vec_ldl(int __a, const unsigned short *__b) {
3230  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3231}
3232
3233static __inline__ vector bool short __ATTRS_o_ai
3234vec_ldl(int __a, const vector bool short *__b) {
3235  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3236}
3237
3238static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3239                                                    const vector pixel *__b) {
3240  return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3241}
3242
3243static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3244                                                  const vector int *__b) {
3245  return (vector int)__builtin_altivec_lvxl(__a, __b);
3246}
3247
3248static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3249  return (vector int)__builtin_altivec_lvxl(__a, __b);
3250}
3251
3252static __inline__ vector unsigned int __ATTRS_o_ai
3253vec_ldl(int __a, const vector unsigned int *__b) {
3254  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3255}
3256
3257static __inline__ vector unsigned int __ATTRS_o_ai
3258vec_ldl(int __a, const unsigned int *__b) {
3259  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3260}
3261
3262static __inline__ vector bool int __ATTRS_o_ai
3263vec_ldl(int __a, const vector bool int *__b) {
3264  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3265}
3266
3267static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3268                                                    const vector float *__b) {
3269  return (vector float)__builtin_altivec_lvxl(__a, __b);
3270}
3271
3272static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3273  return (vector float)__builtin_altivec_lvxl(__a, __b);
3274}
3275
3276/* vec_lvxl */
3277
3278static __inline__ vector signed char __ATTRS_o_ai
3279vec_lvxl(int __a, const vector signed char *__b) {
3280  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3281}
3282
3283static __inline__ vector signed char __ATTRS_o_ai
3284vec_lvxl(int __a, const signed char *__b) {
3285  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3286}
3287
3288static __inline__ vector unsigned char __ATTRS_o_ai
3289vec_lvxl(int __a, const vector unsigned char *__b) {
3290  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3291}
3292
3293static __inline__ vector unsigned char __ATTRS_o_ai
3294vec_lvxl(int __a, const unsigned char *__b) {
3295  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3296}
3297
3298static __inline__ vector bool char __ATTRS_o_ai
3299vec_lvxl(int __a, const vector bool char *__b) {
3300  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3301}
3302
3303static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3304                                                     const vector short *__b) {
3305  return (vector short)__builtin_altivec_lvxl(__a, __b);
3306}
3307
3308static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3309                                                     const short *__b) {
3310  return (vector short)__builtin_altivec_lvxl(__a, __b);
3311}
3312
3313static __inline__ vector unsigned short __ATTRS_o_ai
3314vec_lvxl(int __a, const vector unsigned short *__b) {
3315  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3316}
3317
3318static __inline__ vector unsigned short __ATTRS_o_ai
3319vec_lvxl(int __a, const unsigned short *__b) {
3320  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3321}
3322
3323static __inline__ vector bool short __ATTRS_o_ai
3324vec_lvxl(int __a, const vector bool short *__b) {
3325  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3326}
3327
3328static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3329                                                     const vector pixel *__b) {
3330  return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3331}
3332
3333static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3334                                                   const vector int *__b) {
3335  return (vector int)__builtin_altivec_lvxl(__a, __b);
3336}
3337
3338static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3339  return (vector int)__builtin_altivec_lvxl(__a, __b);
3340}
3341
3342static __inline__ vector unsigned int __ATTRS_o_ai
3343vec_lvxl(int __a, const vector unsigned int *__b) {
3344  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3345}
3346
3347static __inline__ vector unsigned int __ATTRS_o_ai
3348vec_lvxl(int __a, const unsigned int *__b) {
3349  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3350}
3351
3352static __inline__ vector bool int __ATTRS_o_ai
3353vec_lvxl(int __a, const vector bool int *__b) {
3354  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3355}
3356
3357static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3358                                                     const vector float *__b) {
3359  return (vector float)__builtin_altivec_lvxl(__a, __b);
3360}
3361
3362static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3363                                                     const float *__b) {
3364  return (vector float)__builtin_altivec_lvxl(__a, __b);
3365}
3366
3367/* vec_loge */
3368
3369static __inline__ vector float __attribute__((__always_inline__))
3370vec_loge(vector float __a) {
3371  return __builtin_altivec_vlogefp(__a);
3372}
3373
3374/* vec_vlogefp */
3375
3376static __inline__ vector float __attribute__((__always_inline__))
3377vec_vlogefp(vector float __a) {
3378  return __builtin_altivec_vlogefp(__a);
3379}
3380
3381/* vec_lvsl */
3382
3383#ifdef __LITTLE_ENDIAN__
3384static __inline__ vector unsigned char __ATTRS_o_ai
3385    __attribute__((__deprecated__("use assignment for unaligned little endian \
3386loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3387  vector unsigned char mask =
3388      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3389  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3390                                  7,  6,  5,  4,  3,  2,  1, 0};
3391  return vec_perm(mask, mask, reverse);
3392}
3393#else
3394static __inline__ vector unsigned char __ATTRS_o_ai
3395vec_lvsl(int __a, const signed char *__b) {
3396  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3397}
3398#endif
3399
3400#ifdef __LITTLE_ENDIAN__
3401static __inline__ vector unsigned char __ATTRS_o_ai
3402    __attribute__((__deprecated__("use assignment for unaligned little endian \
3403loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3404  vector unsigned char mask =
3405      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3406  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3407                                  7,  6,  5,  4,  3,  2,  1, 0};
3408  return vec_perm(mask, mask, reverse);
3409}
3410#else
3411static __inline__ vector unsigned char __ATTRS_o_ai
3412vec_lvsl(int __a, const unsigned char *__b) {
3413  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3414}
3415#endif
3416
3417#ifdef __LITTLE_ENDIAN__
3418static __inline__ vector unsigned char __ATTRS_o_ai
3419    __attribute__((__deprecated__("use assignment for unaligned little endian \
3420loads/stores"))) vec_lvsl(int __a, const short *__b) {
3421  vector unsigned char mask =
3422      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3423  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3424                                  7,  6,  5,  4,  3,  2,  1, 0};
3425  return vec_perm(mask, mask, reverse);
3426}
3427#else
3428static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3429                                                             const short *__b) {
3430  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3431}
3432#endif
3433
3434#ifdef __LITTLE_ENDIAN__
3435static __inline__ vector unsigned char __ATTRS_o_ai
3436    __attribute__((__deprecated__("use assignment for unaligned little endian \
3437loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3438  vector unsigned char mask =
3439      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3440  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3441                                  7,  6,  5,  4,  3,  2,  1, 0};
3442  return vec_perm(mask, mask, reverse);
3443}
3444#else
3445static __inline__ vector unsigned char __ATTRS_o_ai
3446vec_lvsl(int __a, const unsigned short *__b) {
3447  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3448}
3449#endif
3450
3451#ifdef __LITTLE_ENDIAN__
3452static __inline__ vector unsigned char __ATTRS_o_ai
3453    __attribute__((__deprecated__("use assignment for unaligned little endian \
3454loads/stores"))) vec_lvsl(int __a, const int *__b) {
3455  vector unsigned char mask =
3456      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3457  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3458                                  7,  6,  5,  4,  3,  2,  1, 0};
3459  return vec_perm(mask, mask, reverse);
3460}
3461#else
3462static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3463                                                             const int *__b) {
3464  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3465}
3466#endif
3467
3468#ifdef __LITTLE_ENDIAN__
3469static __inline__ vector unsigned char __ATTRS_o_ai
3470    __attribute__((__deprecated__("use assignment for unaligned little endian \
3471loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
3472  vector unsigned char mask =
3473      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3474  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3475                                  7,  6,  5,  4,  3,  2,  1, 0};
3476  return vec_perm(mask, mask, reverse);
3477}
3478#else
3479static __inline__ vector unsigned char __ATTRS_o_ai
3480vec_lvsl(int __a, const unsigned int *__b) {
3481  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3482}
3483#endif
3484
3485#ifdef __LITTLE_ENDIAN__
3486static __inline__ vector unsigned char __ATTRS_o_ai
3487    __attribute__((__deprecated__("use assignment for unaligned little endian \
3488loads/stores"))) vec_lvsl(int __a, const float *__b) {
3489  vector unsigned char mask =
3490      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3491  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3492                                  7,  6,  5,  4,  3,  2,  1, 0};
3493  return vec_perm(mask, mask, reverse);
3494}
3495#else
3496static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3497                                                             const float *__b) {
3498  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3499}
3500#endif
3501
3502/* vec_lvsr */
3503
3504#ifdef __LITTLE_ENDIAN__
3505static __inline__ vector unsigned char __ATTRS_o_ai
3506    __attribute__((__deprecated__("use assignment for unaligned little endian \
3507loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
3508  vector unsigned char mask =
3509      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3510  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3511                                  7,  6,  5,  4,  3,  2,  1, 0};
3512  return vec_perm(mask, mask, reverse);
3513}
3514#else
3515static __inline__ vector unsigned char __ATTRS_o_ai
3516vec_lvsr(int __a, const signed char *__b) {
3517  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3518}
3519#endif
3520
3521#ifdef __LITTLE_ENDIAN__
3522static __inline__ vector unsigned char __ATTRS_o_ai
3523    __attribute__((__deprecated__("use assignment for unaligned little endian \
3524loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
3525  vector unsigned char mask =
3526      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3527  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3528                                  7,  6,  5,  4,  3,  2,  1, 0};
3529  return vec_perm(mask, mask, reverse);
3530}
3531#else
3532static __inline__ vector unsigned char __ATTRS_o_ai
3533vec_lvsr(int __a, const unsigned char *__b) {
3534  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3535}
3536#endif
3537
3538#ifdef __LITTLE_ENDIAN__
3539static __inline__ vector unsigned char __ATTRS_o_ai
3540    __attribute__((__deprecated__("use assignment for unaligned little endian \
3541loads/stores"))) vec_lvsr(int __a, const short *__b) {
3542  vector unsigned char mask =
3543      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3544  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3545                                  7,  6,  5,  4,  3,  2,  1, 0};
3546  return vec_perm(mask, mask, reverse);
3547}
3548#else
3549static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
3550                                                             const short *__b) {
3551  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3552}
3553#endif
3554
3555#ifdef __LITTLE_ENDIAN__
3556static __inline__ vector unsigned char __ATTRS_o_ai
3557    __attribute__((__deprecated__("use assignment for unaligned little endian \
3558loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
3559  vector unsigned char mask =
3560      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3561  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3562                                  7,  6,  5,  4,  3,  2,  1, 0};
3563  return vec_perm(mask, mask, reverse);
3564}
3565#else
3566static __inline__ vector unsigned char __ATTRS_o_ai
3567vec_lvsr(int __a, const unsigned short *__b) {
3568  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3569}
3570#endif
3571
3572#ifdef __LITTLE_ENDIAN__
3573static __inline__ vector unsigned char __ATTRS_o_ai
3574    __attribute__((__deprecated__("use assignment for unaligned little endian \
3575loads/stores"))) vec_lvsr(int __a, const int *__b) {
3576  vector unsigned char mask =
3577      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3578  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3579                                  7,  6,  5,  4,  3,  2,  1, 0};
3580  return vec_perm(mask, mask, reverse);
3581}
3582#else
3583static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
3584                                                             const int *__b) {
3585  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3586}
3587#endif
3588
3589#ifdef __LITTLE_ENDIAN__
3590static __inline__ vector unsigned char __ATTRS_o_ai
3591    __attribute__((__deprecated__("use assignment for unaligned little endian \
3592loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
3593  vector unsigned char mask =
3594      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3595  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3596                                  7,  6,  5,  4,  3,  2,  1, 0};
3597  return vec_perm(mask, mask, reverse);
3598}
3599#else
3600static __inline__ vector unsigned char __ATTRS_o_ai
3601vec_lvsr(int __a, const unsigned int *__b) {
3602  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3603}
3604#endif
3605
3606#ifdef __LITTLE_ENDIAN__
3607static __inline__ vector unsigned char __ATTRS_o_ai
3608    __attribute__((__deprecated__("use assignment for unaligned little endian \
3609loads/stores"))) vec_lvsr(int __a, const float *__b) {
3610  vector unsigned char mask =
3611      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3612  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3613                                  7,  6,  5,  4,  3,  2,  1, 0};
3614  return vec_perm(mask, mask, reverse);
3615}
3616#else
3617static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
3618                                                             const float *__b) {
3619  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
3620}
3621#endif
3622
3623/* vec_madd */
3624static __inline__ vector signed short __ATTRS_o_ai
3625vec_mladd(vector signed short, vector signed short, vector signed short);
3626static __inline__ vector signed short __ATTRS_o_ai
3627vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
3628static __inline__ vector signed short __ATTRS_o_ai
3629vec_mladd(vector unsigned short, vector signed short, vector signed short);
3630static __inline__ vector unsigned short __ATTRS_o_ai
3631vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
3632
3633static __inline__ vector signed short __ATTRS_o_ai vec_madd(
3634    vector signed short __a, vector signed short __b, vector signed short __c) {
3635  return vec_mladd(__a, __b, __c);
3636}
3637
3638static __inline__ vector signed short __ATTRS_o_ai
3639vec_madd(vector signed short __a, vector unsigned short __b,
3640         vector unsigned short __c) {
3641  return vec_mladd(__a, __b, __c);
3642}
3643
3644static __inline__ vector signed short __ATTRS_o_ai
3645vec_madd(vector unsigned short __a, vector signed short __b,
3646         vector signed short __c) {
3647  return vec_mladd(__a, __b, __c);
3648}
3649
3650static __inline__ vector unsigned short __ATTRS_o_ai
3651vec_madd(vector unsigned short __a, vector unsigned short __b,
3652         vector unsigned short __c) {
3653  return vec_mladd(__a, __b, __c);
3654}
3655
3656static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
3657                                                     vector float __b,
3658                                                     vector float __c) {
3659#ifdef __VSX__
3660  return __builtin_vsx_xvmaddasp(__a, __b, __c);
3661#else
3662  return __builtin_altivec_vmaddfp(__a, __b, __c);
3663#endif
3664}
3665
3666#ifdef __VSX__
3667static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
3668                                                      vector double __b,
3669                                                      vector double __c) {
3670  return __builtin_vsx_xvmaddadp(__a, __b, __c);
3671}
3672#endif
3673
3674/* vec_vmaddfp */
3675
3676static __inline__ vector float __attribute__((__always_inline__))
3677vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
3678  return __builtin_altivec_vmaddfp(__a, __b, __c);
3679}
3680
3681/* vec_madds */
3682
3683static __inline__ vector signed short __attribute__((__always_inline__))
3684vec_madds(vector signed short __a, vector signed short __b,
3685          vector signed short __c) {
3686  return __builtin_altivec_vmhaddshs(__a, __b, __c);
3687}
3688
3689/* vec_vmhaddshs */
3690static __inline__ vector signed short __attribute__((__always_inline__))
3691vec_vmhaddshs(vector signed short __a, vector signed short __b,
3692              vector signed short __c) {
3693  return __builtin_altivec_vmhaddshs(__a, __b, __c);
3694}
3695
3696/* vec_msub */
3697
3698#ifdef __VSX__
3699static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
3700                                                     vector float __b,
3701                                                     vector float __c) {
3702  return __builtin_vsx_xvmsubasp(__a, __b, __c);
3703}
3704
3705static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
3706                                                      vector double __b,
3707                                                      vector double __c) {
3708  return __builtin_vsx_xvmsubadp(__a, __b, __c);
3709}
3710#endif
3711
3712/* vec_max */
3713
3714static __inline__ vector signed char __ATTRS_o_ai
3715vec_max(vector signed char __a, vector signed char __b) {
3716  return __builtin_altivec_vmaxsb(__a, __b);
3717}
3718
3719static __inline__ vector signed char __ATTRS_o_ai
3720vec_max(vector bool char __a, vector signed char __b) {
3721  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3722}
3723
3724static __inline__ vector signed char __ATTRS_o_ai
3725vec_max(vector signed char __a, vector bool char __b) {
3726  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3727}
3728
3729static __inline__ vector unsigned char __ATTRS_o_ai
3730vec_max(vector unsigned char __a, vector unsigned char __b) {
3731  return __builtin_altivec_vmaxub(__a, __b);
3732}
3733
3734static __inline__ vector unsigned char __ATTRS_o_ai
3735vec_max(vector bool char __a, vector unsigned char __b) {
3736  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3737}
3738
3739static __inline__ vector unsigned char __ATTRS_o_ai
3740vec_max(vector unsigned char __a, vector bool char __b) {
3741  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3742}
3743
3744static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3745                                                    vector short __b) {
3746  return __builtin_altivec_vmaxsh(__a, __b);
3747}
3748
3749static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
3750                                                    vector short __b) {
3751  return __builtin_altivec_vmaxsh((vector short)__a, __b);
3752}
3753
3754static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3755                                                    vector bool short __b) {
3756  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3757}
3758
3759static __inline__ vector unsigned short __ATTRS_o_ai
3760vec_max(vector unsigned short __a, vector unsigned short __b) {
3761  return __builtin_altivec_vmaxuh(__a, __b);
3762}
3763
3764static __inline__ vector unsigned short __ATTRS_o_ai
3765vec_max(vector bool short __a, vector unsigned short __b) {
3766  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3767}
3768
3769static __inline__ vector unsigned short __ATTRS_o_ai
3770vec_max(vector unsigned short __a, vector bool short __b) {
3771  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3772}
3773
3774static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3775                                                  vector int __b) {
3776  return __builtin_altivec_vmaxsw(__a, __b);
3777}
3778
3779static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
3780                                                  vector int __b) {
3781  return __builtin_altivec_vmaxsw((vector int)__a, __b);
3782}
3783
3784static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3785                                                  vector bool int __b) {
3786  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3787}
3788
3789static __inline__ vector unsigned int __ATTRS_o_ai
3790vec_max(vector unsigned int __a, vector unsigned int __b) {
3791  return __builtin_altivec_vmaxuw(__a, __b);
3792}
3793
3794static __inline__ vector unsigned int __ATTRS_o_ai
3795vec_max(vector bool int __a, vector unsigned int __b) {
3796  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3797}
3798
3799static __inline__ vector unsigned int __ATTRS_o_ai
3800vec_max(vector unsigned int __a, vector bool int __b) {
3801  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3802}
3803
3804#ifdef __POWER8_VECTOR__
3805static __inline__ vector signed long long __ATTRS_o_ai
3806vec_max(vector signed long long __a, vector signed long long __b) {
3807  return __builtin_altivec_vmaxsd(__a, __b);
3808}
3809
3810static __inline__ vector signed long long __ATTRS_o_ai
3811vec_max(vector bool long long __a, vector signed long long __b) {
3812  return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
3813}
3814
3815static __inline__ vector signed long long __ATTRS_o_ai
3816vec_max(vector signed long long __a, vector bool long long __b) {
3817  return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
3818}
3819
3820static __inline__ vector unsigned long long __ATTRS_o_ai
3821vec_max(vector unsigned long long __a, vector unsigned long long __b) {
3822  return __builtin_altivec_vmaxud(__a, __b);
3823}
3824
3825static __inline__ vector unsigned long long __ATTRS_o_ai
3826vec_max(vector bool long long __a, vector unsigned long long __b) {
3827  return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
3828}
3829
3830static __inline__ vector unsigned long long __ATTRS_o_ai
3831vec_max(vector unsigned long long __a, vector bool long long __b) {
3832  return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
3833}
3834#endif
3835
3836static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
3837                                                    vector float __b) {
3838#ifdef __VSX__
3839  return __builtin_vsx_xvmaxsp(__a, __b);
3840#else
3841  return __builtin_altivec_vmaxfp(__a, __b);
3842#endif
3843}
3844
3845#ifdef __VSX__
3846static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
3847                                                     vector double __b) {
3848  return __builtin_vsx_xvmaxdp(__a, __b);
3849}
3850#endif
3851
3852/* vec_vmaxsb */
3853
3854static __inline__ vector signed char __ATTRS_o_ai
3855vec_vmaxsb(vector signed char __a, vector signed char __b) {
3856  return __builtin_altivec_vmaxsb(__a, __b);
3857}
3858
3859static __inline__ vector signed char __ATTRS_o_ai
3860vec_vmaxsb(vector bool char __a, vector signed char __b) {
3861  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3862}
3863
3864static __inline__ vector signed char __ATTRS_o_ai
3865vec_vmaxsb(vector signed char __a, vector bool char __b) {
3866  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3867}
3868
3869/* vec_vmaxub */
3870
3871static __inline__ vector unsigned char __ATTRS_o_ai
3872vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
3873  return __builtin_altivec_vmaxub(__a, __b);
3874}
3875
3876static __inline__ vector unsigned char __ATTRS_o_ai
3877vec_vmaxub(vector bool char __a, vector unsigned char __b) {
3878  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3879}
3880
3881static __inline__ vector unsigned char __ATTRS_o_ai
3882vec_vmaxub(vector unsigned char __a, vector bool char __b) {
3883  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3884}
3885
3886/* vec_vmaxsh */
3887
3888static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3889                                                       vector short __b) {
3890  return __builtin_altivec_vmaxsh(__a, __b);
3891}
3892
3893static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
3894                                                       vector short __b) {
3895  return __builtin_altivec_vmaxsh((vector short)__a, __b);
3896}
3897
3898static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3899                                                       vector bool short __b) {
3900  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3901}
3902
3903/* vec_vmaxuh */
3904
3905static __inline__ vector unsigned short __ATTRS_o_ai
3906vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
3907  return __builtin_altivec_vmaxuh(__a, __b);
3908}
3909
3910static __inline__ vector unsigned short __ATTRS_o_ai
3911vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
3912  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3913}
3914
3915static __inline__ vector unsigned short __ATTRS_o_ai
3916vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
3917  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3918}
3919
3920/* vec_vmaxsw */
3921
3922static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3923                                                     vector int __b) {
3924  return __builtin_altivec_vmaxsw(__a, __b);
3925}
3926
3927static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
3928                                                     vector int __b) {
3929  return __builtin_altivec_vmaxsw((vector int)__a, __b);
3930}
3931
3932static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3933                                                     vector bool int __b) {
3934  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3935}
3936
3937/* vec_vmaxuw */
3938
3939static __inline__ vector unsigned int __ATTRS_o_ai
3940vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
3941  return __builtin_altivec_vmaxuw(__a, __b);
3942}
3943
3944static __inline__ vector unsigned int __ATTRS_o_ai
3945vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
3946  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3947}
3948
3949static __inline__ vector unsigned int __ATTRS_o_ai
3950vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
3951  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3952}
3953
3954/* vec_vmaxfp */
3955
3956static __inline__ vector float __attribute__((__always_inline__))
3957vec_vmaxfp(vector float __a, vector float __b) {
3958#ifdef __VSX__
3959  return __builtin_vsx_xvmaxsp(__a, __b);
3960#else
3961  return __builtin_altivec_vmaxfp(__a, __b);
3962#endif
3963}
3964
3965/* vec_mergeh */
3966
3967static __inline__ vector signed char __ATTRS_o_ai
3968vec_mergeh(vector signed char __a, vector signed char __b) {
3969  return vec_perm(__a, __b,
3970                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3971                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3972                                         0x06, 0x16, 0x07, 0x17));
3973}
3974
3975static __inline__ vector unsigned char __ATTRS_o_ai
3976vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
3977  return vec_perm(__a, __b,
3978                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3979                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3980                                         0x06, 0x16, 0x07, 0x17));
3981}
3982
3983static __inline__ vector bool char __ATTRS_o_ai
3984vec_mergeh(vector bool char __a, vector bool char __b) {
3985  return vec_perm(__a, __b,
3986                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3987                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3988                                         0x06, 0x16, 0x07, 0x17));
3989}
3990
3991static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
3992                                                       vector short __b) {
3993  return vec_perm(__a, __b,
3994                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3995                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3996                                         0x06, 0x07, 0x16, 0x17));
3997}
3998
3999static __inline__ vector unsigned short __ATTRS_o_ai
4000vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4001  return vec_perm(__a, __b,
4002                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4003                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4004                                         0x06, 0x07, 0x16, 0x17));
4005}
4006
4007static __inline__ vector bool short __ATTRS_o_ai
4008vec_mergeh(vector bool short __a, vector bool short __b) {
4009  return vec_perm(__a, __b,
4010                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4011                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4012                                         0x06, 0x07, 0x16, 0x17));
4013}
4014
4015static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4016                                                       vector pixel __b) {
4017  return vec_perm(__a, __b,
4018                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4019                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4020                                         0x06, 0x07, 0x16, 0x17));
4021}
4022
4023static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4024                                                     vector int __b) {
4025  return vec_perm(__a, __b,
4026                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4027                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4028                                         0x14, 0x15, 0x16, 0x17));
4029}
4030
4031static __inline__ vector unsigned int __ATTRS_o_ai
4032vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4033  return vec_perm(__a, __b,
4034                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4035                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4036                                         0x14, 0x15, 0x16, 0x17));
4037}
4038
4039static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4040                                                          vector bool int __b) {
4041  return vec_perm(__a, __b,
4042                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4043                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4044                                         0x14, 0x15, 0x16, 0x17));
4045}
4046
4047static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4048                                                       vector float __b) {
4049  return vec_perm(__a, __b,
4050                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4051                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4052                                         0x14, 0x15, 0x16, 0x17));
4053}
4054
4055#ifdef __VSX__
4056static __inline__ vector signed long long __ATTRS_o_ai
4057vec_mergeh(vector signed long long __a, vector signed long long __b) {
4058  return vec_perm(__a, __b,
4059                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4060                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4061                                         0x14, 0x15, 0x16, 0x17));
4062}
4063
4064static __inline__ vector signed long long __ATTRS_o_ai
4065vec_mergeh(vector signed long long __a, vector bool long long __b) {
4066  return vec_perm(__a, (vector signed long long)__b,
4067                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4068                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4069                                         0x14, 0x15, 0x16, 0x17));
4070}
4071
4072static __inline__ vector signed long long __ATTRS_o_ai
4073vec_mergeh(vector bool long long __a, vector signed long long __b) {
4074  return vec_perm((vector signed long long)__a, __b,
4075                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4076                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4077                                         0x14, 0x15, 0x16, 0x17));
4078}
4079
4080static __inline__ vector unsigned long long __ATTRS_o_ai
4081vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4082  return vec_perm(__a, __b,
4083                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4084                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4085                                         0x14, 0x15, 0x16, 0x17));
4086}
4087
4088static __inline__ vector unsigned long long __ATTRS_o_ai
4089vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4090  return vec_perm(__a, (vector unsigned long long)__b,
4091                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4092                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4093                                         0x14, 0x15, 0x16, 0x17));
4094}
4095
4096static __inline__ vector unsigned long long __ATTRS_o_ai
4097vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4098  return vec_perm((vector unsigned long long)__a, __b,
4099                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4100                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4101                                         0x14, 0x15, 0x16, 0x17));
4102}
4103
4104static __inline__ vector bool long long __ATTRS_o_ai
4105vec_mergeh(vector bool long long __a, vector bool long long __b) {
4106  return vec_perm(__a, __b,
4107                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4108                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4109                                         0x14, 0x15, 0x16, 0x17));
4110}
4111
4112static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4113                                                        vector double __b) {
4114  return vec_perm(__a, __b,
4115                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4116                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4117                                         0x14, 0x15, 0x16, 0x17));
4118}
4119static __inline__ vector double __ATTRS_o_ai
4120vec_mergeh(vector double __a, vector bool long long __b) {
4121  return vec_perm(__a, (vector double)__b,
4122                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4123                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4124                                         0x14, 0x15, 0x16, 0x17));
4125}
4126static __inline__ vector double __ATTRS_o_ai
4127vec_mergeh(vector bool long long __a, vector double __b) {
4128  return vec_perm((vector double)__a, __b,
4129                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4130                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4131                                         0x14, 0x15, 0x16, 0x17));
4132}
4133#endif
4134
4135/* vec_vmrghb */
4136
4137#define __builtin_altivec_vmrghb vec_vmrghb
4138
4139static __inline__ vector signed char __ATTRS_o_ai
4140vec_vmrghb(vector signed char __a, vector signed char __b) {
4141  return vec_perm(__a, __b,
4142                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4143                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4144                                         0x06, 0x16, 0x07, 0x17));
4145}
4146
4147static __inline__ vector unsigned char __ATTRS_o_ai
4148vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4149  return vec_perm(__a, __b,
4150                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4151                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4152                                         0x06, 0x16, 0x07, 0x17));
4153}
4154
4155static __inline__ vector bool char __ATTRS_o_ai
4156vec_vmrghb(vector bool char __a, vector bool char __b) {
4157  return vec_perm(__a, __b,
4158                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4159                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4160                                         0x06, 0x16, 0x07, 0x17));
4161}
4162
4163/* vec_vmrghh */
4164
4165#define __builtin_altivec_vmrghh vec_vmrghh
4166
4167static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4168                                                       vector short __b) {
4169  return vec_perm(__a, __b,
4170                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4171                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4172                                         0x06, 0x07, 0x16, 0x17));
4173}
4174
4175static __inline__ vector unsigned short __ATTRS_o_ai
4176vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4177  return vec_perm(__a, __b,
4178                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4179                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4180                                         0x06, 0x07, 0x16, 0x17));
4181}
4182
4183static __inline__ vector bool short __ATTRS_o_ai
4184vec_vmrghh(vector bool short __a, vector bool short __b) {
4185  return vec_perm(__a, __b,
4186                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4187                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4188                                         0x06, 0x07, 0x16, 0x17));
4189}
4190
4191static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4192                                                       vector pixel __b) {
4193  return vec_perm(__a, __b,
4194                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4195                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4196                                         0x06, 0x07, 0x16, 0x17));
4197}
4198
4199/* vec_vmrghw */
4200
4201#define __builtin_altivec_vmrghw vec_vmrghw
4202
4203static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4204                                                     vector int __b) {
4205  return vec_perm(__a, __b,
4206                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4207                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4208                                         0x14, 0x15, 0x16, 0x17));
4209}
4210
4211static __inline__ vector unsigned int __ATTRS_o_ai
4212vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4213  return vec_perm(__a, __b,
4214                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4215                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4216                                         0x14, 0x15, 0x16, 0x17));
4217}
4218
4219static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4220                                                          vector bool int __b) {
4221  return vec_perm(__a, __b,
4222                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4223                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4224                                         0x14, 0x15, 0x16, 0x17));
4225}
4226
4227static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4228                                                       vector float __b) {
4229  return vec_perm(__a, __b,
4230                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4231                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4232                                         0x14, 0x15, 0x16, 0x17));
4233}
4234
4235/* vec_mergel */
4236
4237static __inline__ vector signed char __ATTRS_o_ai
4238vec_mergel(vector signed char __a, vector signed char __b) {
4239  return vec_perm(__a, __b,
4240                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4241                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4242                                         0x0E, 0x1E, 0x0F, 0x1F));
4243}
4244
4245static __inline__ vector unsigned char __ATTRS_o_ai
4246vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4247  return vec_perm(__a, __b,
4248                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4249                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4250                                         0x0E, 0x1E, 0x0F, 0x1F));
4251}
4252
4253static __inline__ vector bool char __ATTRS_o_ai
4254vec_mergel(vector bool char __a, vector bool char __b) {
4255  return vec_perm(__a, __b,
4256                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4257                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4258                                         0x0E, 0x1E, 0x0F, 0x1F));
4259}
4260
4261static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4262                                                       vector short __b) {
4263  return vec_perm(__a, __b,
4264                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4265                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4266                                         0x0E, 0x0F, 0x1E, 0x1F));
4267}
4268
4269static __inline__ vector unsigned short __ATTRS_o_ai
4270vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4271  return vec_perm(__a, __b,
4272                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4273                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4274                                         0x0E, 0x0F, 0x1E, 0x1F));
4275}
4276
4277static __inline__ vector bool short __ATTRS_o_ai
4278vec_mergel(vector bool short __a, vector bool short __b) {
4279  return vec_perm(__a, __b,
4280                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4281                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4282                                         0x0E, 0x0F, 0x1E, 0x1F));
4283}
4284
4285static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4286                                                       vector pixel __b) {
4287  return vec_perm(__a, __b,
4288                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4289                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4290                                         0x0E, 0x0F, 0x1E, 0x1F));
4291}
4292
4293static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4294                                                     vector int __b) {
4295  return vec_perm(__a, __b,
4296                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4297                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4298                                         0x1C, 0x1D, 0x1E, 0x1F));
4299}
4300
4301static __inline__ vector unsigned int __ATTRS_o_ai
4302vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4303  return vec_perm(__a, __b,
4304                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4305                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4306                                         0x1C, 0x1D, 0x1E, 0x1F));
4307}
4308
4309static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4310                                                          vector bool int __b) {
4311  return vec_perm(__a, __b,
4312                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4313                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4314                                         0x1C, 0x1D, 0x1E, 0x1F));
4315}
4316
4317static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4318                                                       vector float __b) {
4319  return vec_perm(__a, __b,
4320                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4321                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4322                                         0x1C, 0x1D, 0x1E, 0x1F));
4323}
4324
4325#ifdef __VSX__
4326static __inline__ vector signed long long __ATTRS_o_ai
4327vec_mergel(vector signed long long __a, vector signed long long __b) {
4328  return vec_perm(__a, __b,
4329                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4330                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4331                                         0x1C, 0x1D, 0x1E, 0x1F));
4332}
4333static __inline__ vector signed long long __ATTRS_o_ai
4334vec_mergel(vector signed long long __a, vector bool long long __b) {
4335  return vec_perm(__a, (vector signed long long)__b,
4336                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4337                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4338                                         0x1C, 0x1D, 0x1E, 0x1F));
4339}
4340static __inline__ vector signed long long __ATTRS_o_ai
4341vec_mergel(vector bool long long __a, vector signed long long __b) {
4342  return vec_perm((vector signed long long)__a, __b,
4343                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4344                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4345                                         0x1C, 0x1D, 0x1E, 0x1F));
4346}
4347static __inline__ vector unsigned long long __ATTRS_o_ai
4348vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4349  return vec_perm(__a, __b,
4350                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4351                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4352                                         0x1C, 0x1D, 0x1E, 0x1F));
4353}
4354static __inline__ vector unsigned long long __ATTRS_o_ai
4355vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4356  return vec_perm(__a, (vector unsigned long long)__b,
4357                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4358                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4359                                         0x1C, 0x1D, 0x1E, 0x1F));
4360}
4361static __inline__ vector unsigned long long __ATTRS_o_ai
4362vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4363  return vec_perm((vector unsigned long long)__a, __b,
4364                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4365                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4366                                         0x1C, 0x1D, 0x1E, 0x1F));
4367}
4368static __inline__ vector bool long long __ATTRS_o_ai
4369vec_mergel(vector bool long long __a, vector bool long long __b) {
4370  return vec_perm(__a, __b,
4371                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4372                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4373                                         0x1C, 0x1D, 0x1E, 0x1F));
4374}
4375static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4376                                                        vector double __b) {
4377  return vec_perm(__a, __b,
4378                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4379                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4380                                         0x1C, 0x1D, 0x1E, 0x1F));
4381}
4382static __inline__ vector double __ATTRS_o_ai
4383vec_mergel(vector double __a, vector bool long long __b) {
4384  return vec_perm(__a, (vector double)__b,
4385                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4386                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4387                                         0x1C, 0x1D, 0x1E, 0x1F));
4388}
4389static __inline__ vector double __ATTRS_o_ai
4390vec_mergel(vector bool long long __a, vector double __b) {
4391  return vec_perm((vector double)__a, __b,
4392                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4393                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4394                                         0x1C, 0x1D, 0x1E, 0x1F));
4395}
4396#endif
4397
4398/* vec_vmrglb */
4399
4400#define __builtin_altivec_vmrglb vec_vmrglb
4401
4402static __inline__ vector signed char __ATTRS_o_ai
4403vec_vmrglb(vector signed char __a, vector signed char __b) {
4404  return vec_perm(__a, __b,
4405                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4406                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4407                                         0x0E, 0x1E, 0x0F, 0x1F));
4408}
4409
4410static __inline__ vector unsigned char __ATTRS_o_ai
4411vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4412  return vec_perm(__a, __b,
4413                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4414                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4415                                         0x0E, 0x1E, 0x0F, 0x1F));
4416}
4417
4418static __inline__ vector bool char __ATTRS_o_ai
4419vec_vmrglb(vector bool char __a, vector bool char __b) {
4420  return vec_perm(__a, __b,
4421                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4422                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4423                                         0x0E, 0x1E, 0x0F, 0x1F));
4424}
4425
4426/* vec_vmrglh */
4427
4428#define __builtin_altivec_vmrglh vec_vmrglh
4429
4430static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4431                                                       vector short __b) {
4432  return vec_perm(__a, __b,
4433                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4434                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4435                                         0x0E, 0x0F, 0x1E, 0x1F));
4436}
4437
4438static __inline__ vector unsigned short __ATTRS_o_ai
4439vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4440  return vec_perm(__a, __b,
4441                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4442                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4443                                         0x0E, 0x0F, 0x1E, 0x1F));
4444}
4445
4446static __inline__ vector bool short __ATTRS_o_ai
4447vec_vmrglh(vector bool short __a, vector bool short __b) {
4448  return vec_perm(__a, __b,
4449                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4450                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4451                                         0x0E, 0x0F, 0x1E, 0x1F));
4452}
4453
4454static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4455                                                       vector pixel __b) {
4456  return vec_perm(__a, __b,
4457                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4458                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4459                                         0x0E, 0x0F, 0x1E, 0x1F));
4460}
4461
4462/* vec_vmrglw */
4463
4464#define __builtin_altivec_vmrglw vec_vmrglw
4465
4466static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4467                                                     vector int __b) {
4468  return vec_perm(__a, __b,
4469                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4470                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4471                                         0x1C, 0x1D, 0x1E, 0x1F));
4472}
4473
4474static __inline__ vector unsigned int __ATTRS_o_ai
4475vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
4476  return vec_perm(__a, __b,
4477                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4478                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4479                                         0x1C, 0x1D, 0x1E, 0x1F));
4480}
4481
4482static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
4483                                                          vector bool int __b) {
4484  return vec_perm(__a, __b,
4485                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4486                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4487                                         0x1C, 0x1D, 0x1E, 0x1F));
4488}
4489
4490static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
4491                                                       vector float __b) {
4492  return vec_perm(__a, __b,
4493                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4494                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4495                                         0x1C, 0x1D, 0x1E, 0x1F));
4496}
4497
4498#ifdef __POWER8_VECTOR__
4499/* vec_mergee */
4500
4501static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
4502                                                          vector bool int __b) {
4503  return vec_perm(__a, __b,
4504                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4505                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
4506                                         0x18, 0x19, 0x1A, 0x1B));
4507}
4508
4509static __inline__ vector signed int __ATTRS_o_ai
4510vec_mergee(vector signed int __a, vector signed int __b) {
4511  return vec_perm(__a, __b,
4512                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4513                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
4514                                         0x18, 0x19, 0x1A, 0x1B));
4515}
4516
4517static __inline__ vector unsigned int __ATTRS_o_ai
4518vec_mergee(vector unsigned int __a, vector unsigned int __b) {
4519  return vec_perm(__a, __b,
4520                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4521                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
4522                                         0x18, 0x19, 0x1A, 0x1B));
4523}
4524
4525/* vec_mergeo */
4526
4527static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
4528                                                          vector bool int __b) {
4529  return vec_perm(__a, __b,
4530                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
4531                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
4532                                         0x1C, 0x1D, 0x1E, 0x1F));
4533}
4534
4535static __inline__ vector signed int __ATTRS_o_ai
4536vec_mergeo(vector signed int __a, vector signed int __b) {
4537  return vec_perm(__a, __b,
4538                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
4539                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
4540                                         0x1C, 0x1D, 0x1E, 0x1F));
4541}
4542
4543static __inline__ vector unsigned int __ATTRS_o_ai
4544vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
4545  return vec_perm(__a, __b,
4546                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
4547                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
4548                                         0x1C, 0x1D, 0x1E, 0x1F));
4549}
4550
4551#endif
4552
4553/* vec_mfvscr */
4554
4555static __inline__ vector unsigned short __attribute__((__always_inline__))
4556vec_mfvscr(void) {
4557  return __builtin_altivec_mfvscr();
4558}
4559
4560/* vec_min */
4561
4562static __inline__ vector signed char __ATTRS_o_ai
4563vec_min(vector signed char __a, vector signed char __b) {
4564  return __builtin_altivec_vminsb(__a, __b);
4565}
4566
4567static __inline__ vector signed char __ATTRS_o_ai
4568vec_min(vector bool char __a, vector signed char __b) {
4569  return __builtin_altivec_vminsb((vector signed char)__a, __b);
4570}
4571
4572static __inline__ vector signed char __ATTRS_o_ai
4573vec_min(vector signed char __a, vector bool char __b) {
4574  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
4575}
4576
4577static __inline__ vector unsigned char __ATTRS_o_ai
4578vec_min(vector unsigned char __a, vector unsigned char __b) {
4579  return __builtin_altivec_vminub(__a, __b);
4580}
4581
4582static __inline__ vector unsigned char __ATTRS_o_ai
4583vec_min(vector bool char __a, vector unsigned char __b) {
4584  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
4585}
4586
4587static __inline__ vector unsigned char __ATTRS_o_ai
4588vec_min(vector unsigned char __a, vector bool char __b) {
4589  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
4590}
4591
4592static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
4593                                                    vector short __b) {
4594  return __builtin_altivec_vminsh(__a, __b);
4595}
4596
4597static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
4598                                                    vector short __b) {
4599  return __builtin_altivec_vminsh((vector short)__a, __b);
4600}
4601
4602static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
4603                                                    vector bool short __b) {
4604  return __builtin_altivec_vminsh(__a, (vector short)__b);
4605}
4606
4607static __inline__ vector unsigned short __ATTRS_o_ai
4608vec_min(vector unsigned short __a, vector unsigned short __b) {
4609  return __builtin_altivec_vminuh(__a, __b);
4610}
4611
4612static __inline__ vector unsigned short __ATTRS_o_ai
4613vec_min(vector bool short __a, vector unsigned short __b) {
4614  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
4615}
4616
4617static __inline__ vector unsigned short __ATTRS_o_ai
4618vec_min(vector unsigned short __a, vector bool short __b) {
4619  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
4620}
4621
4622static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
4623                                                  vector int __b) {
4624  return __builtin_altivec_vminsw(__a, __b);
4625}
4626
4627static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
4628                                                  vector int __b) {
4629  return __builtin_altivec_vminsw((vector int)__a, __b);
4630}
4631
4632static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
4633                                                  vector bool int __b) {
4634  return __builtin_altivec_vminsw(__a, (vector int)__b);
4635}
4636
4637static __inline__ vector unsigned int __ATTRS_o_ai
4638vec_min(vector unsigned int __a, vector unsigned int __b) {
4639  return __builtin_altivec_vminuw(__a, __b);
4640}
4641
4642static __inline__ vector unsigned int __ATTRS_o_ai
4643vec_min(vector bool int __a, vector unsigned int __b) {
4644  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
4645}
4646
4647static __inline__ vector unsigned int __ATTRS_o_ai
4648vec_min(vector unsigned int __a, vector bool int __b) {
4649  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
4650}
4651
4652#ifdef __POWER8_VECTOR__
4653static __inline__ vector signed long long __ATTRS_o_ai
4654vec_min(vector signed long long __a, vector signed long long __b) {
4655  return __builtin_altivec_vminsd(__a, __b);
4656}
4657
4658static __inline__ vector signed long long __ATTRS_o_ai
4659vec_min(vector bool long long __a, vector signed long long __b) {
4660  return __builtin_altivec_vminsd((vector signed long long)__a, __b);
4661}
4662
4663static __inline__ vector signed long long __ATTRS_o_ai
4664vec_min(vector signed long long __a, vector bool long long __b) {
4665  return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
4666}
4667
4668static __inline__ vector unsigned long long __ATTRS_o_ai
4669vec_min(vector unsigned long long __a, vector unsigned long long __b) {
4670  return __builtin_altivec_vminud(__a, __b);
4671}
4672
4673static __inline__ vector unsigned long long __ATTRS_o_ai
4674vec_min(vector bool long long __a, vector unsigned long long __b) {
4675  return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
4676}
4677
4678static __inline__ vector unsigned long long __ATTRS_o_ai
4679vec_min(vector unsigned long long __a, vector bool long long __b) {
4680  return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
4681}
4682#endif
4683
4684static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
4685                                                    vector float __b) {
4686#ifdef __VSX__
4687  return __builtin_vsx_xvminsp(__a, __b);
4688#else
4689  return __builtin_altivec_vminfp(__a, __b);
4690#endif
4691}
4692
4693#ifdef __VSX__
4694static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
4695                                                     vector double __b) {
4696  return __builtin_vsx_xvmindp(__a, __b);
4697}
4698#endif
4699
4700/* vec_vminsb */
4701
4702static __inline__ vector signed char __ATTRS_o_ai
4703vec_vminsb(vector signed char __a, vector signed char __b) {
4704  return __builtin_altivec_vminsb(__a, __b);
4705}
4706
4707static __inline__ vector signed char __ATTRS_o_ai
4708vec_vminsb(vector bool char __a, vector signed char __b) {
4709  return __builtin_altivec_vminsb((vector signed char)__a, __b);
4710}
4711
4712static __inline__ vector signed char __ATTRS_o_ai
4713vec_vminsb(vector signed char __a, vector bool char __b) {
4714  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
4715}
4716
4717/* vec_vminub */
4718
4719static __inline__ vector unsigned char __ATTRS_o_ai
4720vec_vminub(vector unsigned char __a, vector unsigned char __b) {
4721  return __builtin_altivec_vminub(__a, __b);
4722}
4723
4724static __inline__ vector unsigned char __ATTRS_o_ai
4725vec_vminub(vector bool char __a, vector unsigned char __b) {
4726  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
4727}
4728
4729static __inline__ vector unsigned char __ATTRS_o_ai
4730vec_vminub(vector unsigned char __a, vector bool char __b) {
4731  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
4732}
4733
4734/* vec_vminsh */
4735
4736static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4737                                                       vector short __b) {
4738  return __builtin_altivec_vminsh(__a, __b);
4739}
4740
4741static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
4742                                                       vector short __b) {
4743  return __builtin_altivec_vminsh((vector short)__a, __b);
4744}
4745
4746static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4747                                                       vector bool short __b) {
4748  return __builtin_altivec_vminsh(__a, (vector short)__b);
4749}
4750
4751/* vec_vminuh */
4752
4753static __inline__ vector unsigned short __ATTRS_o_ai
4754vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
4755  return __builtin_altivec_vminuh(__a, __b);
4756}
4757
4758static __inline__ vector unsigned short __ATTRS_o_ai
4759vec_vminuh(vector bool short __a, vector unsigned short __b) {
4760  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
4761}
4762
4763static __inline__ vector unsigned short __ATTRS_o_ai
4764vec_vminuh(vector unsigned short __a, vector bool short __b) {
4765  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
4766}
4767
4768/* vec_vminsw */
4769
4770static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4771                                                     vector int __b) {
4772  return __builtin_altivec_vminsw(__a, __b);
4773}
4774
4775static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
4776                                                     vector int __b) {
4777  return __builtin_altivec_vminsw((vector int)__a, __b);
4778}
4779
4780static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4781                                                     vector bool int __b) {
4782  return __builtin_altivec_vminsw(__a, (vector int)__b);
4783}
4784
4785/* vec_vminuw */
4786
4787static __inline__ vector unsigned int __ATTRS_o_ai
4788vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
4789  return __builtin_altivec_vminuw(__a, __b);
4790}
4791
4792static __inline__ vector unsigned int __ATTRS_o_ai
4793vec_vminuw(vector bool int __a, vector unsigned int __b) {
4794  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
4795}
4796
4797static __inline__ vector unsigned int __ATTRS_o_ai
4798vec_vminuw(vector unsigned int __a, vector bool int __b) {
4799  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
4800}
4801
4802/* vec_vminfp */
4803
4804static __inline__ vector float __attribute__((__always_inline__))
4805vec_vminfp(vector float __a, vector float __b) {
4806#ifdef __VSX__
4807  return __builtin_vsx_xvminsp(__a, __b);
4808#else
4809  return __builtin_altivec_vminfp(__a, __b);
4810#endif
4811}
4812
4813/* vec_mladd */
4814
4815#define __builtin_altivec_vmladduhm vec_mladd
4816
4817static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
4818                                                      vector short __b,
4819                                                      vector short __c) {
4820  return __a * __b + __c;
4821}
4822
4823static __inline__ vector short __ATTRS_o_ai vec_mladd(
4824    vector short __a, vector unsigned short __b, vector unsigned short __c) {
4825  return __a * (vector short)__b + (vector short)__c;
4826}
4827
4828static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4829                                                      vector short __b,
4830                                                      vector short __c) {
4831  return (vector short)__a * __b + __c;
4832}
4833
4834static __inline__ vector unsigned short __ATTRS_o_ai
4835vec_mladd(vector unsigned short __a, vector unsigned short __b,
4836          vector unsigned short __c) {
4837  return __a * __b + __c;
4838}
4839
4840/* vec_vmladduhm */
4841
4842static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4843                                                          vector short __b,
4844                                                          vector short __c) {
4845  return __a * __b + __c;
4846}
4847
4848static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
4849    vector short __a, vector unsigned short __b, vector unsigned short __c) {
4850  return __a * (vector short)__b + (vector short)__c;
4851}
4852
4853static __inline__ vector short __ATTRS_o_ai
4854vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
4855  return (vector short)__a * __b + __c;
4856}
4857
4858static __inline__ vector unsigned short __ATTRS_o_ai
4859vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
4860              vector unsigned short __c) {
4861  return __a * __b + __c;
4862}
4863
4864/* vec_mradds */
4865
4866static __inline__ vector short __attribute__((__always_inline__))
4867vec_mradds(vector short __a, vector short __b, vector short __c) {
4868  return __builtin_altivec_vmhraddshs(__a, __b, __c);
4869}
4870
4871/* vec_vmhraddshs */
4872
4873static __inline__ vector short __attribute__((__always_inline__))
4874vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
4875  return __builtin_altivec_vmhraddshs(__a, __b, __c);
4876}
4877
4878/* vec_msum */
4879
4880static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
4881                                                   vector unsigned char __b,
4882                                                   vector int __c) {
4883  return __builtin_altivec_vmsummbm(__a, __b, __c);
4884}
4885
4886static __inline__ vector unsigned int __ATTRS_o_ai
4887vec_msum(vector unsigned char __a, vector unsigned char __b,
4888         vector unsigned int __c) {
4889  return __builtin_altivec_vmsumubm(__a, __b, __c);
4890}
4891
4892static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
4893                                                   vector short __b,
4894                                                   vector int __c) {
4895  return __builtin_altivec_vmsumshm(__a, __b, __c);
4896}
4897
4898static __inline__ vector unsigned int __ATTRS_o_ai
4899vec_msum(vector unsigned short __a, vector unsigned short __b,
4900         vector unsigned int __c) {
4901  return __builtin_altivec_vmsumuhm(__a, __b, __c);
4902}
4903
4904/* vec_vmsummbm */
4905
4906static __inline__ vector int __attribute__((__always_inline__))
4907vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
4908  return __builtin_altivec_vmsummbm(__a, __b, __c);
4909}
4910
4911/* vec_vmsumubm */
4912
4913static __inline__ vector unsigned int __attribute__((__always_inline__))
4914vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
4915             vector unsigned int __c) {
4916  return __builtin_altivec_vmsumubm(__a, __b, __c);
4917}
4918
4919/* vec_vmsumshm */
4920
4921static __inline__ vector int __attribute__((__always_inline__))
4922vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
4923  return __builtin_altivec_vmsumshm(__a, __b, __c);
4924}
4925
4926/* vec_vmsumuhm */
4927
4928static __inline__ vector unsigned int __attribute__((__always_inline__))
4929vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
4930             vector unsigned int __c) {
4931  return __builtin_altivec_vmsumuhm(__a, __b, __c);
4932}
4933
4934/* vec_msums */
4935
4936static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
4937                                                    vector short __b,
4938                                                    vector int __c) {
4939  return __builtin_altivec_vmsumshs(__a, __b, __c);
4940}
4941
4942static __inline__ vector unsigned int __ATTRS_o_ai
4943vec_msums(vector unsigned short __a, vector unsigned short __b,
4944          vector unsigned int __c) {
4945  return __builtin_altivec_vmsumuhs(__a, __b, __c);
4946}
4947
4948/* vec_vmsumshs */
4949
4950static __inline__ vector int __attribute__((__always_inline__))
4951vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
4952  return __builtin_altivec_vmsumshs(__a, __b, __c);
4953}
4954
4955/* vec_vmsumuhs */
4956
4957static __inline__ vector unsigned int __attribute__((__always_inline__))
4958vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
4959             vector unsigned int __c) {
4960  return __builtin_altivec_vmsumuhs(__a, __b, __c);
4961}
4962
4963/* vec_mtvscr */
4964
4965static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
4966  __builtin_altivec_mtvscr((vector int)__a);
4967}
4968
4969static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
4970  __builtin_altivec_mtvscr((vector int)__a);
4971}
4972
4973static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
4974  __builtin_altivec_mtvscr((vector int)__a);
4975}
4976
4977static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
4978  __builtin_altivec_mtvscr((vector int)__a);
4979}
4980
4981static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
4982  __builtin_altivec_mtvscr((vector int)__a);
4983}
4984
4985static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
4986  __builtin_altivec_mtvscr((vector int)__a);
4987}
4988
4989static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
4990  __builtin_altivec_mtvscr((vector int)__a);
4991}
4992
4993static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
4994  __builtin_altivec_mtvscr((vector int)__a);
4995}
4996
4997static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
4998  __builtin_altivec_mtvscr((vector int)__a);
4999}
5000
5001static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5002  __builtin_altivec_mtvscr((vector int)__a);
5003}
5004
5005static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5006  __builtin_altivec_mtvscr((vector int)__a);
5007}
5008
5009/* vec_mul */
5010
5011/* Integer vector multiplication will involve multiplication of the odd/even
5012   elements separately, then truncating the results and moving to the
5013   result vector.
5014*/
5015static __inline__ vector signed char __ATTRS_o_ai
5016vec_mul(vector signed char __a, vector signed char __b) {
5017  return __a * __b;
5018}
5019
5020static __inline__ vector unsigned char __ATTRS_o_ai
5021vec_mul(vector unsigned char __a, vector unsigned char __b) {
5022  return __a * __b;
5023}
5024
5025static __inline__ vector signed short __ATTRS_o_ai
5026vec_mul(vector signed short __a, vector signed short __b) {
5027  return __a * __b;
5028}
5029
5030static __inline__ vector unsigned short __ATTRS_o_ai
5031vec_mul(vector unsigned short __a, vector unsigned short __b) {
5032  return __a * __b;
5033}
5034
5035static __inline__ vector signed int __ATTRS_o_ai
5036vec_mul(vector signed int __a, vector signed int __b) {
5037  return __a * __b;
5038}
5039
5040static __inline__ vector unsigned int __ATTRS_o_ai
5041vec_mul(vector unsigned int __a, vector unsigned int __b) {
5042  return __a * __b;
5043}
5044
5045#ifdef __VSX__
5046static __inline__ vector signed long long __ATTRS_o_ai
5047vec_mul(vector signed long long __a, vector signed long long __b) {
5048  return __a * __b;
5049}
5050
5051static __inline__ vector unsigned long long __ATTRS_o_ai
5052vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5053  return __a * __b;
5054}
5055#endif
5056
5057static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5058                                                    vector float __b) {
5059  return __a * __b;
5060}
5061
5062#ifdef __VSX__
5063static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5064                                                     vector double __b) {
5065  return __a * __b;
5066}
5067#endif
5068
5069/* The vmulos* and vmules* instructions have a big endian bias, so
5070   we must reverse the meaning of "even" and "odd" for little endian.  */
5071
5072/* vec_mule */
5073
5074static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5075                                                     vector signed char __b) {
5076#ifdef __LITTLE_ENDIAN__
5077  return __builtin_altivec_vmulosb(__a, __b);
5078#else
5079  return __builtin_altivec_vmulesb(__a, __b);
5080#endif
5081}
5082
5083static __inline__ vector unsigned short __ATTRS_o_ai
5084vec_mule(vector unsigned char __a, vector unsigned char __b) {
5085#ifdef __LITTLE_ENDIAN__
5086  return __builtin_altivec_vmuloub(__a, __b);
5087#else
5088  return __builtin_altivec_vmuleub(__a, __b);
5089#endif
5090}
5091
5092static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5093                                                   vector short __b) {
5094#ifdef __LITTLE_ENDIAN__
5095  return __builtin_altivec_vmulosh(__a, __b);
5096#else
5097  return __builtin_altivec_vmulesh(__a, __b);
5098#endif
5099}
5100
5101static __inline__ vector unsigned int __ATTRS_o_ai
5102vec_mule(vector unsigned short __a, vector unsigned short __b) {
5103#ifdef __LITTLE_ENDIAN__
5104  return __builtin_altivec_vmulouh(__a, __b);
5105#else
5106  return __builtin_altivec_vmuleuh(__a, __b);
5107#endif
5108}
5109
5110#ifdef __POWER8_VECTOR__
5111static __inline__ vector signed long long __ATTRS_o_ai
5112vec_mule(vector signed int __a, vector signed int __b) {
5113#ifdef __LITTLE_ENDIAN__
5114  return __builtin_altivec_vmulosw(__a, __b);
5115#else
5116  return __builtin_altivec_vmulesw(__a, __b);
5117#endif
5118}
5119
5120static __inline__ vector unsigned long long __ATTRS_o_ai
5121vec_mule(vector unsigned int __a, vector unsigned int __b) {
5122#ifdef __LITTLE_ENDIAN__
5123  return __builtin_altivec_vmulouw(__a, __b);
5124#else
5125  return __builtin_altivec_vmuleuw(__a, __b);
5126#endif
5127}
5128#endif
5129
5130/* vec_vmulesb */
5131
5132static __inline__ vector short __attribute__((__always_inline__))
5133vec_vmulesb(vector signed char __a, vector signed char __b) {
5134#ifdef __LITTLE_ENDIAN__
5135  return __builtin_altivec_vmulosb(__a, __b);
5136#else
5137  return __builtin_altivec_vmulesb(__a, __b);
5138#endif
5139}
5140
5141/* vec_vmuleub */
5142
5143static __inline__ vector unsigned short __attribute__((__always_inline__))
5144vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5145#ifdef __LITTLE_ENDIAN__
5146  return __builtin_altivec_vmuloub(__a, __b);
5147#else
5148  return __builtin_altivec_vmuleub(__a, __b);
5149#endif
5150}
5151
5152/* vec_vmulesh */
5153
5154static __inline__ vector int __attribute__((__always_inline__))
5155vec_vmulesh(vector short __a, vector short __b) {
5156#ifdef __LITTLE_ENDIAN__
5157  return __builtin_altivec_vmulosh(__a, __b);
5158#else
5159  return __builtin_altivec_vmulesh(__a, __b);
5160#endif
5161}
5162
5163/* vec_vmuleuh */
5164
5165static __inline__ vector unsigned int __attribute__((__always_inline__))
5166vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5167#ifdef __LITTLE_ENDIAN__
5168  return __builtin_altivec_vmulouh(__a, __b);
5169#else
5170  return __builtin_altivec_vmuleuh(__a, __b);
5171#endif
5172}
5173
5174/* vec_mulo */
5175
5176static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5177                                                     vector signed char __b) {
5178#ifdef __LITTLE_ENDIAN__
5179  return __builtin_altivec_vmulesb(__a, __b);
5180#else
5181  return __builtin_altivec_vmulosb(__a, __b);
5182#endif
5183}
5184
5185static __inline__ vector unsigned short __ATTRS_o_ai
5186vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5187#ifdef __LITTLE_ENDIAN__
5188  return __builtin_altivec_vmuleub(__a, __b);
5189#else
5190  return __builtin_altivec_vmuloub(__a, __b);
5191#endif
5192}
5193
5194static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5195                                                   vector short __b) {
5196#ifdef __LITTLE_ENDIAN__
5197  return __builtin_altivec_vmulesh(__a, __b);
5198#else
5199  return __builtin_altivec_vmulosh(__a, __b);
5200#endif
5201}
5202
5203static __inline__ vector unsigned int __ATTRS_o_ai
5204vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5205#ifdef __LITTLE_ENDIAN__
5206  return __builtin_altivec_vmuleuh(__a, __b);
5207#else
5208  return __builtin_altivec_vmulouh(__a, __b);
5209#endif
5210}
5211
5212#ifdef __POWER8_VECTOR__
5213static __inline__ vector signed long long __ATTRS_o_ai
5214vec_mulo(vector signed int __a, vector signed int __b) {
5215#ifdef __LITTLE_ENDIAN__
5216  return __builtin_altivec_vmulesw(__a, __b);
5217#else
5218  return __builtin_altivec_vmulosw(__a, __b);
5219#endif
5220}
5221
5222static __inline__ vector unsigned long long __ATTRS_o_ai
5223vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5224#ifdef __LITTLE_ENDIAN__
5225  return __builtin_altivec_vmuleuw(__a, __b);
5226#else
5227  return __builtin_altivec_vmulouw(__a, __b);
5228#endif
5229}
5230#endif
5231
5232/* vec_vmulosb */
5233
5234static __inline__ vector short __attribute__((__always_inline__))
5235vec_vmulosb(vector signed char __a, vector signed char __b) {
5236#ifdef __LITTLE_ENDIAN__
5237  return __builtin_altivec_vmulesb(__a, __b);
5238#else
5239  return __builtin_altivec_vmulosb(__a, __b);
5240#endif
5241}
5242
5243/* vec_vmuloub */
5244
5245static __inline__ vector unsigned short __attribute__((__always_inline__))
5246vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5247#ifdef __LITTLE_ENDIAN__
5248  return __builtin_altivec_vmuleub(__a, __b);
5249#else
5250  return __builtin_altivec_vmuloub(__a, __b);
5251#endif
5252}
5253
5254/* vec_vmulosh */
5255
5256static __inline__ vector int __attribute__((__always_inline__))
5257vec_vmulosh(vector short __a, vector short __b) {
5258#ifdef __LITTLE_ENDIAN__
5259  return __builtin_altivec_vmulesh(__a, __b);
5260#else
5261  return __builtin_altivec_vmulosh(__a, __b);
5262#endif
5263}
5264
5265/* vec_vmulouh */
5266
5267static __inline__ vector unsigned int __attribute__((__always_inline__))
5268vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5269#ifdef __LITTLE_ENDIAN__
5270  return __builtin_altivec_vmuleuh(__a, __b);
5271#else
5272  return __builtin_altivec_vmulouh(__a, __b);
5273#endif
5274}
5275
5276/*  vec_nand */
5277
5278#ifdef __POWER8_VECTOR__
5279static __inline__ vector signed char __ATTRS_o_ai
5280vec_nand(vector signed char __a, vector signed char __b) {
5281  return ~(__a & __b);
5282}
5283
5284static __inline__ vector signed char __ATTRS_o_ai
5285vec_nand(vector signed char __a, vector bool char __b) {
5286  return ~(__a & __b);
5287}
5288
5289static __inline__ vector signed char __ATTRS_o_ai
5290vec_nand(vector bool char __a, vector signed char __b) {
5291  return ~(__a & __b);
5292}
5293
5294static __inline__ vector unsigned char __ATTRS_o_ai
5295vec_nand(vector unsigned char __a, vector unsigned char __b) {
5296  return ~(__a & __b);
5297}
5298
5299static __inline__ vector unsigned char __ATTRS_o_ai
5300vec_nand(vector unsigned char __a, vector bool char __b) {
5301  return ~(__a & __b);
5302}
5303
5304static __inline__ vector unsigned char __ATTRS_o_ai
5305vec_nand(vector bool char __a, vector unsigned char __b) {
5306  return ~(__a & __b);
5307}
5308
5309static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5310                                                         vector bool char __b) {
5311  return ~(__a & __b);
5312}
5313
5314static __inline__ vector signed short __ATTRS_o_ai
5315vec_nand(vector signed short __a, vector signed short __b) {
5316  return ~(__a & __b);
5317}
5318
5319static __inline__ vector signed short __ATTRS_o_ai
5320vec_nand(vector signed short __a, vector bool short __b) {
5321  return ~(__a & __b);
5322}
5323
5324static __inline__ vector signed short __ATTRS_o_ai
5325vec_nand(vector bool short __a, vector signed short __b) {
5326  return ~(__a & __b);
5327}
5328
5329static __inline__ vector unsigned short __ATTRS_o_ai
5330vec_nand(vector unsigned short __a, vector unsigned short __b) {
5331  return ~(__a & __b);
5332}
5333
5334static __inline__ vector unsigned short __ATTRS_o_ai
5335vec_nand(vector unsigned short __a, vector bool short __b) {
5336  return ~(__a & __b);
5337}
5338
5339static __inline__ vector bool short __ATTRS_o_ai
5340vec_nand(vector bool short __a, vector bool short __b) {
5341  return ~(__a & __b);
5342}
5343
5344static __inline__ vector signed int __ATTRS_o_ai
5345vec_nand(vector signed int __a, vector signed int __b) {
5346  return ~(__a & __b);
5347}
5348
5349static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5350                                                          vector bool int __b) {
5351  return ~(__a & __b);
5352}
5353
5354static __inline__ vector signed int __ATTRS_o_ai
5355vec_nand(vector bool int __a, vector signed int __b) {
5356  return ~(__a & __b);
5357}
5358
5359static __inline__ vector unsigned int __ATTRS_o_ai
5360vec_nand(vector unsigned int __a, vector unsigned int __b) {
5361  return ~(__a & __b);
5362}
5363
5364static __inline__ vector unsigned int __ATTRS_o_ai
5365vec_nand(vector unsigned int __a, vector bool int __b) {
5366  return ~(__a & __b);
5367}
5368
5369static __inline__ vector unsigned int __ATTRS_o_ai
5370vec_nand(vector bool int __a, vector unsigned int __b) {
5371  return ~(__a & __b);
5372}
5373
5374static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5375                                                        vector bool int __b) {
5376  return ~(__a & __b);
5377}
5378
5379static __inline__ vector float __ATTRS_o_ai
5380vec_nand(vector float __a, vector float __b) {
5381  return (vector float)(~((vector unsigned int)__a &
5382                          (vector unsigned int)__b));
5383}
5384
5385static __inline__ vector signed long long __ATTRS_o_ai
5386vec_nand(vector signed long long __a, vector signed long long __b) {
5387  return ~(__a & __b);
5388}
5389
5390static __inline__ vector signed long long __ATTRS_o_ai
5391vec_nand(vector signed long long __a, vector bool long long __b) {
5392  return ~(__a & __b);
5393}
5394
5395static __inline__ vector signed long long __ATTRS_o_ai
5396vec_nand(vector bool long long __a, vector signed long long __b) {
5397  return ~(__a & __b);
5398}
5399
5400static __inline__ vector unsigned long long __ATTRS_o_ai
5401vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5402  return ~(__a & __b);
5403}
5404
5405static __inline__ vector unsigned long long __ATTRS_o_ai
5406vec_nand(vector unsigned long long __a, vector bool long long __b) {
5407  return ~(__a & __b);
5408}
5409
5410static __inline__ vector unsigned long long __ATTRS_o_ai
5411vec_nand(vector bool long long __a, vector unsigned long long __b) {
5412  return ~(__a & __b);
5413}
5414
5415static __inline__ vector bool long long __ATTRS_o_ai
5416vec_nand(vector bool long long __a, vector bool long long __b) {
5417  return ~(__a & __b);
5418}
5419
5420static __inline__ vector double __ATTRS_o_ai
5421vec_nand(vector double __a, vector double __b) {
5422  return (vector double)(~((vector unsigned long long)__a &
5423                           (vector unsigned long long)__b));
5424}
5425
5426#endif
5427
5428/* vec_nmadd */
5429
5430#ifdef __VSX__
5431static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
5432                                                      vector float __b,
5433                                                      vector float __c) {
5434  return __builtin_vsx_xvnmaddasp(__a, __b, __c);
5435}
5436
5437static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
5438                                                       vector double __b,
5439                                                       vector double __c) {
5440  return __builtin_vsx_xvnmaddadp(__a, __b, __c);
5441}
5442#endif
5443
5444/* vec_nmsub */
5445
5446static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
5447                                                      vector float __b,
5448                                                      vector float __c) {
5449#ifdef __VSX__
5450  return __builtin_vsx_xvnmsubasp(__a, __b, __c);
5451#else
5452  return __builtin_altivec_vnmsubfp(__a, __b, __c);
5453#endif
5454}
5455
5456#ifdef __VSX__
5457static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
5458                                                       vector double __b,
5459                                                       vector double __c) {
5460  return __builtin_vsx_xvnmsubadp(__a, __b, __c);
5461}
5462#endif
5463
5464/* vec_vnmsubfp */
5465
5466static __inline__ vector float __attribute__((__always_inline__))
5467vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
5468  return __builtin_altivec_vnmsubfp(__a, __b, __c);
5469}
5470
5471/* vec_nor */
5472
5473#define __builtin_altivec_vnor vec_nor
5474
5475static __inline__ vector signed char __ATTRS_o_ai
5476vec_nor(vector signed char __a, vector signed char __b) {
5477  return ~(__a | __b);
5478}
5479
5480static __inline__ vector unsigned char __ATTRS_o_ai
5481vec_nor(vector unsigned char __a, vector unsigned char __b) {
5482  return ~(__a | __b);
5483}
5484
5485static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
5486                                                        vector bool char __b) {
5487  return ~(__a | __b);
5488}
5489
5490static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
5491                                                    vector short __b) {
5492  return ~(__a | __b);
5493}
5494
5495static __inline__ vector unsigned short __ATTRS_o_ai
5496vec_nor(vector unsigned short __a, vector unsigned short __b) {
5497  return ~(__a | __b);
5498}
5499
5500static __inline__ vector bool short __ATTRS_o_ai
5501vec_nor(vector bool short __a, vector bool short __b) {
5502  return ~(__a | __b);
5503}
5504
5505static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
5506                                                  vector int __b) {
5507  return ~(__a | __b);
5508}
5509
5510static __inline__ vector unsigned int __ATTRS_o_ai
5511vec_nor(vector unsigned int __a, vector unsigned int __b) {
5512  return ~(__a | __b);
5513}
5514
5515static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
5516                                                       vector bool int __b) {
5517  return ~(__a | __b);
5518}
5519
5520static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
5521                                                    vector float __b) {
5522  vector unsigned int __res =
5523      ~((vector unsigned int)__a | (vector unsigned int)__b);
5524  return (vector float)__res;
5525}
5526
5527#ifdef __VSX__
5528static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
5529                                                     vector double __b) {
5530  vector unsigned long long __res =
5531      ~((vector unsigned long long)__a | (vector unsigned long long)__b);
5532  return (vector double)__res;
5533}
5534#endif
5535
5536/* vec_vnor */
5537
5538static __inline__ vector signed char __ATTRS_o_ai
5539vec_vnor(vector signed char __a, vector signed char __b) {
5540  return ~(__a | __b);
5541}
5542
5543static __inline__ vector unsigned char __ATTRS_o_ai
5544vec_vnor(vector unsigned char __a, vector unsigned char __b) {
5545  return ~(__a | __b);
5546}
5547
5548static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
5549                                                         vector bool char __b) {
5550  return ~(__a | __b);
5551}
5552
5553static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
5554                                                     vector short __b) {
5555  return ~(__a | __b);
5556}
5557
5558static __inline__ vector unsigned short __ATTRS_o_ai
5559vec_vnor(vector unsigned short __a, vector unsigned short __b) {
5560  return ~(__a | __b);
5561}
5562
5563static __inline__ vector bool short __ATTRS_o_ai
5564vec_vnor(vector bool short __a, vector bool short __b) {
5565  return ~(__a | __b);
5566}
5567
5568static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
5569                                                   vector int __b) {
5570  return ~(__a | __b);
5571}
5572
5573static __inline__ vector unsigned int __ATTRS_o_ai
5574vec_vnor(vector unsigned int __a, vector unsigned int __b) {
5575  return ~(__a | __b);
5576}
5577
5578static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
5579                                                        vector bool int __b) {
5580  return ~(__a | __b);
5581}
5582
5583static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
5584                                                     vector float __b) {
5585  vector unsigned int __res =
5586      ~((vector unsigned int)__a | (vector unsigned int)__b);
5587  return (vector float)__res;
5588}
5589
5590#ifdef __VSX__
5591static __inline__ vector signed long long __ATTRS_o_ai
5592vec_nor(vector signed long long __a, vector signed long long __b) {
5593  return ~(__a | __b);
5594}
5595
5596static __inline__ vector unsigned long long __ATTRS_o_ai
5597vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
5598  return ~(__a | __b);
5599}
5600
5601static __inline__ vector bool long long __ATTRS_o_ai
5602vec_nor(vector bool long long __a, vector bool long long __b) {
5603  return ~(__a | __b);
5604}
5605#endif
5606
5607/* vec_or */
5608
5609#define __builtin_altivec_vor vec_or
5610
5611static __inline__ vector signed char __ATTRS_o_ai
5612vec_or(vector signed char __a, vector signed char __b) {
5613  return __a | __b;
5614}
5615
5616static __inline__ vector signed char __ATTRS_o_ai
5617vec_or(vector bool char __a, vector signed char __b) {
5618  return (vector signed char)__a | __b;
5619}
5620
5621static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
5622                                                         vector bool char __b) {
5623  return __a | (vector signed char)__b;
5624}
5625
5626static __inline__ vector unsigned char __ATTRS_o_ai
5627vec_or(vector unsigned char __a, vector unsigned char __b) {
5628  return __a | __b;
5629}
5630
5631static __inline__ vector unsigned char __ATTRS_o_ai
5632vec_or(vector bool char __a, vector unsigned char __b) {
5633  return (vector unsigned char)__a | __b;
5634}
5635
5636static __inline__ vector unsigned char __ATTRS_o_ai
5637vec_or(vector unsigned char __a, vector bool char __b) {
5638  return __a | (vector unsigned char)__b;
5639}
5640
5641static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
5642                                                       vector bool char __b) {
5643  return __a | __b;
5644}
5645
5646static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
5647                                                   vector short __b) {
5648  return __a | __b;
5649}
5650
5651static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
5652                                                   vector short __b) {
5653  return (vector short)__a | __b;
5654}
5655
5656static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
5657                                                   vector bool short __b) {
5658  return __a | (vector short)__b;
5659}
5660
5661static __inline__ vector unsigned short __ATTRS_o_ai
5662vec_or(vector unsigned short __a, vector unsigned short __b) {
5663  return __a | __b;
5664}
5665
5666static __inline__ vector unsigned short __ATTRS_o_ai
5667vec_or(vector bool short __a, vector unsigned short __b) {
5668  return (vector unsigned short)__a | __b;
5669}
5670
5671static __inline__ vector unsigned short __ATTRS_o_ai
5672vec_or(vector unsigned short __a, vector bool short __b) {
5673  return __a | (vector unsigned short)__b;
5674}
5675
5676static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
5677                                                        vector bool short __b) {
5678  return __a | __b;
5679}
5680
5681static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
5682                                                 vector int __b) {
5683  return __a | __b;
5684}
5685
5686static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
5687                                                 vector int __b) {
5688  return (vector int)__a | __b;
5689}
5690
5691static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
5692                                                 vector bool int __b) {
5693  return __a | (vector int)__b;
5694}
5695
5696static __inline__ vector unsigned int __ATTRS_o_ai
5697vec_or(vector unsigned int __a, vector unsigned int __b) {
5698  return __a | __b;
5699}
5700
5701static __inline__ vector unsigned int __ATTRS_o_ai
5702vec_or(vector bool int __a, vector unsigned int __b) {
5703  return (vector unsigned int)__a | __b;
5704}
5705
5706static __inline__ vector unsigned int __ATTRS_o_ai
5707vec_or(vector unsigned int __a, vector bool int __b) {
5708  return __a | (vector unsigned int)__b;
5709}
5710
5711static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
5712                                                      vector bool int __b) {
5713  return __a | __b;
5714}
5715
5716static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5717                                                   vector float __b) {
5718  vector unsigned int __res =
5719      (vector unsigned int)__a | (vector unsigned int)__b;
5720  return (vector float)__res;
5721}
5722
5723static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
5724                                                   vector float __b) {
5725  vector unsigned int __res =
5726      (vector unsigned int)__a | (vector unsigned int)__b;
5727  return (vector float)__res;
5728}
5729
5730static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5731                                                   vector bool int __b) {
5732  vector unsigned int __res =
5733      (vector unsigned int)__a | (vector unsigned int)__b;
5734  return (vector float)__res;
5735}
5736
5737#ifdef __VSX__
5738static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
5739                                                    vector double __b) {
5740  return (vector unsigned long long)__a | (vector unsigned long long)__b;
5741}
5742
5743static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5744                                                    vector bool long long __b) {
5745  return (vector unsigned long long)__a | (vector unsigned long long)__b;
5746}
5747
5748static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5749                                                    vector double __b) {
5750  vector unsigned long long __res =
5751      (vector unsigned long long)__a | (vector unsigned long long)__b;
5752  return (vector double)__res;
5753}
5754
5755static __inline__ vector signed long long __ATTRS_o_ai
5756vec_or(vector signed long long __a, vector signed long long __b) {
5757  return __a | __b;
5758}
5759
5760static __inline__ vector signed long long __ATTRS_o_ai
5761vec_or(vector bool long long __a, vector signed long long __b) {
5762  return (vector signed long long)__a | __b;
5763}
5764
5765static __inline__ vector signed long long __ATTRS_o_ai
5766vec_or(vector signed long long __a, vector bool long long __b) {
5767  return __a | (vector signed long long)__b;
5768}
5769
5770static __inline__ vector unsigned long long __ATTRS_o_ai
5771vec_or(vector unsigned long long __a, vector unsigned long long __b) {
5772  return __a | __b;
5773}
5774
5775static __inline__ vector unsigned long long __ATTRS_o_ai
5776vec_or(vector bool long long __a, vector unsigned long long __b) {
5777  return (vector unsigned long long)__a | __b;
5778}
5779
5780static __inline__ vector unsigned long long __ATTRS_o_ai
5781vec_or(vector unsigned long long __a, vector bool long long __b) {
5782  return __a | (vector unsigned long long)__b;
5783}
5784
5785static __inline__ vector bool long long __ATTRS_o_ai
5786vec_or(vector bool long long __a, vector bool long long __b) {
5787  return __a | __b;
5788}
5789#endif
5790
5791#ifdef __POWER8_VECTOR__
5792static __inline__ vector signed char __ATTRS_o_ai
5793vec_orc(vector signed char __a, vector signed char __b) {
5794  return __a | ~__b;
5795}
5796
5797static __inline__ vector signed char __ATTRS_o_ai
5798vec_orc(vector signed char __a, vector bool char __b) {
5799  return __a | ~__b;
5800}
5801
5802static __inline__ vector signed char __ATTRS_o_ai
5803vec_orc(vector bool char __a, vector signed char __b) {
5804  return __a | ~__b;
5805}
5806
5807static __inline__ vector unsigned char __ATTRS_o_ai
5808vec_orc(vector unsigned char __a, vector unsigned char __b) {
5809  return __a | ~__b;
5810}
5811
5812static __inline__ vector unsigned char __ATTRS_o_ai
5813vec_orc(vector unsigned char __a, vector bool char __b) {
5814  return __a | ~__b;
5815}
5816
5817static __inline__ vector unsigned char __ATTRS_o_ai
5818vec_orc(vector bool char __a, vector unsigned char __b) {
5819  return __a | ~__b;
5820}
5821
5822static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
5823                                                        vector bool char __b) {
5824  return __a | ~__b;
5825}
5826
5827static __inline__ vector signed short __ATTRS_o_ai
5828vec_orc(vector signed short __a, vector signed short __b) {
5829  return __a | ~__b;
5830}
5831
5832static __inline__ vector signed short __ATTRS_o_ai
5833vec_orc(vector signed short __a, vector bool short __b) {
5834  return __a | ~__b;
5835}
5836
5837static __inline__ vector signed short __ATTRS_o_ai
5838vec_orc(vector bool short __a, vector signed short __b) {
5839  return __a | ~__b;
5840}
5841
5842static __inline__ vector unsigned short __ATTRS_o_ai
5843vec_orc(vector unsigned short __a, vector unsigned short __b) {
5844  return __a | ~__b;
5845}
5846
5847static __inline__ vector unsigned short __ATTRS_o_ai
5848vec_orc(vector unsigned short __a, vector bool short __b) {
5849  return __a | ~__b;
5850}
5851
5852static __inline__ vector unsigned short __ATTRS_o_ai
5853vec_orc(vector bool short __a, vector unsigned short __b) {
5854  return __a | ~__b;
5855}
5856
5857static __inline__ vector bool short __ATTRS_o_ai
5858vec_orc(vector bool short __a, vector bool short __b) {
5859  return __a | ~__b;
5860}
5861
5862static __inline__ vector signed int __ATTRS_o_ai
5863vec_orc(vector signed int __a, vector signed int __b) {
5864  return __a | ~__b;
5865}
5866
5867static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5868                                                         vector bool int __b) {
5869  return __a | ~__b;
5870}
5871
5872static __inline__ vector signed int __ATTRS_o_ai
5873vec_orc(vector bool int __a, vector signed int __b) {
5874  return __a | ~__b;
5875}
5876
5877static __inline__ vector unsigned int __ATTRS_o_ai
5878vec_orc(vector unsigned int __a, vector unsigned int __b) {
5879  return __a | ~__b;
5880}
5881
5882static __inline__ vector unsigned int __ATTRS_o_ai
5883vec_orc(vector unsigned int __a, vector bool int __b) {
5884  return __a | ~__b;
5885}
5886
5887static __inline__ vector unsigned int __ATTRS_o_ai
5888vec_orc(vector bool int __a, vector unsigned int __b) {
5889  return __a | ~__b;
5890}
5891
5892static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
5893                                                       vector bool int __b) {
5894  return __a | ~__b;
5895}
5896
5897static __inline__ vector float __ATTRS_o_ai
5898vec_orc(vector bool int __a, vector float __b) {
5899 return (vector float)(__a | ~(vector unsigned int)__b);
5900}
5901
5902static __inline__ vector float __ATTRS_o_ai
5903vec_orc(vector float __a, vector bool int __b) {
5904  return (vector float)((vector unsigned int)__a | ~__b);
5905}
5906
5907static __inline__ vector signed long long __ATTRS_o_ai
5908vec_orc(vector signed long long __a, vector signed long long __b) {
5909  return __a | ~__b;
5910}
5911
5912static __inline__ vector signed long long __ATTRS_o_ai
5913vec_orc(vector signed long long __a, vector bool long long __b) {
5914  return __a | ~__b;
5915}
5916
5917static __inline__ vector signed long long __ATTRS_o_ai
5918vec_orc(vector bool long long __a, vector signed long long __b) {
5919  return __a | ~__b;
5920}
5921
5922static __inline__ vector unsigned long long __ATTRS_o_ai
5923vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
5924  return __a | ~__b;
5925}
5926
5927static __inline__ vector unsigned long long __ATTRS_o_ai
5928vec_orc(vector unsigned long long __a, vector bool long long __b) {
5929  return __a | ~__b;
5930}
5931
5932static __inline__ vector unsigned long long __ATTRS_o_ai
5933vec_orc(vector bool long long __a, vector unsigned long long __b) {
5934  return __a | ~__b;
5935}
5936
5937static __inline__ vector bool long long __ATTRS_o_ai
5938vec_orc(vector bool long long __a, vector bool long long __b) {
5939  return __a | ~__b;
5940}
5941
5942static __inline__ vector double __ATTRS_o_ai
5943vec_orc(vector double __a, vector bool long long __b) {
5944  return (vector double)((vector unsigned long long)__a | ~__b);
5945}
5946
5947static __inline__ vector double __ATTRS_o_ai
5948vec_orc(vector bool long long __a, vector double __b) {
5949  return (vector double)(__a | ~(vector unsigned long long)__b);
5950}
5951#endif
5952
5953/* vec_vor */
5954
5955static __inline__ vector signed char __ATTRS_o_ai
5956vec_vor(vector signed char __a, vector signed char __b) {
5957  return __a | __b;
5958}
5959
5960static __inline__ vector signed char __ATTRS_o_ai
5961vec_vor(vector bool char __a, vector signed char __b) {
5962  return (vector signed char)__a | __b;
5963}
5964
5965static __inline__ vector signed char __ATTRS_o_ai
5966vec_vor(vector signed char __a, vector bool char __b) {
5967  return __a | (vector signed char)__b;
5968}
5969
5970static __inline__ vector unsigned char __ATTRS_o_ai
5971vec_vor(vector unsigned char __a, vector unsigned char __b) {
5972  return __a | __b;
5973}
5974
5975static __inline__ vector unsigned char __ATTRS_o_ai
5976vec_vor(vector bool char __a, vector unsigned char __b) {
5977  return (vector unsigned char)__a | __b;
5978}
5979
5980static __inline__ vector unsigned char __ATTRS_o_ai
5981vec_vor(vector unsigned char __a, vector bool char __b) {
5982  return __a | (vector unsigned char)__b;
5983}
5984
5985static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
5986                                                        vector bool char __b) {
5987  return __a | __b;
5988}
5989
5990static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
5991                                                    vector short __b) {
5992  return __a | __b;
5993}
5994
5995static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
5996                                                    vector short __b) {
5997  return (vector short)__a | __b;
5998}
5999
6000static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6001                                                    vector bool short __b) {
6002  return __a | (vector short)__b;
6003}
6004
6005static __inline__ vector unsigned short __ATTRS_o_ai
6006vec_vor(vector unsigned short __a, vector unsigned short __b) {
6007  return __a | __b;
6008}
6009
6010static __inline__ vector unsigned short __ATTRS_o_ai
6011vec_vor(vector bool short __a, vector unsigned short __b) {
6012  return (vector unsigned short)__a | __b;
6013}
6014
6015static __inline__ vector unsigned short __ATTRS_o_ai
6016vec_vor(vector unsigned short __a, vector bool short __b) {
6017  return __a | (vector unsigned short)__b;
6018}
6019
6020static __inline__ vector bool short __ATTRS_o_ai
6021vec_vor(vector bool short __a, vector bool short __b) {
6022  return __a | __b;
6023}
6024
6025static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6026                                                  vector int __b) {
6027  return __a | __b;
6028}
6029
6030static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6031                                                  vector int __b) {
6032  return (vector int)__a | __b;
6033}
6034
6035static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6036                                                  vector bool int __b) {
6037  return __a | (vector int)__b;
6038}
6039
6040static __inline__ vector unsigned int __ATTRS_o_ai
6041vec_vor(vector unsigned int __a, vector unsigned int __b) {
6042  return __a | __b;
6043}
6044
6045static __inline__ vector unsigned int __ATTRS_o_ai
6046vec_vor(vector bool int __a, vector unsigned int __b) {
6047  return (vector unsigned int)__a | __b;
6048}
6049
6050static __inline__ vector unsigned int __ATTRS_o_ai
6051vec_vor(vector unsigned int __a, vector bool int __b) {
6052  return __a | (vector unsigned int)__b;
6053}
6054
6055static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6056                                                       vector bool int __b) {
6057  return __a | __b;
6058}
6059
6060static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6061                                                    vector float __b) {
6062  vector unsigned int __res =
6063      (vector unsigned int)__a | (vector unsigned int)__b;
6064  return (vector float)__res;
6065}
6066
6067static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6068                                                    vector float __b) {
6069  vector unsigned int __res =
6070      (vector unsigned int)__a | (vector unsigned int)__b;
6071  return (vector float)__res;
6072}
6073
6074static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6075                                                    vector bool int __b) {
6076  vector unsigned int __res =
6077      (vector unsigned int)__a | (vector unsigned int)__b;
6078  return (vector float)__res;
6079}
6080
6081#ifdef __VSX__
6082static __inline__ vector signed long long __ATTRS_o_ai
6083vec_vor(vector signed long long __a, vector signed long long __b) {
6084  return __a | __b;
6085}
6086
6087static __inline__ vector signed long long __ATTRS_o_ai
6088vec_vor(vector bool long long __a, vector signed long long __b) {
6089  return (vector signed long long)__a | __b;
6090}
6091
6092static __inline__ vector signed long long __ATTRS_o_ai
6093vec_vor(vector signed long long __a, vector bool long long __b) {
6094  return __a | (vector signed long long)__b;
6095}
6096
6097static __inline__ vector unsigned long long __ATTRS_o_ai
6098vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6099  return __a | __b;
6100}
6101
6102static __inline__ vector unsigned long long __ATTRS_o_ai
6103vec_vor(vector bool long long __a, vector unsigned long long __b) {
6104  return (vector unsigned long long)__a | __b;
6105}
6106
6107static __inline__ vector unsigned long long __ATTRS_o_ai
6108vec_vor(vector unsigned long long __a, vector bool long long __b) {
6109  return __a | (vector unsigned long long)__b;
6110}
6111
6112static __inline__ vector bool long long __ATTRS_o_ai
6113vec_vor(vector bool long long __a, vector bool long long __b) {
6114  return __a | __b;
6115}
6116#endif
6117
6118/* vec_pack */
6119
6120/* The various vector pack instructions have a big-endian bias, so for
6121   little endian we must handle reversed element numbering.  */
6122
6123static __inline__ vector signed char __ATTRS_o_ai
6124vec_pack(vector signed short __a, vector signed short __b) {
6125#ifdef __LITTLE_ENDIAN__
6126  return (vector signed char)vec_perm(
6127      __a, __b,
6128      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6129                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6130#else
6131  return (vector signed char)vec_perm(
6132      __a, __b,
6133      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6134                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6135#endif
6136}
6137
6138static __inline__ vector unsigned char __ATTRS_o_ai
6139vec_pack(vector unsigned short __a, vector unsigned short __b) {
6140#ifdef __LITTLE_ENDIAN__
6141  return (vector unsigned char)vec_perm(
6142      __a, __b,
6143      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6144                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6145#else
6146  return (vector unsigned char)vec_perm(
6147      __a, __b,
6148      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6149                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6150#endif
6151}
6152
6153static __inline__ vector bool char __ATTRS_o_ai
6154vec_pack(vector bool short __a, vector bool short __b) {
6155#ifdef __LITTLE_ENDIAN__
6156  return (vector bool char)vec_perm(
6157      __a, __b,
6158      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6159                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6160#else
6161  return (vector bool char)vec_perm(
6162      __a, __b,
6163      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6164                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6165#endif
6166}
6167
6168static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6169                                                     vector int __b) {
6170#ifdef __LITTLE_ENDIAN__
6171  return (vector short)vec_perm(
6172      __a, __b,
6173      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6174                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6175#else
6176  return (vector short)vec_perm(
6177      __a, __b,
6178      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6179                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6180#endif
6181}
6182
6183static __inline__ vector unsigned short __ATTRS_o_ai
6184vec_pack(vector unsigned int __a, vector unsigned int __b) {
6185#ifdef __LITTLE_ENDIAN__
6186  return (vector unsigned short)vec_perm(
6187      __a, __b,
6188      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6189                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6190#else
6191  return (vector unsigned short)vec_perm(
6192      __a, __b,
6193      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6194                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6195#endif
6196}
6197
6198static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6199                                                          vector bool int __b) {
6200#ifdef __LITTLE_ENDIAN__
6201  return (vector bool short)vec_perm(
6202      __a, __b,
6203      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6204                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6205#else
6206  return (vector bool short)vec_perm(
6207      __a, __b,
6208      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6209                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6210#endif
6211}
6212
6213#ifdef __VSX__
6214static __inline__ vector signed int __ATTRS_o_ai
6215vec_pack(vector signed long long __a, vector signed long long __b) {
6216#ifdef __LITTLE_ENDIAN__
6217  return (vector signed int)vec_perm(
6218      __a, __b,
6219      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6220                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6221#else
6222  return (vector signed int)vec_perm(
6223      __a, __b,
6224      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6225                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6226#endif
6227}
6228static __inline__ vector unsigned int __ATTRS_o_ai
6229vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6230#ifdef __LITTLE_ENDIAN__
6231  return (vector unsigned int)vec_perm(
6232      __a, __b,
6233      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6234                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6235#else
6236  return (vector unsigned int)vec_perm(
6237      __a, __b,
6238      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6239                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6240#endif
6241}
6242
6243static __inline__ vector bool int __ATTRS_o_ai
6244vec_pack(vector bool long long __a, vector bool long long __b) {
6245#ifdef __LITTLE_ENDIAN__
6246  return (vector bool int)vec_perm(
6247      __a, __b,
6248      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6249                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6250#else
6251  return (vector bool int)vec_perm(
6252      __a, __b,
6253      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6254                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6255#endif
6256}
6257
6258#endif
6259
6260/* vec_vpkuhum */
6261
6262#define __builtin_altivec_vpkuhum vec_vpkuhum
6263
6264static __inline__ vector signed char __ATTRS_o_ai
6265vec_vpkuhum(vector signed short __a, vector signed short __b) {
6266#ifdef __LITTLE_ENDIAN__
6267  return (vector signed char)vec_perm(
6268      __a, __b,
6269      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6270                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6271#else
6272  return (vector signed char)vec_perm(
6273      __a, __b,
6274      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6275                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6276#endif
6277}
6278
6279static __inline__ vector unsigned char __ATTRS_o_ai
6280vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6281#ifdef __LITTLE_ENDIAN__
6282  return (vector unsigned char)vec_perm(
6283      __a, __b,
6284      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6285                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6286#else
6287  return (vector unsigned char)vec_perm(
6288      __a, __b,
6289      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6290                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6291#endif
6292}
6293
6294static __inline__ vector bool char __ATTRS_o_ai
6295vec_vpkuhum(vector bool short __a, vector bool short __b) {
6296#ifdef __LITTLE_ENDIAN__
6297  return (vector bool char)vec_perm(
6298      __a, __b,
6299      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6300                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6301#else
6302  return (vector bool char)vec_perm(
6303      __a, __b,
6304      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6305                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6306#endif
6307}
6308
6309/* vec_vpkuwum */
6310
6311#define __builtin_altivec_vpkuwum vec_vpkuwum
6312
6313static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6314                                                        vector int __b) {
6315#ifdef __LITTLE_ENDIAN__
6316  return (vector short)vec_perm(
6317      __a, __b,
6318      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6319                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6320#else
6321  return (vector short)vec_perm(
6322      __a, __b,
6323      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6324                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6325#endif
6326}
6327
6328static __inline__ vector unsigned short __ATTRS_o_ai
6329vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6330#ifdef __LITTLE_ENDIAN__
6331  return (vector unsigned short)vec_perm(
6332      __a, __b,
6333      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6334                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6335#else
6336  return (vector unsigned short)vec_perm(
6337      __a, __b,
6338      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6339                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6340#endif
6341}
6342
6343static __inline__ vector bool short __ATTRS_o_ai
6344vec_vpkuwum(vector bool int __a, vector bool int __b) {
6345#ifdef __LITTLE_ENDIAN__
6346  return (vector bool short)vec_perm(
6347      __a, __b,
6348      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6349                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6350#else
6351  return (vector bool short)vec_perm(
6352      __a, __b,
6353      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6354                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6355#endif
6356}
6357
6358/* vec_vpkudum */
6359
6360#ifdef __POWER8_VECTOR__
6361#define __builtin_altivec_vpkudum vec_vpkudum
6362
6363static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6364                                                      vector long long __b) {
6365#ifdef __LITTLE_ENDIAN__
6366  return (vector int)vec_perm(
6367      __a, __b,
6368      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6369                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6370#else
6371  return (vector int)vec_perm(
6372      __a, __b,
6373      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6374                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6375#endif
6376}
6377
6378static __inline__ vector unsigned int __ATTRS_o_ai
6379vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6380#ifdef __LITTLE_ENDIAN__
6381  return (vector unsigned int)vec_perm(
6382      __a, __b,
6383      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6384                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6385#else
6386  return (vector unsigned int)vec_perm(
6387      __a, __b,
6388      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6389                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6390#endif
6391}
6392
6393static __inline__ vector bool int __ATTRS_o_ai
6394vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6395#ifdef __LITTLE_ENDIAN__
6396  return (vector bool int)vec_perm(
6397      (vector long long)__a, (vector long long)__b,
6398      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6399                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6400#else
6401  return (vector bool int)vec_perm(
6402      (vector long long)__a, (vector long long)__b,
6403      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6404                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6405#endif
6406}
6407#endif
6408
6409/* vec_packpx */
6410
6411static __inline__ vector pixel __attribute__((__always_inline__))
6412vec_packpx(vector unsigned int __a, vector unsigned int __b) {
6413#ifdef __LITTLE_ENDIAN__
6414  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
6415#else
6416  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
6417#endif
6418}
6419
6420/* vec_vpkpx */
6421
6422static __inline__ vector pixel __attribute__((__always_inline__))
6423vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
6424#ifdef __LITTLE_ENDIAN__
6425  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
6426#else
6427  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
6428#endif
6429}
6430
6431/* vec_packs */
6432
6433static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
6434                                                            vector short __b) {
6435#ifdef __LITTLE_ENDIAN__
6436  return __builtin_altivec_vpkshss(__b, __a);
6437#else
6438  return __builtin_altivec_vpkshss(__a, __b);
6439#endif
6440}
6441
6442static __inline__ vector unsigned char __ATTRS_o_ai
6443vec_packs(vector unsigned short __a, vector unsigned short __b) {
6444#ifdef __LITTLE_ENDIAN__
6445  return __builtin_altivec_vpkuhus(__b, __a);
6446#else
6447  return __builtin_altivec_vpkuhus(__a, __b);
6448#endif
6449}
6450
6451static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
6452                                                             vector int __b) {
6453#ifdef __LITTLE_ENDIAN__
6454  return __builtin_altivec_vpkswss(__b, __a);
6455#else
6456  return __builtin_altivec_vpkswss(__a, __b);
6457#endif
6458}
6459
6460static __inline__ vector unsigned short __ATTRS_o_ai
6461vec_packs(vector unsigned int __a, vector unsigned int __b) {
6462#ifdef __LITTLE_ENDIAN__
6463  return __builtin_altivec_vpkuwus(__b, __a);
6464#else
6465  return __builtin_altivec_vpkuwus(__a, __b);
6466#endif
6467}
6468
6469#ifdef __POWER8_VECTOR__
6470static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
6471                                                    vector long long __b) {
6472#ifdef __LITTLE_ENDIAN__
6473  return __builtin_altivec_vpksdss(__b, __a);
6474#else
6475  return __builtin_altivec_vpksdss(__a, __b);
6476#endif
6477}
6478
6479static __inline__ vector unsigned int __ATTRS_o_ai
6480vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
6481#ifdef __LITTLE_ENDIAN__
6482  return __builtin_altivec_vpkudus(__b, __a);
6483#else
6484  return __builtin_altivec_vpkudus(__a, __b);
6485#endif
6486}
6487#endif
6488
6489/* vec_vpkshss */
6490
6491static __inline__ vector signed char __attribute__((__always_inline__))
6492vec_vpkshss(vector short __a, vector short __b) {
6493#ifdef __LITTLE_ENDIAN__
6494  return __builtin_altivec_vpkshss(__b, __a);
6495#else
6496  return __builtin_altivec_vpkshss(__a, __b);
6497#endif
6498}
6499
6500/* vec_vpksdss */
6501
6502#ifdef __POWER8_VECTOR__
6503static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
6504                                                      vector long long __b) {
6505#ifdef __LITTLE_ENDIAN__
6506  return __builtin_altivec_vpksdss(__b, __a);
6507#else
6508  return __builtin_altivec_vpksdss(__a, __b);
6509#endif
6510}
6511#endif
6512
6513/* vec_vpkuhus */
6514
6515static __inline__ vector unsigned char __attribute__((__always_inline__))
6516vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
6517#ifdef __LITTLE_ENDIAN__
6518  return __builtin_altivec_vpkuhus(__b, __a);
6519#else
6520  return __builtin_altivec_vpkuhus(__a, __b);
6521#endif
6522}
6523
6524/* vec_vpkudus */
6525
6526#ifdef __POWER8_VECTOR__
6527static __inline__ vector unsigned int __attribute__((__always_inline__))
6528vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
6529#ifdef __LITTLE_ENDIAN__
6530  return __builtin_altivec_vpkudus(__b, __a);
6531#else
6532  return __builtin_altivec_vpkudus(__a, __b);
6533#endif
6534}
6535#endif
6536
6537/* vec_vpkswss */
6538
6539static __inline__ vector signed short __attribute__((__always_inline__))
6540vec_vpkswss(vector int __a, vector int __b) {
6541#ifdef __LITTLE_ENDIAN__
6542  return __builtin_altivec_vpkswss(__b, __a);
6543#else
6544  return __builtin_altivec_vpkswss(__a, __b);
6545#endif
6546}
6547
6548/* vec_vpkuwus */
6549
6550static __inline__ vector unsigned short __attribute__((__always_inline__))
6551vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
6552#ifdef __LITTLE_ENDIAN__
6553  return __builtin_altivec_vpkuwus(__b, __a);
6554#else
6555  return __builtin_altivec_vpkuwus(__a, __b);
6556#endif
6557}
6558
6559/* vec_packsu */
6560
6561static __inline__ vector unsigned char __ATTRS_o_ai
6562vec_packsu(vector short __a, vector short __b) {
6563#ifdef __LITTLE_ENDIAN__
6564  return __builtin_altivec_vpkshus(__b, __a);
6565#else
6566  return __builtin_altivec_vpkshus(__a, __b);
6567#endif
6568}
6569
6570static __inline__ vector unsigned char __ATTRS_o_ai
6571vec_packsu(vector unsigned short __a, vector unsigned short __b) {
6572#ifdef __LITTLE_ENDIAN__
6573  return __builtin_altivec_vpkuhus(__b, __a);
6574#else
6575  return __builtin_altivec_vpkuhus(__a, __b);
6576#endif
6577}
6578
6579static __inline__ vector unsigned short __ATTRS_o_ai
6580vec_packsu(vector int __a, vector int __b) {
6581#ifdef __LITTLE_ENDIAN__
6582  return __builtin_altivec_vpkswus(__b, __a);
6583#else
6584  return __builtin_altivec_vpkswus(__a, __b);
6585#endif
6586}
6587
6588static __inline__ vector unsigned short __ATTRS_o_ai
6589vec_packsu(vector unsigned int __a, vector unsigned int __b) {
6590#ifdef __LITTLE_ENDIAN__
6591  return __builtin_altivec_vpkuwus(__b, __a);
6592#else
6593  return __builtin_altivec_vpkuwus(__a, __b);
6594#endif
6595}
6596
6597#ifdef __POWER8_VECTOR__
6598static __inline__ vector unsigned int __ATTRS_o_ai
6599vec_packsu(vector long long __a, vector long long __b) {
6600#ifdef __LITTLE_ENDIAN__
6601  return __builtin_altivec_vpksdus(__b, __a);
6602#else
6603  return __builtin_altivec_vpksdus(__a, __b);
6604#endif
6605}
6606
6607static __inline__ vector unsigned int __ATTRS_o_ai
6608vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
6609#ifdef __LITTLE_ENDIAN__
6610  return __builtin_altivec_vpkudus(__b, __a);
6611#else
6612  return __builtin_altivec_vpkudus(__a, __b);
6613#endif
6614}
6615#endif
6616
6617/* vec_vpkshus */
6618
6619static __inline__ vector unsigned char __ATTRS_o_ai
6620vec_vpkshus(vector short __a, vector short __b) {
6621#ifdef __LITTLE_ENDIAN__
6622  return __builtin_altivec_vpkshus(__b, __a);
6623#else
6624  return __builtin_altivec_vpkshus(__a, __b);
6625#endif
6626}
6627
6628static __inline__ vector unsigned char __ATTRS_o_ai
6629vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
6630#ifdef __LITTLE_ENDIAN__
6631  return __builtin_altivec_vpkuhus(__b, __a);
6632#else
6633  return __builtin_altivec_vpkuhus(__a, __b);
6634#endif
6635}
6636
6637/* vec_vpkswus */
6638
6639static __inline__ vector unsigned short __ATTRS_o_ai
6640vec_vpkswus(vector int __a, vector int __b) {
6641#ifdef __LITTLE_ENDIAN__
6642  return __builtin_altivec_vpkswus(__b, __a);
6643#else
6644  return __builtin_altivec_vpkswus(__a, __b);
6645#endif
6646}
6647
6648static __inline__ vector unsigned short __ATTRS_o_ai
6649vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
6650#ifdef __LITTLE_ENDIAN__
6651  return __builtin_altivec_vpkuwus(__b, __a);
6652#else
6653  return __builtin_altivec_vpkuwus(__a, __b);
6654#endif
6655}
6656
6657/* vec_vpksdus */
6658
6659#ifdef __POWER8_VECTOR__
6660static __inline__ vector unsigned int __ATTRS_o_ai
6661vec_vpksdus(vector long long __a, vector long long __b) {
6662#ifdef __LITTLE_ENDIAN__
6663  return __builtin_altivec_vpksdus(__b, __a);
6664#else
6665  return __builtin_altivec_vpksdus(__a, __b);
6666#endif
6667}
6668#endif
6669
6670/* vec_perm */
6671
6672// The vperm instruction is defined architecturally with a big-endian bias.
6673// For little endian, we swap the input operands and invert the permute
6674// control vector.  Only the rightmost 5 bits matter, so we could use
6675// a vector of all 31s instead of all 255s to perform the inversion.
6676// However, when the PCV is not a constant, using 255 has an advantage
6677// in that the vec_xor can be recognized as a vec_nor (and for P8 and
6678// later, possibly a vec_nand).
6679
6680static __inline__ vector signed char __ATTRS_o_ai vec_perm(
6681    vector signed char __a, vector signed char __b, vector unsigned char __c) {
6682#ifdef __LITTLE_ENDIAN__
6683  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6684                              255, 255, 255, 255, 255, 255, 255, 255};
6685  __d = vec_xor(__c, __d);
6686  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
6687                                                         (vector int)__a, __d);
6688#else
6689  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
6690                                                         (vector int)__b, __c);
6691#endif
6692}
6693
6694static __inline__ vector unsigned char __ATTRS_o_ai
6695vec_perm(vector unsigned char __a, vector unsigned char __b,
6696         vector unsigned char __c) {
6697#ifdef __LITTLE_ENDIAN__
6698  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6699                              255, 255, 255, 255, 255, 255, 255, 255};
6700  __d = vec_xor(__c, __d);
6701  return (vector unsigned char)__builtin_altivec_vperm_4si(
6702      (vector int)__b, (vector int)__a, __d);
6703#else
6704  return (vector unsigned char)__builtin_altivec_vperm_4si(
6705      (vector int)__a, (vector int)__b, __c);
6706#endif
6707}
6708
6709static __inline__ vector bool char __ATTRS_o_ai
6710vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
6711#ifdef __LITTLE_ENDIAN__
6712  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6713                              255, 255, 255, 255, 255, 255, 255, 255};
6714  __d = vec_xor(__c, __d);
6715  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
6716                                                       (vector int)__a, __d);
6717#else
6718  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
6719                                                       (vector int)__b, __c);
6720#endif
6721}
6722
6723static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
6724                                                     vector signed short __b,
6725                                                     vector unsigned char __c) {
6726#ifdef __LITTLE_ENDIAN__
6727  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6728                              255, 255, 255, 255, 255, 255, 255, 255};
6729  __d = vec_xor(__c, __d);
6730  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
6731                                                          (vector int)__a, __d);
6732#else
6733  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
6734                                                          (vector int)__b, __c);
6735#endif
6736}
6737
6738static __inline__ vector unsigned short __ATTRS_o_ai
6739vec_perm(vector unsigned short __a, vector unsigned short __b,
6740         vector unsigned char __c) {
6741#ifdef __LITTLE_ENDIAN__
6742  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6743                              255, 255, 255, 255, 255, 255, 255, 255};
6744  __d = vec_xor(__c, __d);
6745  return (vector unsigned short)__builtin_altivec_vperm_4si(
6746      (vector int)__b, (vector int)__a, __d);
6747#else
6748  return (vector unsigned short)__builtin_altivec_vperm_4si(
6749      (vector int)__a, (vector int)__b, __c);
6750#endif
6751}
6752
6753static __inline__ vector bool short __ATTRS_o_ai vec_perm(
6754    vector bool short __a, vector bool short __b, vector unsigned char __c) {
6755#ifdef __LITTLE_ENDIAN__
6756  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6757                              255, 255, 255, 255, 255, 255, 255, 255};
6758  __d = vec_xor(__c, __d);
6759  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
6760                                                        (vector int)__a, __d);
6761#else
6762  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
6763                                                        (vector int)__b, __c);
6764#endif
6765}
6766
6767static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
6768                                                     vector pixel __b,
6769                                                     vector unsigned char __c) {
6770#ifdef __LITTLE_ENDIAN__
6771  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6772                              255, 255, 255, 255, 255, 255, 255, 255};
6773  __d = vec_xor(__c, __d);
6774  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
6775                                                   (vector int)__a, __d);
6776#else
6777  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
6778                                                   (vector int)__b, __c);
6779#endif
6780}
6781
6782static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
6783                                                   vector signed int __b,
6784                                                   vector unsigned char __c) {
6785#ifdef __LITTLE_ENDIAN__
6786  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6787                              255, 255, 255, 255, 255, 255, 255, 255};
6788  __d = vec_xor(__c, __d);
6789  return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
6790#else
6791  return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
6792#endif
6793}
6794
6795static __inline__ vector unsigned int __ATTRS_o_ai
6796vec_perm(vector unsigned int __a, vector unsigned int __b,
6797         vector unsigned char __c) {
6798#ifdef __LITTLE_ENDIAN__
6799  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6800                              255, 255, 255, 255, 255, 255, 255, 255};
6801  __d = vec_xor(__c, __d);
6802  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
6803                                                          (vector int)__a, __d);
6804#else
6805  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
6806                                                          (vector int)__b, __c);
6807#endif
6808}
6809
6810static __inline__ vector bool int __ATTRS_o_ai
6811vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6812#ifdef __LITTLE_ENDIAN__
6813  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6814                              255, 255, 255, 255, 255, 255, 255, 255};
6815  __d = vec_xor(__c, __d);
6816  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
6817                                                      (vector int)__a, __d);
6818#else
6819  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
6820                                                      (vector int)__b, __c);
6821#endif
6822}
6823
6824static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
6825                                                     vector float __b,
6826                                                     vector unsigned char __c) {
6827#ifdef __LITTLE_ENDIAN__
6828  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6829                              255, 255, 255, 255, 255, 255, 255, 255};
6830  __d = vec_xor(__c, __d);
6831  return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
6832                                                   (vector int)__a, __d);
6833#else
6834  return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
6835                                                   (vector int)__b, __c);
6836#endif
6837}
6838
6839#ifdef __VSX__
6840static __inline__ vector long long __ATTRS_o_ai
6841vec_perm(vector signed long long __a, vector signed long long __b,
6842         vector unsigned char __c) {
6843#ifdef __LITTLE_ENDIAN__
6844  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6845                              255, 255, 255, 255, 255, 255, 255, 255};
6846  __d = vec_xor(__c, __d);
6847  return (vector signed long long)__builtin_altivec_vperm_4si(
6848      (vector int)__b, (vector int)__a, __d);
6849#else
6850  return (vector signed long long)__builtin_altivec_vperm_4si(
6851      (vector int)__a, (vector int)__b, __c);
6852#endif
6853}
6854
6855static __inline__ vector unsigned long long __ATTRS_o_ai
6856vec_perm(vector unsigned long long __a, vector unsigned long long __b,
6857         vector unsigned char __c) {
6858#ifdef __LITTLE_ENDIAN__
6859  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6860                              255, 255, 255, 255, 255, 255, 255, 255};
6861  __d = vec_xor(__c, __d);
6862  return (vector unsigned long long)__builtin_altivec_vperm_4si(
6863      (vector int)__b, (vector int)__a, __d);
6864#else
6865  return (vector unsigned long long)__builtin_altivec_vperm_4si(
6866      (vector int)__a, (vector int)__b, __c);
6867#endif
6868}
6869
6870static __inline__ vector bool long long __ATTRS_o_ai
6871vec_perm(vector bool long long __a, vector bool long long __b,
6872         vector unsigned char __c) {
6873#ifdef __LITTLE_ENDIAN__
6874  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6875                              255, 255, 255, 255, 255, 255, 255, 255};
6876  __d = vec_xor(__c, __d);
6877  return (vector bool long long)__builtin_altivec_vperm_4si(
6878      (vector int)__b, (vector int)__a, __d);
6879#else
6880  return (vector bool long long)__builtin_altivec_vperm_4si(
6881      (vector int)__a, (vector int)__b, __c);
6882#endif
6883}
6884
6885static __inline__ vector double __ATTRS_o_ai
6886vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
6887#ifdef __LITTLE_ENDIAN__
6888  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6889                              255, 255, 255, 255, 255, 255, 255, 255};
6890  __d = vec_xor(__c, __d);
6891  return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
6892                                                    (vector int)__a, __d);
6893#else
6894  return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
6895                                                    (vector int)__b, __c);
6896#endif
6897}
6898#endif
6899
6900/* vec_vperm */
6901
6902static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
6903    vector signed char __a, vector signed char __b, vector unsigned char __c) {
6904  return vec_perm(__a, __b, __c);
6905}
6906
6907static __inline__ vector unsigned char __ATTRS_o_ai
6908vec_vperm(vector unsigned char __a, vector unsigned char __b,
6909          vector unsigned char __c) {
6910  return vec_perm(__a, __b, __c);
6911}
6912
6913static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
6914    vector bool char __a, vector bool char __b, vector unsigned char __c) {
6915  return vec_perm(__a, __b, __c);
6916}
6917
6918static __inline__ vector short __ATTRS_o_ai
6919vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
6920  return vec_perm(__a, __b, __c);
6921}
6922
6923static __inline__ vector unsigned short __ATTRS_o_ai
6924vec_vperm(vector unsigned short __a, vector unsigned short __b,
6925          vector unsigned char __c) {
6926  return vec_perm(__a, __b, __c);
6927}
6928
6929static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
6930    vector bool short __a, vector bool short __b, vector unsigned char __c) {
6931  return vec_perm(__a, __b, __c);
6932}
6933
6934static __inline__ vector pixel __ATTRS_o_ai
6935vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
6936  return vec_perm(__a, __b, __c);
6937}
6938
6939static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
6940                                                    vector int __b,
6941                                                    vector unsigned char __c) {
6942  return vec_perm(__a, __b, __c);
6943}
6944
6945static __inline__ vector unsigned int __ATTRS_o_ai
6946vec_vperm(vector unsigned int __a, vector unsigned int __b,
6947          vector unsigned char __c) {
6948  return vec_perm(__a, __b, __c);
6949}
6950
6951static __inline__ vector bool int __ATTRS_o_ai
6952vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6953  return vec_perm(__a, __b, __c);
6954}
6955
6956static __inline__ vector float __ATTRS_o_ai
6957vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
6958  return vec_perm(__a, __b, __c);
6959}
6960
6961#ifdef __VSX__
6962static __inline__ vector long long __ATTRS_o_ai vec_vperm(
6963    vector long long __a, vector long long __b, vector unsigned char __c) {
6964  return vec_perm(__a, __b, __c);
6965}
6966
6967static __inline__ vector unsigned long long __ATTRS_o_ai
6968vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
6969          vector unsigned char __c) {
6970  return vec_perm(__a, __b, __c);
6971}
6972
6973static __inline__ vector double __ATTRS_o_ai
6974vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
6975  return vec_perm(__a, __b, __c);
6976}
6977#endif
6978
6979/* vec_re */
6980
6981static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
6982#ifdef __VSX__
6983  return __builtin_vsx_xvresp(__a);
6984#else
6985  return __builtin_altivec_vrefp(__a);
6986#endif
6987}
6988
6989#ifdef __VSX__
6990static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
6991  return __builtin_vsx_xvredp(__a);
6992}
6993#endif
6994
6995/* vec_vrefp */
6996
6997static __inline__ vector float __attribute__((__always_inline__))
6998vec_vrefp(vector float __a) {
6999  return __builtin_altivec_vrefp(__a);
7000}
7001
7002/* vec_rl */
7003
7004static __inline__ vector signed char __ATTRS_o_ai
7005vec_rl(vector signed char __a, vector unsigned char __b) {
7006  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7007}
7008
7009static __inline__ vector unsigned char __ATTRS_o_ai
7010vec_rl(vector unsigned char __a, vector unsigned char __b) {
7011  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7012}
7013
7014static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7015                                                   vector unsigned short __b) {
7016  return __builtin_altivec_vrlh(__a, __b);
7017}
7018
7019static __inline__ vector unsigned short __ATTRS_o_ai
7020vec_rl(vector unsigned short __a, vector unsigned short __b) {
7021  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7022}
7023
7024static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7025                                                 vector unsigned int __b) {
7026  return __builtin_altivec_vrlw(__a, __b);
7027}
7028
7029static __inline__ vector unsigned int __ATTRS_o_ai
7030vec_rl(vector unsigned int __a, vector unsigned int __b) {
7031  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7032}
7033
7034#ifdef __POWER8_VECTOR__
7035static __inline__ vector signed long long __ATTRS_o_ai
7036vec_rl(vector signed long long __a, vector unsigned long long __b) {
7037  return __builtin_altivec_vrld(__a, __b);
7038}
7039
7040static __inline__ vector unsigned long long __ATTRS_o_ai
7041vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7042  return __builtin_altivec_vrld(__a, __b);
7043}
7044#endif
7045
7046/* vec_vrlb */
7047
7048static __inline__ vector signed char __ATTRS_o_ai
7049vec_vrlb(vector signed char __a, vector unsigned char __b) {
7050  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7051}
7052
7053static __inline__ vector unsigned char __ATTRS_o_ai
7054vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7055  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7056}
7057
7058/* vec_vrlh */
7059
7060static __inline__ vector short __ATTRS_o_ai
7061vec_vrlh(vector short __a, vector unsigned short __b) {
7062  return __builtin_altivec_vrlh(__a, __b);
7063}
7064
7065static __inline__ vector unsigned short __ATTRS_o_ai
7066vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7067  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7068}
7069
7070/* vec_vrlw */
7071
7072static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7073                                                   vector unsigned int __b) {
7074  return __builtin_altivec_vrlw(__a, __b);
7075}
7076
7077static __inline__ vector unsigned int __ATTRS_o_ai
7078vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7079  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7080}
7081
7082/* vec_round */
7083
7084static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7085#ifdef __VSX__
7086  return __builtin_vsx_xvrspi(__a);
7087#else
7088  return __builtin_altivec_vrfin(__a);
7089#endif
7090}
7091
7092#ifdef __VSX__
7093static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7094  return __builtin_vsx_xvrdpi(__a);
7095}
7096
7097/* vec_rint */
7098
7099static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7100  return __builtin_vsx_xvrspic(__a);
7101}
7102
7103static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7104  return __builtin_vsx_xvrdpic(__a);
7105}
7106
7107/* vec_nearbyint */
7108
7109static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7110  return __builtin_vsx_xvrspi(__a);
7111}
7112
7113static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7114  return __builtin_vsx_xvrdpi(__a);
7115}
7116#endif
7117
7118/* vec_vrfin */
7119
7120static __inline__ vector float __attribute__((__always_inline__))
7121vec_vrfin(vector float __a) {
7122  return __builtin_altivec_vrfin(__a);
7123}
7124
7125/* vec_sqrt */
7126
7127#ifdef __VSX__
7128static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7129  return __builtin_vsx_xvsqrtsp(__a);
7130}
7131
7132static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7133  return __builtin_vsx_xvsqrtdp(__a);
7134}
7135#endif
7136
7137/* vec_rsqrte */
7138
7139static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7140#ifdef __VSX__
7141  return __builtin_vsx_xvrsqrtesp(__a);
7142#else
7143  return __builtin_altivec_vrsqrtefp(__a);
7144#endif
7145}
7146
7147#ifdef __VSX__
7148static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7149  return __builtin_vsx_xvrsqrtedp(__a);
7150}
7151#endif
7152
7153/* vec_vrsqrtefp */
7154
7155static __inline__ __vector float __attribute__((__always_inline__))
7156vec_vrsqrtefp(vector float __a) {
7157  return __builtin_altivec_vrsqrtefp(__a);
7158}
7159
7160/* vec_sel */
7161
7162#define __builtin_altivec_vsel_4si vec_sel
7163
7164static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7165    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7166  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7167}
7168
7169static __inline__ vector signed char __ATTRS_o_ai
7170vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7171  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7172}
7173
7174static __inline__ vector unsigned char __ATTRS_o_ai
7175vec_sel(vector unsigned char __a, vector unsigned char __b,
7176        vector unsigned char __c) {
7177  return (__a & ~__c) | (__b & __c);
7178}
7179
7180static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7181    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7182  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7183}
7184
7185static __inline__ vector bool char __ATTRS_o_ai
7186vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7187  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7188}
7189
7190static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7191                                                        vector bool char __b,
7192                                                        vector bool char __c) {
7193  return (__a & ~__c) | (__b & __c);
7194}
7195
7196static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7197                                                    vector short __b,
7198                                                    vector unsigned short __c) {
7199  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7200}
7201
7202static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7203                                                    vector short __b,
7204                                                    vector bool short __c) {
7205  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7206}
7207
7208static __inline__ vector unsigned short __ATTRS_o_ai
7209vec_sel(vector unsigned short __a, vector unsigned short __b,
7210        vector unsigned short __c) {
7211  return (__a & ~__c) | (__b & __c);
7212}
7213
7214static __inline__ vector unsigned short __ATTRS_o_ai
7215vec_sel(vector unsigned short __a, vector unsigned short __b,
7216        vector bool short __c) {
7217  return (__a & ~(vector unsigned short)__c) |
7218         (__b & (vector unsigned short)__c);
7219}
7220
7221static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7222    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7223  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7224}
7225
7226static __inline__ vector bool short __ATTRS_o_ai
7227vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7228  return (__a & ~__c) | (__b & __c);
7229}
7230
7231static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7232                                                  vector int __b,
7233                                                  vector unsigned int __c) {
7234  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7235}
7236
7237static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7238                                                  vector int __b,
7239                                                  vector bool int __c) {
7240  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7241}
7242
7243static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7244    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7245  return (__a & ~__c) | (__b & __c);
7246}
7247
7248static __inline__ vector unsigned int __ATTRS_o_ai
7249vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7250  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7251}
7252
7253static __inline__ vector bool int __ATTRS_o_ai
7254vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7255  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7256}
7257
7258static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7259                                                       vector bool int __b,
7260                                                       vector bool int __c) {
7261  return (__a & ~__c) | (__b & __c);
7262}
7263
7264static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7265                                                    vector float __b,
7266                                                    vector unsigned int __c) {
7267  vector int __res = ((vector int)__a & ~(vector int)__c) |
7268                     ((vector int)__b & (vector int)__c);
7269  return (vector float)__res;
7270}
7271
7272static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7273                                                    vector float __b,
7274                                                    vector bool int __c) {
7275  vector int __res = ((vector int)__a & ~(vector int)__c) |
7276                     ((vector int)__b & (vector int)__c);
7277  return (vector float)__res;
7278}
7279
7280#ifdef __VSX__
7281static __inline__ vector double __ATTRS_o_ai
7282vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7283  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7284                           ((vector long long)__b & (vector long long)__c);
7285  return (vector double)__res;
7286}
7287
7288static __inline__ vector double __ATTRS_o_ai
7289vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7290  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7291                           ((vector long long)__b & (vector long long)__c);
7292  return (vector double)__res;
7293}
7294#endif
7295
7296/* vec_vsel */
7297
7298static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7299    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7300  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7301}
7302
7303static __inline__ vector signed char __ATTRS_o_ai
7304vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7305  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7306}
7307
7308static __inline__ vector unsigned char __ATTRS_o_ai
7309vec_vsel(vector unsigned char __a, vector unsigned char __b,
7310         vector unsigned char __c) {
7311  return (__a & ~__c) | (__b & __c);
7312}
7313
7314static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7315    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7316  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7317}
7318
7319static __inline__ vector bool char __ATTRS_o_ai
7320vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7321  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7322}
7323
7324static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7325                                                         vector bool char __b,
7326                                                         vector bool char __c) {
7327  return (__a & ~__c) | (__b & __c);
7328}
7329
7330static __inline__ vector short __ATTRS_o_ai
7331vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7332  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7333}
7334
7335static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7336                                                     vector short __b,
7337                                                     vector bool short __c) {
7338  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7339}
7340
7341static __inline__ vector unsigned short __ATTRS_o_ai
7342vec_vsel(vector unsigned short __a, vector unsigned short __b,
7343         vector unsigned short __c) {
7344  return (__a & ~__c) | (__b & __c);
7345}
7346
7347static __inline__ vector unsigned short __ATTRS_o_ai
7348vec_vsel(vector unsigned short __a, vector unsigned short __b,
7349         vector bool short __c) {
7350  return (__a & ~(vector unsigned short)__c) |
7351         (__b & (vector unsigned short)__c);
7352}
7353
7354static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7355    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7356  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7357}
7358
7359static __inline__ vector bool short __ATTRS_o_ai
7360vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7361  return (__a & ~__c) | (__b & __c);
7362}
7363
7364static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7365                                                   vector int __b,
7366                                                   vector unsigned int __c) {
7367  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7368}
7369
7370static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7371                                                   vector int __b,
7372                                                   vector bool int __c) {
7373  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7374}
7375
7376static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7377    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7378  return (__a & ~__c) | (__b & __c);
7379}
7380
7381static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7382    vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7383  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7384}
7385
7386static __inline__ vector bool int __ATTRS_o_ai
7387vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7388  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7389}
7390
7391static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
7392                                                        vector bool int __b,
7393                                                        vector bool int __c) {
7394  return (__a & ~__c) | (__b & __c);
7395}
7396
7397static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
7398                                                     vector float __b,
7399                                                     vector unsigned int __c) {
7400  vector int __res = ((vector int)__a & ~(vector int)__c) |
7401                     ((vector int)__b & (vector int)__c);
7402  return (vector float)__res;
7403}
7404
7405static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
7406                                                     vector float __b,
7407                                                     vector bool int __c) {
7408  vector int __res = ((vector int)__a & ~(vector int)__c) |
7409                     ((vector int)__b & (vector int)__c);
7410  return (vector float)__res;
7411}
7412
7413/* vec_sl */
7414
7415static __inline__ vector signed char __ATTRS_o_ai
7416vec_sl(vector signed char __a, vector unsigned char __b) {
7417  return __a << (vector signed char)__b;
7418}
7419
7420static __inline__ vector unsigned char __ATTRS_o_ai
7421vec_sl(vector unsigned char __a, vector unsigned char __b) {
7422  return __a << __b;
7423}
7424
7425static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
7426                                                   vector unsigned short __b) {
7427  return __a << (vector short)__b;
7428}
7429
7430static __inline__ vector unsigned short __ATTRS_o_ai
7431vec_sl(vector unsigned short __a, vector unsigned short __b) {
7432  return __a << __b;
7433}
7434
7435static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
7436                                                 vector unsigned int __b) {
7437  return __a << (vector int)__b;
7438}
7439
7440static __inline__ vector unsigned int __ATTRS_o_ai
7441vec_sl(vector unsigned int __a, vector unsigned int __b) {
7442  return __a << __b;
7443}
7444
7445#ifdef __POWER8_VECTOR__
7446static __inline__ vector signed long long __ATTRS_o_ai
7447vec_sl(vector signed long long __a, vector unsigned long long __b) {
7448  return __a << (vector long long)__b;
7449}
7450
7451static __inline__ vector unsigned long long __ATTRS_o_ai
7452vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
7453  return __a << __b;
7454}
7455#endif
7456
7457/* vec_vslb */
7458
7459#define __builtin_altivec_vslb vec_vslb
7460
7461static __inline__ vector signed char __ATTRS_o_ai
7462vec_vslb(vector signed char __a, vector unsigned char __b) {
7463  return vec_sl(__a, __b);
7464}
7465
7466static __inline__ vector unsigned char __ATTRS_o_ai
7467vec_vslb(vector unsigned char __a, vector unsigned char __b) {
7468  return vec_sl(__a, __b);
7469}
7470
7471/* vec_vslh */
7472
7473#define __builtin_altivec_vslh vec_vslh
7474
7475static __inline__ vector short __ATTRS_o_ai
7476vec_vslh(vector short __a, vector unsigned short __b) {
7477  return vec_sl(__a, __b);
7478}
7479
7480static __inline__ vector unsigned short __ATTRS_o_ai
7481vec_vslh(vector unsigned short __a, vector unsigned short __b) {
7482  return vec_sl(__a, __b);
7483}
7484
7485/* vec_vslw */
7486
7487#define __builtin_altivec_vslw vec_vslw
7488
7489static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
7490                                                   vector unsigned int __b) {
7491  return vec_sl(__a, __b);
7492}
7493
7494static __inline__ vector unsigned int __ATTRS_o_ai
7495vec_vslw(vector unsigned int __a, vector unsigned int __b) {
7496  return vec_sl(__a, __b);
7497}
7498
7499/* vec_sld */
7500
7501#define __builtin_altivec_vsldoi_4si vec_sld
7502
7503static __inline__ vector signed char __ATTRS_o_ai vec_sld(
7504    vector signed char __a, vector signed char __b, unsigned const int __c) {
7505  unsigned char __d = __c & 0x0F;
7506#ifdef __LITTLE_ENDIAN__
7507  return vec_perm(
7508      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7509                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7510                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7511                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7512#else
7513  return vec_perm(
7514      __a, __b,
7515      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7516                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7517                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7518#endif
7519}
7520
7521static __inline__ vector unsigned char __ATTRS_o_ai
7522vec_sld(vector unsigned char __a, vector unsigned char __b,
7523        unsigned const int __c) {
7524  unsigned char __d = __c & 0x0F;
7525#ifdef __LITTLE_ENDIAN__
7526  return vec_perm(
7527      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7528                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7529                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7530                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7531#else
7532  return vec_perm(
7533      __a, __b,
7534      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7535                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7536                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7537#endif
7538}
7539
7540static __inline__ vector bool char __ATTRS_o_ai
7541vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
7542  unsigned char __d = __c & 0x0F;
7543#ifdef __LITTLE_ENDIAN__
7544  return vec_perm(
7545      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7546                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7547                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7548                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7549#else
7550  return vec_perm(
7551      __a, __b,
7552      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7553                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7554                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7555#endif
7556}
7557
7558static __inline__ vector signed short __ATTRS_o_ai vec_sld(
7559    vector signed short __a, vector signed short __b, unsigned const int __c) {
7560  unsigned char __d = __c & 0x0F;
7561#ifdef __LITTLE_ENDIAN__
7562  return vec_perm(
7563      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7564                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7565                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7566                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7567#else
7568  return vec_perm(
7569      __a, __b,
7570      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7571                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7572                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7573#endif
7574}
7575
7576static __inline__ vector unsigned short __ATTRS_o_ai
7577vec_sld(vector unsigned short __a, vector unsigned short __b,
7578        unsigned const int __c) {
7579  unsigned char __d = __c & 0x0F;
7580#ifdef __LITTLE_ENDIAN__
7581  return vec_perm(
7582      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7583                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7584                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7585                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7586#else
7587  return vec_perm(
7588      __a, __b,
7589      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7590                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7591                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7592#endif
7593}
7594
7595static __inline__ vector bool short __ATTRS_o_ai
7596vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
7597  unsigned char __d = __c & 0x0F;
7598#ifdef __LITTLE_ENDIAN__
7599  return vec_perm(
7600      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7601                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7602                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7603                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7604#else
7605  return vec_perm(
7606      __a, __b,
7607      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7608                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7609                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7610#endif
7611}
7612
7613static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
7614                                                    vector pixel __b,
7615                                                    unsigned const int __c) {
7616  unsigned char __d = __c & 0x0F;
7617#ifdef __LITTLE_ENDIAN__
7618  return vec_perm(
7619      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7620                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7621                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7622                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7623#else
7624  return vec_perm(
7625      __a, __b,
7626      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7627                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7628                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7629#endif
7630}
7631
7632static __inline__ vector signed int __ATTRS_o_ai
7633vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
7634  unsigned char __d = __c & 0x0F;
7635#ifdef __LITTLE_ENDIAN__
7636  return vec_perm(
7637      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7638                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7639                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7640                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7641#else
7642  return vec_perm(
7643      __a, __b,
7644      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7645                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7646                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7647#endif
7648}
7649
7650static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
7651    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
7652  unsigned char __d = __c & 0x0F;
7653#ifdef __LITTLE_ENDIAN__
7654  return vec_perm(
7655      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7656                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7657                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7658                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7659#else
7660  return vec_perm(
7661      __a, __b,
7662      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7663                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7664                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7665#endif
7666}
7667
7668static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
7669                                                       vector bool int __b,
7670                                                       unsigned const int __c) {
7671  unsigned char __d = __c & 0x0F;
7672#ifdef __LITTLE_ENDIAN__
7673  return vec_perm(
7674      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7675                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7676                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7677                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7678#else
7679  return vec_perm(
7680      __a, __b,
7681      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7682                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7683                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7684#endif
7685}
7686
7687static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
7688                                                    vector float __b,
7689                                                    unsigned const int __c) {
7690  unsigned char __d = __c & 0x0F;
7691#ifdef __LITTLE_ENDIAN__
7692  return vec_perm(
7693      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7694                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7695                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7696                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7697#else
7698  return vec_perm(
7699      __a, __b,
7700      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7701                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7702                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7703#endif
7704}
7705
7706#ifdef __VSX__
7707static __inline__ vector bool long long __ATTRS_o_ai
7708vec_sld(vector bool long long __a, vector bool long long __b,
7709        unsigned const int __c) {
7710  unsigned char __d = __c & 0x0F;
7711#ifdef __LITTLE_ENDIAN__
7712  return vec_perm(
7713      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7714                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7715                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7716                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7717#else
7718  return vec_perm(
7719      __a, __b,
7720      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7721                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7722                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7723#endif
7724}
7725
7726static __inline__ vector signed long long __ATTRS_o_ai
7727vec_sld(vector signed long long __a, vector signed long long __b,
7728        unsigned const int __c) {
7729  unsigned char __d = __c & 0x0F;
7730#ifdef __LITTLE_ENDIAN__
7731  return vec_perm(
7732      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7733                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7734                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7735                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7736#else
7737  return vec_perm(
7738      __a, __b,
7739      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7740                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7741                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7742#endif
7743}
7744
7745static __inline__ vector unsigned long long __ATTRS_o_ai
7746vec_sld(vector unsigned long long __a, vector unsigned long long __b,
7747        unsigned const int __c) {
7748  unsigned char __d = __c & 0x0F;
7749#ifdef __LITTLE_ENDIAN__
7750  return vec_perm(
7751      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7752                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7753                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7754                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7755#else
7756  return vec_perm(
7757      __a, __b,
7758      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7759                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7760                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7761#endif
7762}
7763
7764static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
7765                                                     vector double __b,
7766                                                     unsigned const int __c) {
7767  unsigned char __d = __c & 0x0F;
7768#ifdef __LITTLE_ENDIAN__
7769  return vec_perm(
7770      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7771                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7772                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7773                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7774#else
7775  return vec_perm(
7776      __a, __b,
7777      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7778                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7779                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7780#endif
7781}
7782#endif
7783
7784/* vec_sldw */
7785static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
7786    vector signed char __a, vector signed char __b, unsigned const int __c) {
7787  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7788}
7789
7790static __inline__ vector unsigned char __ATTRS_o_ai
7791vec_sldw(vector unsigned char __a, vector unsigned char __b,
7792         unsigned const int __c) {
7793  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7794}
7795
7796static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
7797    vector signed short __a, vector signed short __b, unsigned const int __c) {
7798  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7799}
7800
7801static __inline__ vector unsigned short __ATTRS_o_ai
7802vec_sldw(vector unsigned short __a, vector unsigned short __b,
7803         unsigned const int __c) {
7804  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7805}
7806
7807static __inline__ vector signed int __ATTRS_o_ai
7808vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
7809  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7810}
7811
7812static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
7813    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
7814  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7815}
7816
7817#ifdef __VSX__
7818static __inline__ vector signed long long __ATTRS_o_ai
7819vec_sldw(vector signed long long __a, vector signed long long __b,
7820         unsigned const int __c) {
7821  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7822}
7823
7824static __inline__ vector unsigned long long __ATTRS_o_ai
7825vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
7826         unsigned const int __c) {
7827  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
7828}
7829#endif
7830
7831#ifdef __POWER9_VECTOR__
7832/* vec_slv */
7833static __inline__ vector unsigned char __ATTRS_o_ai
7834vec_slv(vector unsigned char __a, vector unsigned char __b) {
7835  return __builtin_altivec_vslv(__a, __b);
7836}
7837
7838/* vec_srv */
7839static __inline__ vector unsigned char __ATTRS_o_ai
7840vec_srv(vector unsigned char __a, vector unsigned char __b) {
7841  return __builtin_altivec_vsrv(__a, __b);
7842}
7843#endif
7844
7845/* vec_vsldoi */
7846
7847static __inline__ vector signed char __ATTRS_o_ai
7848vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
7849  unsigned char __d = __c & 0x0F;
7850#ifdef __LITTLE_ENDIAN__
7851  return vec_perm(
7852      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7853                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7854                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7855                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7856#else
7857  return vec_perm(
7858      __a, __b,
7859      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7860                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7861                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7862#endif
7863}
7864
7865static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
7866    vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
7867  unsigned char __d = __c & 0x0F;
7868#ifdef __LITTLE_ENDIAN__
7869  return vec_perm(
7870      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7871                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7872                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7873                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7874#else
7875  return vec_perm(
7876      __a, __b,
7877      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7878                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7879                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7880#endif
7881}
7882
7883static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
7884                                                       vector short __b,
7885                                                       unsigned char __c) {
7886  unsigned char __d = __c & 0x0F;
7887#ifdef __LITTLE_ENDIAN__
7888  return vec_perm(
7889      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7890                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7891                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7892                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7893#else
7894  return vec_perm(
7895      __a, __b,
7896      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7897                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7898                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7899#endif
7900}
7901
7902static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
7903    vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
7904  unsigned char __d = __c & 0x0F;
7905#ifdef __LITTLE_ENDIAN__
7906  return vec_perm(
7907      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7908                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7909                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7910                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7911#else
7912  return vec_perm(
7913      __a, __b,
7914      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7915                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7916                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7917#endif
7918}
7919
7920static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
7921                                                       vector pixel __b,
7922                                                       unsigned char __c) {
7923  unsigned char __d = __c & 0x0F;
7924#ifdef __LITTLE_ENDIAN__
7925  return vec_perm(
7926      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7927                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7928                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7929                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7930#else
7931  return vec_perm(
7932      __a, __b,
7933      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7934                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7935                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7936#endif
7937}
7938
7939static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
7940                                                     vector int __b,
7941                                                     unsigned char __c) {
7942  unsigned char __d = __c & 0x0F;
7943#ifdef __LITTLE_ENDIAN__
7944  return vec_perm(
7945      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7946                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7947                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7948                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7949#else
7950  return vec_perm(
7951      __a, __b,
7952      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7953                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7954                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7955#endif
7956}
7957
7958static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
7959    vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
7960  unsigned char __d = __c & 0x0F;
7961#ifdef __LITTLE_ENDIAN__
7962  return vec_perm(
7963      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7964                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7965                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7966                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7967#else
7968  return vec_perm(
7969      __a, __b,
7970      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7971                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7972                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7973#endif
7974}
7975
7976static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
7977                                                       vector float __b,
7978                                                       unsigned char __c) {
7979  unsigned char __d = __c & 0x0F;
7980#ifdef __LITTLE_ENDIAN__
7981  return vec_perm(
7982      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7983                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7984                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7985                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7986#else
7987  return vec_perm(
7988      __a, __b,
7989      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7990                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7991                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7992#endif
7993}
7994
7995/* vec_sll */
7996
7997static __inline__ vector signed char __ATTRS_o_ai
7998vec_sll(vector signed char __a, vector unsigned char __b) {
7999  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8000                                                   (vector int)__b);
8001}
8002
8003static __inline__ vector signed char __ATTRS_o_ai
8004vec_sll(vector signed char __a, vector unsigned short __b) {
8005  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8006                                                   (vector int)__b);
8007}
8008
8009static __inline__ vector signed char __ATTRS_o_ai
8010vec_sll(vector signed char __a, vector unsigned int __b) {
8011  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8012                                                   (vector int)__b);
8013}
8014
8015static __inline__ vector unsigned char __ATTRS_o_ai
8016vec_sll(vector unsigned char __a, vector unsigned char __b) {
8017  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8018                                                     (vector int)__b);
8019}
8020
8021static __inline__ vector unsigned char __ATTRS_o_ai
8022vec_sll(vector unsigned char __a, vector unsigned short __b) {
8023  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8024                                                     (vector int)__b);
8025}
8026
8027static __inline__ vector unsigned char __ATTRS_o_ai
8028vec_sll(vector unsigned char __a, vector unsigned int __b) {
8029  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8030                                                     (vector int)__b);
8031}
8032
8033static __inline__ vector bool char __ATTRS_o_ai
8034vec_sll(vector bool char __a, vector unsigned char __b) {
8035  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8036                                                 (vector int)__b);
8037}
8038
8039static __inline__ vector bool char __ATTRS_o_ai
8040vec_sll(vector bool char __a, vector unsigned short __b) {
8041  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8042                                                 (vector int)__b);
8043}
8044
8045static __inline__ vector bool char __ATTRS_o_ai
8046vec_sll(vector bool char __a, vector unsigned int __b) {
8047  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8048                                                 (vector int)__b);
8049}
8050
8051static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8052                                                    vector unsigned char __b) {
8053  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8054}
8055
8056static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8057                                                    vector unsigned short __b) {
8058  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8059}
8060
8061static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8062                                                    vector unsigned int __b) {
8063  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8064}
8065
8066static __inline__ vector unsigned short __ATTRS_o_ai
8067vec_sll(vector unsigned short __a, vector unsigned char __b) {
8068  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8069                                                      (vector int)__b);
8070}
8071
8072static __inline__ vector unsigned short __ATTRS_o_ai
8073vec_sll(vector unsigned short __a, vector unsigned short __b) {
8074  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8075                                                      (vector int)__b);
8076}
8077
8078static __inline__ vector unsigned short __ATTRS_o_ai
8079vec_sll(vector unsigned short __a, vector unsigned int __b) {
8080  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8081                                                      (vector int)__b);
8082}
8083
8084static __inline__ vector bool short __ATTRS_o_ai
8085vec_sll(vector bool short __a, vector unsigned char __b) {
8086  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8087                                                  (vector int)__b);
8088}
8089
8090static __inline__ vector bool short __ATTRS_o_ai
8091vec_sll(vector bool short __a, vector unsigned short __b) {
8092  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8093                                                  (vector int)__b);
8094}
8095
8096static __inline__ vector bool short __ATTRS_o_ai
8097vec_sll(vector bool short __a, vector unsigned int __b) {
8098  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8099                                                  (vector int)__b);
8100}
8101
8102static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8103                                                    vector unsigned char __b) {
8104  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8105}
8106
8107static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8108                                                    vector unsigned short __b) {
8109  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8110}
8111
8112static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8113                                                    vector unsigned int __b) {
8114  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8115}
8116
8117static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8118                                                  vector unsigned char __b) {
8119  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8120}
8121
8122static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8123                                                  vector unsigned short __b) {
8124  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8125}
8126
8127static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8128                                                  vector unsigned int __b) {
8129  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8130}
8131
8132static __inline__ vector unsigned int __ATTRS_o_ai
8133vec_sll(vector unsigned int __a, vector unsigned char __b) {
8134  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8135                                                    (vector int)__b);
8136}
8137
8138static __inline__ vector unsigned int __ATTRS_o_ai
8139vec_sll(vector unsigned int __a, vector unsigned short __b) {
8140  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8141                                                    (vector int)__b);
8142}
8143
8144static __inline__ vector unsigned int __ATTRS_o_ai
8145vec_sll(vector unsigned int __a, vector unsigned int __b) {
8146  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8147                                                    (vector int)__b);
8148}
8149
8150static __inline__ vector bool int __ATTRS_o_ai
8151vec_sll(vector bool int __a, vector unsigned char __b) {
8152  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8153                                                (vector int)__b);
8154}
8155
8156static __inline__ vector bool int __ATTRS_o_ai
8157vec_sll(vector bool int __a, vector unsigned short __b) {
8158  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8159                                                (vector int)__b);
8160}
8161
8162static __inline__ vector bool int __ATTRS_o_ai
8163vec_sll(vector bool int __a, vector unsigned int __b) {
8164  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8165                                                (vector int)__b);
8166}
8167
8168#ifdef __VSX__
8169static __inline__ vector signed long long __ATTRS_o_ai
8170vec_sll(vector signed long long __a, vector unsigned char __b) {
8171  return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8172                                                        (vector int)__b);
8173}
8174
8175static __inline__ vector unsigned long long __ATTRS_o_ai
8176vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8177  return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8178                                                          (vector int)__b);
8179}
8180#endif
8181
8182/* vec_vsl */
8183
8184static __inline__ vector signed char __ATTRS_o_ai
8185vec_vsl(vector signed char __a, vector unsigned char __b) {
8186  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8187                                                   (vector int)__b);
8188}
8189
8190static __inline__ vector signed char __ATTRS_o_ai
8191vec_vsl(vector signed char __a, vector unsigned short __b) {
8192  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8193                                                   (vector int)__b);
8194}
8195
8196static __inline__ vector signed char __ATTRS_o_ai
8197vec_vsl(vector signed char __a, vector unsigned int __b) {
8198  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8199                                                   (vector int)__b);
8200}
8201
8202static __inline__ vector unsigned char __ATTRS_o_ai
8203vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8204  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8205                                                     (vector int)__b);
8206}
8207
8208static __inline__ vector unsigned char __ATTRS_o_ai
8209vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8210  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8211                                                     (vector int)__b);
8212}
8213
8214static __inline__ vector unsigned char __ATTRS_o_ai
8215vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8216  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8217                                                     (vector int)__b);
8218}
8219
8220static __inline__ vector bool char __ATTRS_o_ai
8221vec_vsl(vector bool char __a, vector unsigned char __b) {
8222  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8223                                                 (vector int)__b);
8224}
8225
8226static __inline__ vector bool char __ATTRS_o_ai
8227vec_vsl(vector bool char __a, vector unsigned short __b) {
8228  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8229                                                 (vector int)__b);
8230}
8231
8232static __inline__ vector bool char __ATTRS_o_ai
8233vec_vsl(vector bool char __a, vector unsigned int __b) {
8234  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8235                                                 (vector int)__b);
8236}
8237
8238static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8239                                                    vector unsigned char __b) {
8240  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8241}
8242
8243static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8244                                                    vector unsigned short __b) {
8245  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8246}
8247
8248static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8249                                                    vector unsigned int __b) {
8250  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8251}
8252
8253static __inline__ vector unsigned short __ATTRS_o_ai
8254vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8255  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8256                                                      (vector int)__b);
8257}
8258
8259static __inline__ vector unsigned short __ATTRS_o_ai
8260vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8261  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8262                                                      (vector int)__b);
8263}
8264
8265static __inline__ vector unsigned short __ATTRS_o_ai
8266vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8267  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8268                                                      (vector int)__b);
8269}
8270
8271static __inline__ vector bool short __ATTRS_o_ai
8272vec_vsl(vector bool short __a, vector unsigned char __b) {
8273  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8274                                                  (vector int)__b);
8275}
8276
8277static __inline__ vector bool short __ATTRS_o_ai
8278vec_vsl(vector bool short __a, vector unsigned short __b) {
8279  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8280                                                  (vector int)__b);
8281}
8282
8283static __inline__ vector bool short __ATTRS_o_ai
8284vec_vsl(vector bool short __a, vector unsigned int __b) {
8285  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8286                                                  (vector int)__b);
8287}
8288
8289static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8290                                                    vector unsigned char __b) {
8291  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8292}
8293
8294static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8295                                                    vector unsigned short __b) {
8296  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8297}
8298
8299static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8300                                                    vector unsigned int __b) {
8301  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8302}
8303
8304static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8305                                                  vector unsigned char __b) {
8306  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8307}
8308
8309static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8310                                                  vector unsigned short __b) {
8311  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8312}
8313
8314static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8315                                                  vector unsigned int __b) {
8316  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8317}
8318
8319static __inline__ vector unsigned int __ATTRS_o_ai
8320vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8321  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8322                                                    (vector int)__b);
8323}
8324
8325static __inline__ vector unsigned int __ATTRS_o_ai
8326vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8327  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8328                                                    (vector int)__b);
8329}
8330
8331static __inline__ vector unsigned int __ATTRS_o_ai
8332vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8333  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8334                                                    (vector int)__b);
8335}
8336
8337static __inline__ vector bool int __ATTRS_o_ai
8338vec_vsl(vector bool int __a, vector unsigned char __b) {
8339  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8340                                                (vector int)__b);
8341}
8342
8343static __inline__ vector bool int __ATTRS_o_ai
8344vec_vsl(vector bool int __a, vector unsigned short __b) {
8345  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8346                                                (vector int)__b);
8347}
8348
8349static __inline__ vector bool int __ATTRS_o_ai
8350vec_vsl(vector bool int __a, vector unsigned int __b) {
8351  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8352                                                (vector int)__b);
8353}
8354
8355/* vec_slo */
8356
8357static __inline__ vector signed char __ATTRS_o_ai
8358vec_slo(vector signed char __a, vector signed char __b) {
8359  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8360                                                    (vector int)__b);
8361}
8362
8363static __inline__ vector signed char __ATTRS_o_ai
8364vec_slo(vector signed char __a, vector unsigned char __b) {
8365  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8366                                                    (vector int)__b);
8367}
8368
8369static __inline__ vector unsigned char __ATTRS_o_ai
8370vec_slo(vector unsigned char __a, vector signed char __b) {
8371  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8372                                                      (vector int)__b);
8373}
8374
8375static __inline__ vector unsigned char __ATTRS_o_ai
8376vec_slo(vector unsigned char __a, vector unsigned char __b) {
8377  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8378                                                      (vector int)__b);
8379}
8380
8381static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
8382                                                    vector signed char __b) {
8383  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8384}
8385
8386static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
8387                                                    vector unsigned char __b) {
8388  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8389}
8390
8391static __inline__ vector unsigned short __ATTRS_o_ai
8392vec_slo(vector unsigned short __a, vector signed char __b) {
8393  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
8394                                                       (vector int)__b);
8395}
8396
8397static __inline__ vector unsigned short __ATTRS_o_ai
8398vec_slo(vector unsigned short __a, vector unsigned char __b) {
8399  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
8400                                                       (vector int)__b);
8401}
8402
8403static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
8404                                                    vector signed char __b) {
8405  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8406}
8407
8408static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
8409                                                    vector unsigned char __b) {
8410  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8411}
8412
8413static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
8414                                                  vector signed char __b) {
8415  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
8416}
8417
8418static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
8419                                                  vector unsigned char __b) {
8420  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
8421}
8422
8423static __inline__ vector unsigned int __ATTRS_o_ai
8424vec_slo(vector unsigned int __a, vector signed char __b) {
8425  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
8426                                                     (vector int)__b);
8427}
8428
8429static __inline__ vector unsigned int __ATTRS_o_ai
8430vec_slo(vector unsigned int __a, vector unsigned char __b) {
8431  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
8432                                                     (vector int)__b);
8433}
8434
8435static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
8436                                                    vector signed char __b) {
8437  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8438}
8439
8440static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
8441                                                    vector unsigned char __b) {
8442  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8443}
8444
8445#ifdef __VSX__
8446static __inline__ vector signed long long __ATTRS_o_ai
8447vec_slo(vector signed long long __a, vector signed char __b) {
8448  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
8449                                                         (vector int)__b);
8450}
8451
8452static __inline__ vector signed long long __ATTRS_o_ai
8453vec_slo(vector signed long long __a, vector unsigned char __b) {
8454  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
8455                                                         (vector int)__b);
8456}
8457
8458static __inline__ vector unsigned long long __ATTRS_o_ai
8459vec_slo(vector unsigned long long __a, vector signed char __b) {
8460  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
8461                                                           (vector int)__b);
8462}
8463
8464static __inline__ vector unsigned long long __ATTRS_o_ai
8465vec_slo(vector unsigned long long __a, vector unsigned char __b) {
8466  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
8467                                                           (vector int)__b);
8468}
8469#endif
8470
8471/* vec_vslo */
8472
8473static __inline__ vector signed char __ATTRS_o_ai
8474vec_vslo(vector signed char __a, vector signed char __b) {
8475  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8476                                                    (vector int)__b);
8477}
8478
8479static __inline__ vector signed char __ATTRS_o_ai
8480vec_vslo(vector signed char __a, vector unsigned char __b) {
8481  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8482                                                    (vector int)__b);
8483}
8484
8485static __inline__ vector unsigned char __ATTRS_o_ai
8486vec_vslo(vector unsigned char __a, vector signed char __b) {
8487  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8488                                                      (vector int)__b);
8489}
8490
8491static __inline__ vector unsigned char __ATTRS_o_ai
8492vec_vslo(vector unsigned char __a, vector unsigned char __b) {
8493  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8494                                                      (vector int)__b);
8495}
8496
8497static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
8498                                                     vector signed char __b) {
8499  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8500}
8501
8502static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
8503                                                     vector unsigned char __b) {
8504  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8505}
8506
8507static __inline__ vector unsigned short __ATTRS_o_ai
8508vec_vslo(vector unsigned short __a, vector signed char __b) {
8509  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
8510                                                       (vector int)__b);
8511}
8512
8513static __inline__ vector unsigned short __ATTRS_o_ai
8514vec_vslo(vector unsigned short __a, vector unsigned char __b) {
8515  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
8516                                                       (vector int)__b);
8517}
8518
8519static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
8520                                                     vector signed char __b) {
8521  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8522}
8523
8524static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
8525                                                     vector unsigned char __b) {
8526  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8527}
8528
8529static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
8530                                                   vector signed char __b) {
8531  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
8532}
8533
8534static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
8535                                                   vector unsigned char __b) {
8536  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
8537}
8538
8539static __inline__ vector unsigned int __ATTRS_o_ai
8540vec_vslo(vector unsigned int __a, vector signed char __b) {
8541  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
8542                                                     (vector int)__b);
8543}
8544
8545static __inline__ vector unsigned int __ATTRS_o_ai
8546vec_vslo(vector unsigned int __a, vector unsigned char __b) {
8547  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
8548                                                     (vector int)__b);
8549}
8550
8551static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
8552                                                     vector signed char __b) {
8553  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8554}
8555
8556static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
8557                                                     vector unsigned char __b) {
8558  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
8559}
8560
8561/* vec_splat */
8562
8563static __inline__ vector signed char __ATTRS_o_ai
8564vec_splat(vector signed char __a, unsigned const int __b) {
8565  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
8566}
8567
8568static __inline__ vector unsigned char __ATTRS_o_ai
8569vec_splat(vector unsigned char __a, unsigned const int __b) {
8570  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
8571}
8572
8573static __inline__ vector bool char __ATTRS_o_ai
8574vec_splat(vector bool char __a, unsigned const int __b) {
8575  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
8576}
8577
8578static __inline__ vector signed short __ATTRS_o_ai
8579vec_splat(vector signed short __a, unsigned const int __b) {
8580  unsigned char b0 = (__b & 0x07) * 2;
8581  unsigned char b1 = b0 + 1;
8582  return vec_perm(__a, __a,
8583                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
8584                                         b0, b1, b0, b1, b0, b1));
8585}
8586
8587static __inline__ vector unsigned short __ATTRS_o_ai
8588vec_splat(vector unsigned short __a, unsigned const int __b) {
8589  unsigned char b0 = (__b & 0x07) * 2;
8590  unsigned char b1 = b0 + 1;
8591  return vec_perm(__a, __a,
8592                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
8593                                         b0, b1, b0, b1, b0, b1));
8594}
8595
8596static __inline__ vector bool short __ATTRS_o_ai
8597vec_splat(vector bool short __a, unsigned const int __b) {
8598  unsigned char b0 = (__b & 0x07) * 2;
8599  unsigned char b1 = b0 + 1;
8600  return vec_perm(__a, __a,
8601                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
8602                                         b0, b1, b0, b1, b0, b1));
8603}
8604
8605static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
8606                                                      unsigned const int __b) {
8607  unsigned char b0 = (__b & 0x07) * 2;
8608  unsigned char b1 = b0 + 1;
8609  return vec_perm(__a, __a,
8610                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
8611                                         b0, b1, b0, b1, b0, b1));
8612}
8613
8614static __inline__ vector signed int __ATTRS_o_ai
8615vec_splat(vector signed int __a, unsigned const int __b) {
8616  unsigned char b0 = (__b & 0x03) * 4;
8617  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
8618  return vec_perm(__a, __a,
8619                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
8620                                         b2, b3, b0, b1, b2, b3));
8621}
8622
8623static __inline__ vector unsigned int __ATTRS_o_ai
8624vec_splat(vector unsigned int __a, unsigned const int __b) {
8625  unsigned char b0 = (__b & 0x03) * 4;
8626  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
8627  return vec_perm(__a, __a,
8628                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
8629                                         b2, b3, b0, b1, b2, b3));
8630}
8631
8632static __inline__ vector bool int __ATTRS_o_ai
8633vec_splat(vector bool int __a, unsigned const int __b) {
8634  unsigned char b0 = (__b & 0x03) * 4;
8635  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
8636  return vec_perm(__a, __a,
8637                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
8638                                         b2, b3, b0, b1, b2, b3));
8639}
8640
8641static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
8642                                                      unsigned const int __b) {
8643  unsigned char b0 = (__b & 0x03) * 4;
8644  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
8645  return vec_perm(__a, __a,
8646                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
8647                                         b2, b3, b0, b1, b2, b3));
8648}
8649
8650#ifdef __VSX__
8651static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
8652                                                       unsigned const int __b) {
8653  unsigned char b0 = (__b & 0x01) * 8;
8654  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
8655                b6 = b0 + 6, b7 = b0 + 7;
8656  return vec_perm(__a, __a,
8657                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
8658                                         b2, b3, b4, b5, b6, b7));
8659}
8660static __inline__ vector bool long long __ATTRS_o_ai
8661vec_splat(vector bool long long __a, unsigned const int __b) {
8662  unsigned char b0 = (__b & 0x01) * 8;
8663  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
8664                b6 = b0 + 6, b7 = b0 + 7;
8665  return vec_perm(__a, __a,
8666                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
8667                                         b2, b3, b4, b5, b6, b7));
8668}
8669static __inline__ vector signed long long __ATTRS_o_ai
8670vec_splat(vector signed long long __a, unsigned const int __b) {
8671  unsigned char b0 = (__b & 0x01) * 8;
8672  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
8673                b6 = b0 + 6, b7 = b0 + 7;
8674  return vec_perm(__a, __a,
8675                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
8676                                         b2, b3, b4, b5, b6, b7));
8677}
8678static __inline__ vector unsigned long long __ATTRS_o_ai
8679vec_splat(vector unsigned long long __a, unsigned const int __b) {
8680  unsigned char b0 = (__b & 0x01) * 8;
8681  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
8682                b6 = b0 + 6, b7 = b0 + 7;
8683  return vec_perm(__a, __a,
8684                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
8685                                         b2, b3, b4, b5, b6, b7));
8686}
8687#endif
8688
8689/* vec_vspltb */
8690
8691#define __builtin_altivec_vspltb vec_vspltb
8692
8693static __inline__ vector signed char __ATTRS_o_ai
8694vec_vspltb(vector signed char __a, unsigned char __b) {
8695  return vec_perm(__a, __a, (vector unsigned char)(__b));
8696}
8697
8698static __inline__ vector unsigned char __ATTRS_o_ai
8699vec_vspltb(vector unsigned char __a, unsigned char __b) {
8700  return vec_perm(__a, __a, (vector unsigned char)(__b));
8701}
8702
8703static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
8704                                                           unsigned char __b) {
8705  return vec_perm(__a, __a, (vector unsigned char)(__b));
8706}
8707
8708/* vec_vsplth */
8709
8710#define __builtin_altivec_vsplth vec_vsplth
8711
8712static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
8713                                                       unsigned char __b) {
8714  __b *= 2;
8715  unsigned char b1 = __b + 1;
8716  return vec_perm(__a, __a,
8717                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
8718                                         __b, b1, __b, b1, __b, b1, __b, b1));
8719}
8720
8721static __inline__ vector unsigned short __ATTRS_o_ai
8722vec_vsplth(vector unsigned short __a, unsigned char __b) {
8723  __b *= 2;
8724  unsigned char b1 = __b + 1;
8725  return vec_perm(__a, __a,
8726                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
8727                                         __b, b1, __b, b1, __b, b1, __b, b1));
8728}
8729
8730static __inline__ vector bool short __ATTRS_o_ai
8731vec_vsplth(vector bool short __a, unsigned char __b) {
8732  __b *= 2;
8733  unsigned char b1 = __b + 1;
8734  return vec_perm(__a, __a,
8735                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
8736                                         __b, b1, __b, b1, __b, b1, __b, b1));
8737}
8738
8739static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
8740                                                       unsigned char __b) {
8741  __b *= 2;
8742  unsigned char b1 = __b + 1;
8743  return vec_perm(__a, __a,
8744                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
8745                                         __b, b1, __b, b1, __b, b1, __b, b1));
8746}
8747
8748/* vec_vspltw */
8749
8750#define __builtin_altivec_vspltw vec_vspltw
8751
8752static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
8753                                                     unsigned char __b) {
8754  __b *= 4;
8755  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
8756  return vec_perm(__a, __a,
8757                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
8758                                         b1, b2, b3, __b, b1, b2, b3));
8759}
8760
8761static __inline__ vector unsigned int __ATTRS_o_ai
8762vec_vspltw(vector unsigned int __a, unsigned char __b) {
8763  __b *= 4;
8764  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
8765  return vec_perm(__a, __a,
8766                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
8767                                         b1, b2, b3, __b, b1, b2, b3));
8768}
8769
8770static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
8771                                                          unsigned char __b) {
8772  __b *= 4;
8773  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
8774  return vec_perm(__a, __a,
8775                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
8776                                         b1, b2, b3, __b, b1, b2, b3));
8777}
8778
8779static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
8780                                                       unsigned char __b) {
8781  __b *= 4;
8782  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
8783  return vec_perm(__a, __a,
8784                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
8785                                         b1, b2, b3, __b, b1, b2, b3));
8786}
8787
8788/* vec_splat_s8 */
8789
8790#define __builtin_altivec_vspltisb vec_splat_s8
8791
8792// FIXME: parameter should be treated as 5-bit signed literal
8793static __inline__ vector signed char __ATTRS_o_ai
8794vec_splat_s8(signed char __a) {
8795  return (vector signed char)(__a);
8796}
8797
8798/* vec_vspltisb */
8799
8800// FIXME: parameter should be treated as 5-bit signed literal
8801static __inline__ vector signed char __ATTRS_o_ai
8802vec_vspltisb(signed char __a) {
8803  return (vector signed char)(__a);
8804}
8805
8806/* vec_splat_s16 */
8807
8808#define __builtin_altivec_vspltish vec_splat_s16
8809
8810// FIXME: parameter should be treated as 5-bit signed literal
8811static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
8812  return (vector short)(__a);
8813}
8814
8815/* vec_vspltish */
8816
8817// FIXME: parameter should be treated as 5-bit signed literal
8818static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
8819  return (vector short)(__a);
8820}
8821
8822/* vec_splat_s32 */
8823
8824#define __builtin_altivec_vspltisw vec_splat_s32
8825
8826// FIXME: parameter should be treated as 5-bit signed literal
8827static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
8828  return (vector int)(__a);
8829}
8830
8831/* vec_vspltisw */
8832
8833// FIXME: parameter should be treated as 5-bit signed literal
8834static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
8835  return (vector int)(__a);
8836}
8837
8838/* vec_splat_u8 */
8839
8840// FIXME: parameter should be treated as 5-bit signed literal
8841static __inline__ vector unsigned char __ATTRS_o_ai
8842vec_splat_u8(unsigned char __a) {
8843  return (vector unsigned char)(__a);
8844}
8845
8846/* vec_splat_u16 */
8847
8848// FIXME: parameter should be treated as 5-bit signed literal
8849static __inline__ vector unsigned short __ATTRS_o_ai
8850vec_splat_u16(signed char __a) {
8851  return (vector unsigned short)(__a);
8852}
8853
8854/* vec_splat_u32 */
8855
8856// FIXME: parameter should be treated as 5-bit signed literal
8857static __inline__ vector unsigned int __ATTRS_o_ai
8858vec_splat_u32(signed char __a) {
8859  return (vector unsigned int)(__a);
8860}
8861
8862/* vec_sr */
8863
8864static __inline__ vector signed char __ATTRS_o_ai
8865vec_sr(vector signed char __a, vector unsigned char __b) {
8866  vector unsigned char __res = (vector unsigned char)__a >> __b;
8867  return (vector signed char)__res;
8868}
8869
8870static __inline__ vector unsigned char __ATTRS_o_ai
8871vec_sr(vector unsigned char __a, vector unsigned char __b) {
8872  return __a >> __b;
8873}
8874
8875static __inline__ vector signed short __ATTRS_o_ai
8876vec_sr(vector signed short __a, vector unsigned short __b) {
8877  vector unsigned short __res = (vector unsigned short)__a >> __b;
8878  return (vector signed short)__res;
8879}
8880
8881static __inline__ vector unsigned short __ATTRS_o_ai
8882vec_sr(vector unsigned short __a, vector unsigned short __b) {
8883  return __a >> __b;
8884}
8885
8886static __inline__ vector signed int __ATTRS_o_ai
8887vec_sr(vector signed int __a, vector unsigned int __b) {
8888  vector unsigned int __res = (vector unsigned int)__a >> __b;
8889  return (vector signed int)__res;
8890}
8891
8892static __inline__ vector unsigned int __ATTRS_o_ai
8893vec_sr(vector unsigned int __a, vector unsigned int __b) {
8894  return __a >> __b;
8895}
8896
8897#ifdef __POWER8_VECTOR__
8898static __inline__ vector signed long long __ATTRS_o_ai
8899vec_sr(vector signed long long __a, vector unsigned long long __b) {
8900  vector unsigned long long __res = (vector unsigned long long)__a >> __b;
8901  return (vector signed long long)__res;
8902}
8903
8904static __inline__ vector unsigned long long __ATTRS_o_ai
8905vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
8906  return __a >> __b;
8907}
8908#endif
8909
8910/* vec_vsrb */
8911
8912#define __builtin_altivec_vsrb vec_vsrb
8913
8914static __inline__ vector signed char __ATTRS_o_ai
8915vec_vsrb(vector signed char __a, vector unsigned char __b) {
8916  return __a >> (vector signed char)__b;
8917}
8918
8919static __inline__ vector unsigned char __ATTRS_o_ai
8920vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
8921  return __a >> __b;
8922}
8923
8924/* vec_vsrh */
8925
8926#define __builtin_altivec_vsrh vec_vsrh
8927
8928static __inline__ vector short __ATTRS_o_ai
8929vec_vsrh(vector short __a, vector unsigned short __b) {
8930  return __a >> (vector short)__b;
8931}
8932
8933static __inline__ vector unsigned short __ATTRS_o_ai
8934vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
8935  return __a >> __b;
8936}
8937
8938/* vec_vsrw */
8939
8940#define __builtin_altivec_vsrw vec_vsrw
8941
8942static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
8943                                                   vector unsigned int __b) {
8944  return __a >> (vector int)__b;
8945}
8946
8947static __inline__ vector unsigned int __ATTRS_o_ai
8948vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
8949  return __a >> __b;
8950}
8951
8952/* vec_sra */
8953
8954static __inline__ vector signed char __ATTRS_o_ai
8955vec_sra(vector signed char __a, vector unsigned char __b) {
8956  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8957}
8958
8959static __inline__ vector unsigned char __ATTRS_o_ai
8960vec_sra(vector unsigned char __a, vector unsigned char __b) {
8961  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8962}
8963
8964static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
8965                                                    vector unsigned short __b) {
8966  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8967}
8968
8969static __inline__ vector unsigned short __ATTRS_o_ai
8970vec_sra(vector unsigned short __a, vector unsigned short __b) {
8971  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8972}
8973
8974static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
8975                                                  vector unsigned int __b) {
8976  return __builtin_altivec_vsraw(__a, __b);
8977}
8978
8979static __inline__ vector unsigned int __ATTRS_o_ai
8980vec_sra(vector unsigned int __a, vector unsigned int __b) {
8981  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8982}
8983
8984#ifdef __POWER8_VECTOR__
8985static __inline__ vector signed long long __ATTRS_o_ai
8986vec_sra(vector signed long long __a, vector unsigned long long __b) {
8987  return __a >> __b;
8988}
8989
8990static __inline__ vector unsigned long long __ATTRS_o_ai
8991vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
8992  return (vector unsigned long long)((vector signed long long)__a >> __b);
8993}
8994#endif
8995
8996/* vec_vsrab */
8997
8998static __inline__ vector signed char __ATTRS_o_ai
8999vec_vsrab(vector signed char __a, vector unsigned char __b) {
9000  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9001}
9002
9003static __inline__ vector unsigned char __ATTRS_o_ai
9004vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9005  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9006}
9007
9008/* vec_vsrah */
9009
9010static __inline__ vector short __ATTRS_o_ai
9011vec_vsrah(vector short __a, vector unsigned short __b) {
9012  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9013}
9014
9015static __inline__ vector unsigned short __ATTRS_o_ai
9016vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9017  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9018}
9019
9020/* vec_vsraw */
9021
9022static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9023                                                    vector unsigned int __b) {
9024  return __builtin_altivec_vsraw(__a, __b);
9025}
9026
9027static __inline__ vector unsigned int __ATTRS_o_ai
9028vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9029  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9030}
9031
9032/* vec_srl */
9033
9034static __inline__ vector signed char __ATTRS_o_ai
9035vec_srl(vector signed char __a, vector unsigned char __b) {
9036  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9037                                                   (vector int)__b);
9038}
9039
9040static __inline__ vector signed char __ATTRS_o_ai
9041vec_srl(vector signed char __a, vector unsigned short __b) {
9042  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9043                                                   (vector int)__b);
9044}
9045
9046static __inline__ vector signed char __ATTRS_o_ai
9047vec_srl(vector signed char __a, vector unsigned int __b) {
9048  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9049                                                   (vector int)__b);
9050}
9051
9052static __inline__ vector unsigned char __ATTRS_o_ai
9053vec_srl(vector unsigned char __a, vector unsigned char __b) {
9054  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9055                                                     (vector int)__b);
9056}
9057
9058static __inline__ vector unsigned char __ATTRS_o_ai
9059vec_srl(vector unsigned char __a, vector unsigned short __b) {
9060  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9061                                                     (vector int)__b);
9062}
9063
9064static __inline__ vector unsigned char __ATTRS_o_ai
9065vec_srl(vector unsigned char __a, vector unsigned int __b) {
9066  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9067                                                     (vector int)__b);
9068}
9069
9070static __inline__ vector bool char __ATTRS_o_ai
9071vec_srl(vector bool char __a, vector unsigned char __b) {
9072  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9073                                                 (vector int)__b);
9074}
9075
9076static __inline__ vector bool char __ATTRS_o_ai
9077vec_srl(vector bool char __a, vector unsigned short __b) {
9078  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9079                                                 (vector int)__b);
9080}
9081
9082static __inline__ vector bool char __ATTRS_o_ai
9083vec_srl(vector bool char __a, vector unsigned int __b) {
9084  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9085                                                 (vector int)__b);
9086}
9087
9088static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9089                                                    vector unsigned char __b) {
9090  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9091}
9092
9093static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9094                                                    vector unsigned short __b) {
9095  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9096}
9097
9098static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9099                                                    vector unsigned int __b) {
9100  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9101}
9102
9103static __inline__ vector unsigned short __ATTRS_o_ai
9104vec_srl(vector unsigned short __a, vector unsigned char __b) {
9105  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9106                                                      (vector int)__b);
9107}
9108
9109static __inline__ vector unsigned short __ATTRS_o_ai
9110vec_srl(vector unsigned short __a, vector unsigned short __b) {
9111  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9112                                                      (vector int)__b);
9113}
9114
9115static __inline__ vector unsigned short __ATTRS_o_ai
9116vec_srl(vector unsigned short __a, vector unsigned int __b) {
9117  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9118                                                      (vector int)__b);
9119}
9120
9121static __inline__ vector bool short __ATTRS_o_ai
9122vec_srl(vector bool short __a, vector unsigned char __b) {
9123  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9124                                                  (vector int)__b);
9125}
9126
9127static __inline__ vector bool short __ATTRS_o_ai
9128vec_srl(vector bool short __a, vector unsigned short __b) {
9129  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9130                                                  (vector int)__b);
9131}
9132
9133static __inline__ vector bool short __ATTRS_o_ai
9134vec_srl(vector bool short __a, vector unsigned int __b) {
9135  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9136                                                  (vector int)__b);
9137}
9138
9139static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9140                                                    vector unsigned char __b) {
9141  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9142}
9143
9144static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9145                                                    vector unsigned short __b) {
9146  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9147}
9148
9149static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9150                                                    vector unsigned int __b) {
9151  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9152}
9153
9154static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9155                                                  vector unsigned char __b) {
9156  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9157}
9158
9159static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9160                                                  vector unsigned short __b) {
9161  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9162}
9163
9164static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9165                                                  vector unsigned int __b) {
9166  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9167}
9168
9169static __inline__ vector unsigned int __ATTRS_o_ai
9170vec_srl(vector unsigned int __a, vector unsigned char __b) {
9171  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9172                                                    (vector int)__b);
9173}
9174
9175static __inline__ vector unsigned int __ATTRS_o_ai
9176vec_srl(vector unsigned int __a, vector unsigned short __b) {
9177  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9178                                                    (vector int)__b);
9179}
9180
9181static __inline__ vector unsigned int __ATTRS_o_ai
9182vec_srl(vector unsigned int __a, vector unsigned int __b) {
9183  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9184                                                    (vector int)__b);
9185}
9186
9187static __inline__ vector bool int __ATTRS_o_ai
9188vec_srl(vector bool int __a, vector unsigned char __b) {
9189  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9190                                                (vector int)__b);
9191}
9192
9193static __inline__ vector bool int __ATTRS_o_ai
9194vec_srl(vector bool int __a, vector unsigned short __b) {
9195  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9196                                                (vector int)__b);
9197}
9198
9199static __inline__ vector bool int __ATTRS_o_ai
9200vec_srl(vector bool int __a, vector unsigned int __b) {
9201  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9202                                                (vector int)__b);
9203}
9204
9205#ifdef __VSX__
9206static __inline__ vector signed long long __ATTRS_o_ai
9207vec_srl(vector signed long long __a, vector unsigned char __b) {
9208  return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9209                                                        (vector int)__b);
9210}
9211
9212static __inline__ vector unsigned long long __ATTRS_o_ai
9213vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9214  return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9215                                                          (vector int)__b);
9216}
9217#endif
9218
9219/* vec_vsr */
9220
9221static __inline__ vector signed char __ATTRS_o_ai
9222vec_vsr(vector signed char __a, vector unsigned char __b) {
9223  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9224                                                   (vector int)__b);
9225}
9226
9227static __inline__ vector signed char __ATTRS_o_ai
9228vec_vsr(vector signed char __a, vector unsigned short __b) {
9229  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9230                                                   (vector int)__b);
9231}
9232
9233static __inline__ vector signed char __ATTRS_o_ai
9234vec_vsr(vector signed char __a, vector unsigned int __b) {
9235  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9236                                                   (vector int)__b);
9237}
9238
9239static __inline__ vector unsigned char __ATTRS_o_ai
9240vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9241  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9242                                                     (vector int)__b);
9243}
9244
9245static __inline__ vector unsigned char __ATTRS_o_ai
9246vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9247  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9248                                                     (vector int)__b);
9249}
9250
9251static __inline__ vector unsigned char __ATTRS_o_ai
9252vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9253  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9254                                                     (vector int)__b);
9255}
9256
9257static __inline__ vector bool char __ATTRS_o_ai
9258vec_vsr(vector bool char __a, vector unsigned char __b) {
9259  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9260                                                 (vector int)__b);
9261}
9262
9263static __inline__ vector bool char __ATTRS_o_ai
9264vec_vsr(vector bool char __a, vector unsigned short __b) {
9265  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9266                                                 (vector int)__b);
9267}
9268
9269static __inline__ vector bool char __ATTRS_o_ai
9270vec_vsr(vector bool char __a, vector unsigned int __b) {
9271  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9272                                                 (vector int)__b);
9273}
9274
9275static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9276                                                    vector unsigned char __b) {
9277  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9278}
9279
9280static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9281                                                    vector unsigned short __b) {
9282  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9283}
9284
9285static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9286                                                    vector unsigned int __b) {
9287  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9288}
9289
9290static __inline__ vector unsigned short __ATTRS_o_ai
9291vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9292  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9293                                                      (vector int)__b);
9294}
9295
9296static __inline__ vector unsigned short __ATTRS_o_ai
9297vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9298  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9299                                                      (vector int)__b);
9300}
9301
9302static __inline__ vector unsigned short __ATTRS_o_ai
9303vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9304  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9305                                                      (vector int)__b);
9306}
9307
9308static __inline__ vector bool short __ATTRS_o_ai
9309vec_vsr(vector bool short __a, vector unsigned char __b) {
9310  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9311                                                  (vector int)__b);
9312}
9313
9314static __inline__ vector bool short __ATTRS_o_ai
9315vec_vsr(vector bool short __a, vector unsigned short __b) {
9316  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9317                                                  (vector int)__b);
9318}
9319
9320static __inline__ vector bool short __ATTRS_o_ai
9321vec_vsr(vector bool short __a, vector unsigned int __b) {
9322  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9323                                                  (vector int)__b);
9324}
9325
9326static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9327                                                    vector unsigned char __b) {
9328  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9329}
9330
9331static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9332                                                    vector unsigned short __b) {
9333  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9334}
9335
9336static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9337                                                    vector unsigned int __b) {
9338  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9339}
9340
9341static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9342                                                  vector unsigned char __b) {
9343  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9344}
9345
9346static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9347                                                  vector unsigned short __b) {
9348  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9349}
9350
9351static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9352                                                  vector unsigned int __b) {
9353  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9354}
9355
9356static __inline__ vector unsigned int __ATTRS_o_ai
9357vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9358  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9359                                                    (vector int)__b);
9360}
9361
9362static __inline__ vector unsigned int __ATTRS_o_ai
9363vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9364  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9365                                                    (vector int)__b);
9366}
9367
9368static __inline__ vector unsigned int __ATTRS_o_ai
9369vec_vsr(vector unsigned int __a, vector unsigned int __b) {
9370  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9371                                                    (vector int)__b);
9372}
9373
9374static __inline__ vector bool int __ATTRS_o_ai
9375vec_vsr(vector bool int __a, vector unsigned char __b) {
9376  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9377                                                (vector int)__b);
9378}
9379
9380static __inline__ vector bool int __ATTRS_o_ai
9381vec_vsr(vector bool int __a, vector unsigned short __b) {
9382  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9383                                                (vector int)__b);
9384}
9385
9386static __inline__ vector bool int __ATTRS_o_ai
9387vec_vsr(vector bool int __a, vector unsigned int __b) {
9388  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9389                                                (vector int)__b);
9390}
9391
9392/* vec_sro */
9393
9394static __inline__ vector signed char __ATTRS_o_ai
9395vec_sro(vector signed char __a, vector signed char __b) {
9396  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
9397                                                    (vector int)__b);
9398}
9399
9400static __inline__ vector signed char __ATTRS_o_ai
9401vec_sro(vector signed char __a, vector unsigned char __b) {
9402  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
9403                                                    (vector int)__b);
9404}
9405
9406static __inline__ vector unsigned char __ATTRS_o_ai
9407vec_sro(vector unsigned char __a, vector signed char __b) {
9408  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
9409                                                      (vector int)__b);
9410}
9411
9412static __inline__ vector unsigned char __ATTRS_o_ai
9413vec_sro(vector unsigned char __a, vector unsigned char __b) {
9414  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
9415                                                      (vector int)__b);
9416}
9417
9418static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
9419                                                    vector signed char __b) {
9420  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9421}
9422
9423static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
9424                                                    vector unsigned char __b) {
9425  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9426}
9427
9428static __inline__ vector unsigned short __ATTRS_o_ai
9429vec_sro(vector unsigned short __a, vector signed char __b) {
9430  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
9431                                                       (vector int)__b);
9432}
9433
9434static __inline__ vector unsigned short __ATTRS_o_ai
9435vec_sro(vector unsigned short __a, vector unsigned char __b) {
9436  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
9437                                                       (vector int)__b);
9438}
9439
9440static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
9441                                                    vector signed char __b) {
9442  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9443}
9444
9445static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
9446                                                    vector unsigned char __b) {
9447  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9448}
9449
9450static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
9451                                                  vector signed char __b) {
9452  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
9453}
9454
9455static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
9456                                                  vector unsigned char __b) {
9457  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
9458}
9459
9460static __inline__ vector unsigned int __ATTRS_o_ai
9461vec_sro(vector unsigned int __a, vector signed char __b) {
9462  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
9463                                                     (vector int)__b);
9464}
9465
9466static __inline__ vector unsigned int __ATTRS_o_ai
9467vec_sro(vector unsigned int __a, vector unsigned char __b) {
9468  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
9469                                                     (vector int)__b);
9470}
9471
9472static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
9473                                                    vector signed char __b) {
9474  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9475}
9476
9477static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
9478                                                    vector unsigned char __b) {
9479  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9480}
9481
9482#ifdef __VSX__
9483static __inline__ vector signed long long __ATTRS_o_ai
9484vec_sro(vector signed long long __a, vector signed char __b) {
9485  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
9486                                                         (vector int)__b);
9487}
9488
9489static __inline__ vector signed long long __ATTRS_o_ai
9490vec_sro(vector signed long long __a, vector unsigned char __b) {
9491  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
9492                                                         (vector int)__b);
9493}
9494
9495static __inline__ vector unsigned long long __ATTRS_o_ai
9496vec_sro(vector unsigned long long __a, vector signed char __b) {
9497  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
9498                                                           (vector int)__b);
9499}
9500
9501static __inline__ vector unsigned long long __ATTRS_o_ai
9502vec_sro(vector unsigned long long __a, vector unsigned char __b) {
9503  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
9504                                                           (vector int)__b);
9505}
9506#endif
9507
9508/* vec_vsro */
9509
9510static __inline__ vector signed char __ATTRS_o_ai
9511vec_vsro(vector signed char __a, vector signed char __b) {
9512  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
9513                                                    (vector int)__b);
9514}
9515
9516static __inline__ vector signed char __ATTRS_o_ai
9517vec_vsro(vector signed char __a, vector unsigned char __b) {
9518  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
9519                                                    (vector int)__b);
9520}
9521
9522static __inline__ vector unsigned char __ATTRS_o_ai
9523vec_vsro(vector unsigned char __a, vector signed char __b) {
9524  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
9525                                                      (vector int)__b);
9526}
9527
9528static __inline__ vector unsigned char __ATTRS_o_ai
9529vec_vsro(vector unsigned char __a, vector unsigned char __b) {
9530  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
9531                                                      (vector int)__b);
9532}
9533
9534static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
9535                                                     vector signed char __b) {
9536  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9537}
9538
9539static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
9540                                                     vector unsigned char __b) {
9541  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9542}
9543
9544static __inline__ vector unsigned short __ATTRS_o_ai
9545vec_vsro(vector unsigned short __a, vector signed char __b) {
9546  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
9547                                                       (vector int)__b);
9548}
9549
9550static __inline__ vector unsigned short __ATTRS_o_ai
9551vec_vsro(vector unsigned short __a, vector unsigned char __b) {
9552  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
9553                                                       (vector int)__b);
9554}
9555
9556static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
9557                                                     vector signed char __b) {
9558  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9559}
9560
9561static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
9562                                                     vector unsigned char __b) {
9563  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9564}
9565
9566static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
9567                                                   vector signed char __b) {
9568  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
9569}
9570
9571static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
9572                                                   vector unsigned char __b) {
9573  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
9574}
9575
9576static __inline__ vector unsigned int __ATTRS_o_ai
9577vec_vsro(vector unsigned int __a, vector signed char __b) {
9578  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
9579                                                     (vector int)__b);
9580}
9581
9582static __inline__ vector unsigned int __ATTRS_o_ai
9583vec_vsro(vector unsigned int __a, vector unsigned char __b) {
9584  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
9585                                                     (vector int)__b);
9586}
9587
9588static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
9589                                                     vector signed char __b) {
9590  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9591}
9592
9593static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
9594                                                     vector unsigned char __b) {
9595  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
9596}
9597
9598/* vec_st */
9599
9600static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
9601                                           vector signed char *__c) {
9602  __builtin_altivec_stvx((vector int)__a, __b, __c);
9603}
9604
9605static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
9606                                           signed char *__c) {
9607  __builtin_altivec_stvx((vector int)__a, __b, __c);
9608}
9609
9610static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
9611                                           vector unsigned char *__c) {
9612  __builtin_altivec_stvx((vector int)__a, __b, __c);
9613}
9614
9615static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
9616                                           unsigned char *__c) {
9617  __builtin_altivec_stvx((vector int)__a, __b, __c);
9618}
9619
9620static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
9621                                           signed char *__c) {
9622  __builtin_altivec_stvx((vector int)__a, __b, __c);
9623}
9624
9625static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
9626                                           unsigned char *__c) {
9627  __builtin_altivec_stvx((vector int)__a, __b, __c);
9628}
9629
9630static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
9631                                           vector bool char *__c) {
9632  __builtin_altivec_stvx((vector int)__a, __b, __c);
9633}
9634
9635static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
9636                                           vector short *__c) {
9637  __builtin_altivec_stvx((vector int)__a, __b, __c);
9638}
9639
9640static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
9641                                           short *__c) {
9642  __builtin_altivec_stvx((vector int)__a, __b, __c);
9643}
9644
9645static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
9646                                           vector unsigned short *__c) {
9647  __builtin_altivec_stvx((vector int)__a, __b, __c);
9648}
9649
9650static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
9651                                           unsigned short *__c) {
9652  __builtin_altivec_stvx((vector int)__a, __b, __c);
9653}
9654
9655static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
9656                                           short *__c) {
9657  __builtin_altivec_stvx((vector int)__a, __b, __c);
9658}
9659
9660static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
9661                                           unsigned short *__c) {
9662  __builtin_altivec_stvx((vector int)__a, __b, __c);
9663}
9664
9665static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
9666                                           vector bool short *__c) {
9667  __builtin_altivec_stvx((vector int)__a, __b, __c);
9668}
9669
9670static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
9671                                           short *__c) {
9672  __builtin_altivec_stvx((vector int)__a, __b, __c);
9673}
9674
9675static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
9676                                           unsigned short *__c) {
9677  __builtin_altivec_stvx((vector int)__a, __b, __c);
9678}
9679
9680static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
9681                                           vector pixel *__c) {
9682  __builtin_altivec_stvx((vector int)__a, __b, __c);
9683}
9684
9685static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
9686                                           vector int *__c) {
9687  __builtin_altivec_stvx(__a, __b, __c);
9688}
9689
9690static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
9691  __builtin_altivec_stvx(__a, __b, __c);
9692}
9693
9694static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
9695                                           vector unsigned int *__c) {
9696  __builtin_altivec_stvx((vector int)__a, __b, __c);
9697}
9698
9699static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
9700                                           unsigned int *__c) {
9701  __builtin_altivec_stvx((vector int)__a, __b, __c);
9702}
9703
9704static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
9705                                           int *__c) {
9706  __builtin_altivec_stvx((vector int)__a, __b, __c);
9707}
9708
9709static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
9710                                           unsigned int *__c) {
9711  __builtin_altivec_stvx((vector int)__a, __b, __c);
9712}
9713
9714static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
9715                                           vector bool int *__c) {
9716  __builtin_altivec_stvx((vector int)__a, __b, __c);
9717}
9718
9719static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
9720                                           vector float *__c) {
9721  __builtin_altivec_stvx((vector int)__a, __b, __c);
9722}
9723
9724static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
9725                                           float *__c) {
9726  __builtin_altivec_stvx((vector int)__a, __b, __c);
9727}
9728
9729/* vec_stvx */
9730
9731static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
9732                                             vector signed char *__c) {
9733  __builtin_altivec_stvx((vector int)__a, __b, __c);
9734}
9735
9736static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
9737                                             signed char *__c) {
9738  __builtin_altivec_stvx((vector int)__a, __b, __c);
9739}
9740
9741static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
9742                                             vector unsigned char *__c) {
9743  __builtin_altivec_stvx((vector int)__a, __b, __c);
9744}
9745
9746static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
9747                                             unsigned char *__c) {
9748  __builtin_altivec_stvx((vector int)__a, __b, __c);
9749}
9750
9751static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
9752                                             signed char *__c) {
9753  __builtin_altivec_stvx((vector int)__a, __b, __c);
9754}
9755
9756static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
9757                                             unsigned char *__c) {
9758  __builtin_altivec_stvx((vector int)__a, __b, __c);
9759}
9760
9761static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
9762                                             vector bool char *__c) {
9763  __builtin_altivec_stvx((vector int)__a, __b, __c);
9764}
9765
9766static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
9767                                             vector short *__c) {
9768  __builtin_altivec_stvx((vector int)__a, __b, __c);
9769}
9770
9771static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
9772                                             short *__c) {
9773  __builtin_altivec_stvx((vector int)__a, __b, __c);
9774}
9775
9776static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
9777                                             vector unsigned short *__c) {
9778  __builtin_altivec_stvx((vector int)__a, __b, __c);
9779}
9780
9781static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
9782                                             unsigned short *__c) {
9783  __builtin_altivec_stvx((vector int)__a, __b, __c);
9784}
9785
9786static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
9787                                             short *__c) {
9788  __builtin_altivec_stvx((vector int)__a, __b, __c);
9789}
9790
9791static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
9792                                             unsigned short *__c) {
9793  __builtin_altivec_stvx((vector int)__a, __b, __c);
9794}
9795
9796static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
9797                                             vector bool short *__c) {
9798  __builtin_altivec_stvx((vector int)__a, __b, __c);
9799}
9800
9801static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
9802                                             short *__c) {
9803  __builtin_altivec_stvx((vector int)__a, __b, __c);
9804}
9805
9806static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
9807                                             unsigned short *__c) {
9808  __builtin_altivec_stvx((vector int)__a, __b, __c);
9809}
9810
9811static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
9812                                             vector pixel *__c) {
9813  __builtin_altivec_stvx((vector int)__a, __b, __c);
9814}
9815
9816static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
9817                                             vector int *__c) {
9818  __builtin_altivec_stvx(__a, __b, __c);
9819}
9820
9821static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
9822                                             int *__c) {
9823  __builtin_altivec_stvx(__a, __b, __c);
9824}
9825
9826static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
9827                                             vector unsigned int *__c) {
9828  __builtin_altivec_stvx((vector int)__a, __b, __c);
9829}
9830
9831static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
9832                                             unsigned int *__c) {
9833  __builtin_altivec_stvx((vector int)__a, __b, __c);
9834}
9835
9836static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
9837                                             int *__c) {
9838  __builtin_altivec_stvx((vector int)__a, __b, __c);
9839}
9840
9841static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
9842                                             unsigned int *__c) {
9843  __builtin_altivec_stvx((vector int)__a, __b, __c);
9844}
9845
9846static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
9847                                             vector bool int *__c) {
9848  __builtin_altivec_stvx((vector int)__a, __b, __c);
9849}
9850
9851static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
9852                                             vector float *__c) {
9853  __builtin_altivec_stvx((vector int)__a, __b, __c);
9854}
9855
9856static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
9857                                             float *__c) {
9858  __builtin_altivec_stvx((vector int)__a, __b, __c);
9859}
9860
9861/* vec_ste */
9862
9863static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
9864                                            signed char *__c) {
9865  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9866}
9867
9868static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
9869                                            unsigned char *__c) {
9870  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9871}
9872
9873static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
9874                                            signed char *__c) {
9875  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9876}
9877
9878static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
9879                                            unsigned char *__c) {
9880  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9881}
9882
9883static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
9884                                            short *__c) {
9885  __builtin_altivec_stvehx(__a, __b, __c);
9886}
9887
9888static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
9889                                            unsigned short *__c) {
9890  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9891}
9892
9893static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
9894                                            short *__c) {
9895  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9896}
9897
9898static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
9899                                            unsigned short *__c) {
9900  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9901}
9902
9903static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
9904                                            short *__c) {
9905  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9906}
9907
9908static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
9909                                            unsigned short *__c) {
9910  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9911}
9912
9913static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
9914  __builtin_altivec_stvewx(__a, __b, __c);
9915}
9916
9917static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
9918                                            unsigned int *__c) {
9919  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9920}
9921
9922static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
9923                                            int *__c) {
9924  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9925}
9926
9927static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
9928                                            unsigned int *__c) {
9929  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9930}
9931
9932static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
9933                                            float *__c) {
9934  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9935}
9936
9937/* vec_stvebx */
9938
9939static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
9940                                               signed char *__c) {
9941  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9942}
9943
9944static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
9945                                               int __b, unsigned char *__c) {
9946  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9947}
9948
9949static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9950                                               signed char *__c) {
9951  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9952}
9953
9954static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9955                                               unsigned char *__c) {
9956  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9957}
9958
9959/* vec_stvehx */
9960
9961static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
9962                                               short *__c) {
9963  __builtin_altivec_stvehx(__a, __b, __c);
9964}
9965
9966static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
9967                                               int __b, unsigned short *__c) {
9968  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9969}
9970
9971static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9972                                               short *__c) {
9973  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9974}
9975
9976static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9977                                               unsigned short *__c) {
9978  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9979}
9980
9981static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9982                                               short *__c) {
9983  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9984}
9985
9986static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9987                                               unsigned short *__c) {
9988  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9989}
9990
9991/* vec_stvewx */
9992
9993static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
9994                                               int *__c) {
9995  __builtin_altivec_stvewx(__a, __b, __c);
9996}
9997
9998static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
9999                                               unsigned int *__c) {
10000  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10001}
10002
10003static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10004                                               int *__c) {
10005  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10006}
10007
10008static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10009                                               unsigned int *__c) {
10010  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10011}
10012
10013static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10014                                               float *__c) {
10015  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10016}
10017
10018/* vec_stl */
10019
10020static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10021                                            vector signed char *__c) {
10022  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10023}
10024
10025static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10026                                            signed char *__c) {
10027  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10028}
10029
10030static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10031                                            vector unsigned char *__c) {
10032  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10033}
10034
10035static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10036                                            unsigned char *__c) {
10037  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10038}
10039
10040static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10041                                            signed char *__c) {
10042  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10043}
10044
10045static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10046                                            unsigned char *__c) {
10047  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10048}
10049
10050static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10051                                            vector bool char *__c) {
10052  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10053}
10054
10055static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10056                                            vector short *__c) {
10057  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10058}
10059
10060static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10061                                            short *__c) {
10062  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10063}
10064
10065static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10066                                            vector unsigned short *__c) {
10067  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10068}
10069
10070static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10071                                            unsigned short *__c) {
10072  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10073}
10074
10075static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10076                                            short *__c) {
10077  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10078}
10079
10080static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10081                                            unsigned short *__c) {
10082  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10083}
10084
10085static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10086                                            vector bool short *__c) {
10087  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10088}
10089
10090static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10091                                            short *__c) {
10092  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10093}
10094
10095static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10096                                            unsigned short *__c) {
10097  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10098}
10099
10100static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10101                                            vector pixel *__c) {
10102  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10103}
10104
10105static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10106                                            vector int *__c) {
10107  __builtin_altivec_stvxl(__a, __b, __c);
10108}
10109
10110static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10111  __builtin_altivec_stvxl(__a, __b, __c);
10112}
10113
10114static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10115                                            vector unsigned int *__c) {
10116  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10117}
10118
10119static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10120                                            unsigned int *__c) {
10121  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10122}
10123
10124static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10125                                            int *__c) {
10126  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10127}
10128
10129static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10130                                            unsigned int *__c) {
10131  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10132}
10133
10134static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10135                                            vector bool int *__c) {
10136  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10137}
10138
10139static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10140                                            vector float *__c) {
10141  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10142}
10143
10144static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10145                                            float *__c) {
10146  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10147}
10148
10149/* vec_stvxl */
10150
10151static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10152                                              vector signed char *__c) {
10153  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10154}
10155
10156static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10157                                              signed char *__c) {
10158  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10159}
10160
10161static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10162                                              vector unsigned char *__c) {
10163  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10164}
10165
10166static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10167                                              unsigned char *__c) {
10168  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10169}
10170
10171static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10172                                              signed char *__c) {
10173  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10174}
10175
10176static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10177                                              unsigned char *__c) {
10178  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10179}
10180
10181static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10182                                              vector bool char *__c) {
10183  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10184}
10185
10186static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10187                                              vector short *__c) {
10188  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10189}
10190
10191static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10192                                              short *__c) {
10193  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10194}
10195
10196static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10197                                              int __b,
10198                                              vector unsigned short *__c) {
10199  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10200}
10201
10202static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10203                                              int __b, unsigned short *__c) {
10204  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10205}
10206
10207static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10208                                              short *__c) {
10209  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10210}
10211
10212static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10213                                              unsigned short *__c) {
10214  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10215}
10216
10217static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10218                                              vector bool short *__c) {
10219  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10220}
10221
10222static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10223                                              short *__c) {
10224  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10225}
10226
10227static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10228                                              unsigned short *__c) {
10229  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10230}
10231
10232static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10233                                              vector pixel *__c) {
10234  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10235}
10236
10237static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10238                                              vector int *__c) {
10239  __builtin_altivec_stvxl(__a, __b, __c);
10240}
10241
10242static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10243                                              int *__c) {
10244  __builtin_altivec_stvxl(__a, __b, __c);
10245}
10246
10247static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10248                                              vector unsigned int *__c) {
10249  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10250}
10251
10252static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10253                                              unsigned int *__c) {
10254  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10255}
10256
10257static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10258                                              int *__c) {
10259  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10260}
10261
10262static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10263                                              unsigned int *__c) {
10264  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10265}
10266
10267static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10268                                              vector bool int *__c) {
10269  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10270}
10271
10272static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10273                                              vector float *__c) {
10274  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10275}
10276
10277static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10278                                              float *__c) {
10279  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10280}
10281
10282/* vec_sub */
10283
10284static __inline__ vector signed char __ATTRS_o_ai
10285vec_sub(vector signed char __a, vector signed char __b) {
10286  return __a - __b;
10287}
10288
10289static __inline__ vector signed char __ATTRS_o_ai
10290vec_sub(vector bool char __a, vector signed char __b) {
10291  return (vector signed char)__a - __b;
10292}
10293
10294static __inline__ vector signed char __ATTRS_o_ai
10295vec_sub(vector signed char __a, vector bool char __b) {
10296  return __a - (vector signed char)__b;
10297}
10298
10299static __inline__ vector unsigned char __ATTRS_o_ai
10300vec_sub(vector unsigned char __a, vector unsigned char __b) {
10301  return __a - __b;
10302}
10303
10304static __inline__ vector unsigned char __ATTRS_o_ai
10305vec_sub(vector bool char __a, vector unsigned char __b) {
10306  return (vector unsigned char)__a - __b;
10307}
10308
10309static __inline__ vector unsigned char __ATTRS_o_ai
10310vec_sub(vector unsigned char __a, vector bool char __b) {
10311  return __a - (vector unsigned char)__b;
10312}
10313
10314static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10315                                                    vector short __b) {
10316  return __a - __b;
10317}
10318
10319static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10320                                                    vector short __b) {
10321  return (vector short)__a - __b;
10322}
10323
10324static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10325                                                    vector bool short __b) {
10326  return __a - (vector short)__b;
10327}
10328
10329static __inline__ vector unsigned short __ATTRS_o_ai
10330vec_sub(vector unsigned short __a, vector unsigned short __b) {
10331  return __a - __b;
10332}
10333
10334static __inline__ vector unsigned short __ATTRS_o_ai
10335vec_sub(vector bool short __a, vector unsigned short __b) {
10336  return (vector unsigned short)__a - __b;
10337}
10338
10339static __inline__ vector unsigned short __ATTRS_o_ai
10340vec_sub(vector unsigned short __a, vector bool short __b) {
10341  return __a - (vector unsigned short)__b;
10342}
10343
10344static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10345                                                  vector int __b) {
10346  return __a - __b;
10347}
10348
10349static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10350                                                  vector int __b) {
10351  return (vector int)__a - __b;
10352}
10353
10354static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10355                                                  vector bool int __b) {
10356  return __a - (vector int)__b;
10357}
10358
10359static __inline__ vector unsigned int __ATTRS_o_ai
10360vec_sub(vector unsigned int __a, vector unsigned int __b) {
10361  return __a - __b;
10362}
10363
10364static __inline__ vector unsigned int __ATTRS_o_ai
10365vec_sub(vector bool int __a, vector unsigned int __b) {
10366  return (vector unsigned int)__a - __b;
10367}
10368
10369static __inline__ vector unsigned int __ATTRS_o_ai
10370vec_sub(vector unsigned int __a, vector bool int __b) {
10371  return __a - (vector unsigned int)__b;
10372}
10373
10374#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10375static __inline__ vector signed __int128 __ATTRS_o_ai
10376vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
10377  return __a - __b;
10378}
10379
10380static __inline__ vector unsigned __int128 __ATTRS_o_ai
10381vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
10382  return __a - __b;
10383}
10384#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10385
10386#ifdef __VSX__
10387static __inline__ vector signed long long __ATTRS_o_ai
10388vec_sub(vector signed long long __a, vector signed long long __b) {
10389  return __a - __b;
10390}
10391
10392static __inline__ vector unsigned long long __ATTRS_o_ai
10393vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
10394  return __a - __b;
10395}
10396
10397static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
10398                                                     vector double __b) {
10399  return __a - __b;
10400}
10401#endif
10402
10403static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
10404                                                    vector float __b) {
10405  return __a - __b;
10406}
10407
10408/* vec_vsububm */
10409
10410#define __builtin_altivec_vsububm vec_vsububm
10411
10412static __inline__ vector signed char __ATTRS_o_ai
10413vec_vsububm(vector signed char __a, vector signed char __b) {
10414  return __a - __b;
10415}
10416
10417static __inline__ vector signed char __ATTRS_o_ai
10418vec_vsububm(vector bool char __a, vector signed char __b) {
10419  return (vector signed char)__a - __b;
10420}
10421
10422static __inline__ vector signed char __ATTRS_o_ai
10423vec_vsububm(vector signed char __a, vector bool char __b) {
10424  return __a - (vector signed char)__b;
10425}
10426
10427static __inline__ vector unsigned char __ATTRS_o_ai
10428vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
10429  return __a - __b;
10430}
10431
10432static __inline__ vector unsigned char __ATTRS_o_ai
10433vec_vsububm(vector bool char __a, vector unsigned char __b) {
10434  return (vector unsigned char)__a - __b;
10435}
10436
10437static __inline__ vector unsigned char __ATTRS_o_ai
10438vec_vsububm(vector unsigned char __a, vector bool char __b) {
10439  return __a - (vector unsigned char)__b;
10440}
10441
10442/* vec_vsubuhm */
10443
10444#define __builtin_altivec_vsubuhm vec_vsubuhm
10445
10446static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
10447                                                        vector short __b) {
10448  return __a - __b;
10449}
10450
10451static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
10452                                                        vector short __b) {
10453  return (vector short)__a - __b;
10454}
10455
10456static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
10457                                                        vector bool short __b) {
10458  return __a - (vector short)__b;
10459}
10460
10461static __inline__ vector unsigned short __ATTRS_o_ai
10462vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
10463  return __a - __b;
10464}
10465
10466static __inline__ vector unsigned short __ATTRS_o_ai
10467vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
10468  return (vector unsigned short)__a - __b;
10469}
10470
10471static __inline__ vector unsigned short __ATTRS_o_ai
10472vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
10473  return __a - (vector unsigned short)__b;
10474}
10475
10476/* vec_vsubuwm */
10477
10478#define __builtin_altivec_vsubuwm vec_vsubuwm
10479
10480static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
10481                                                      vector int __b) {
10482  return __a - __b;
10483}
10484
10485static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
10486                                                      vector int __b) {
10487  return (vector int)__a - __b;
10488}
10489
10490static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
10491                                                      vector bool int __b) {
10492  return __a - (vector int)__b;
10493}
10494
10495static __inline__ vector unsigned int __ATTRS_o_ai
10496vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
10497  return __a - __b;
10498}
10499
10500static __inline__ vector unsigned int __ATTRS_o_ai
10501vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
10502  return (vector unsigned int)__a - __b;
10503}
10504
10505static __inline__ vector unsigned int __ATTRS_o_ai
10506vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
10507  return __a - (vector unsigned int)__b;
10508}
10509
10510/* vec_vsubfp */
10511
10512#define __builtin_altivec_vsubfp vec_vsubfp
10513
10514static __inline__ vector float __attribute__((__always_inline__))
10515vec_vsubfp(vector float __a, vector float __b) {
10516  return __a - __b;
10517}
10518
10519/* vec_subc */
10520
10521static __inline__ vector unsigned int __ATTRS_o_ai
10522vec_subc(vector unsigned int __a, vector unsigned int __b) {
10523  return __builtin_altivec_vsubcuw(__a, __b);
10524}
10525
10526#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10527static __inline__ vector unsigned __int128 __ATTRS_o_ai
10528vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
10529  return __builtin_altivec_vsubcuq(__a, __b);
10530}
10531
10532static __inline__ vector signed __int128 __ATTRS_o_ai
10533vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
10534  return __builtin_altivec_vsubcuq(__a, __b);
10535}
10536#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10537
10538/* vec_vsubcuw */
10539
10540static __inline__ vector unsigned int __attribute__((__always_inline__))
10541vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
10542  return __builtin_altivec_vsubcuw(__a, __b);
10543}
10544
10545/* vec_subs */
10546
10547static __inline__ vector signed char __ATTRS_o_ai
10548vec_subs(vector signed char __a, vector signed char __b) {
10549  return __builtin_altivec_vsubsbs(__a, __b);
10550}
10551
10552static __inline__ vector signed char __ATTRS_o_ai
10553vec_subs(vector bool char __a, vector signed char __b) {
10554  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
10555}
10556
10557static __inline__ vector signed char __ATTRS_o_ai
10558vec_subs(vector signed char __a, vector bool char __b) {
10559  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
10560}
10561
10562static __inline__ vector unsigned char __ATTRS_o_ai
10563vec_subs(vector unsigned char __a, vector unsigned char __b) {
10564  return __builtin_altivec_vsububs(__a, __b);
10565}
10566
10567static __inline__ vector unsigned char __ATTRS_o_ai
10568vec_subs(vector bool char __a, vector unsigned char __b) {
10569  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
10570}
10571
10572static __inline__ vector unsigned char __ATTRS_o_ai
10573vec_subs(vector unsigned char __a, vector bool char __b) {
10574  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
10575}
10576
10577static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
10578                                                     vector short __b) {
10579  return __builtin_altivec_vsubshs(__a, __b);
10580}
10581
10582static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
10583                                                     vector short __b) {
10584  return __builtin_altivec_vsubshs((vector short)__a, __b);
10585}
10586
10587static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
10588                                                     vector bool short __b) {
10589  return __builtin_altivec_vsubshs(__a, (vector short)__b);
10590}
10591
10592static __inline__ vector unsigned short __ATTRS_o_ai
10593vec_subs(vector unsigned short __a, vector unsigned short __b) {
10594  return __builtin_altivec_vsubuhs(__a, __b);
10595}
10596
10597static __inline__ vector unsigned short __ATTRS_o_ai
10598vec_subs(vector bool short __a, vector unsigned short __b) {
10599  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
10600}
10601
10602static __inline__ vector unsigned short __ATTRS_o_ai
10603vec_subs(vector unsigned short __a, vector bool short __b) {
10604  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
10605}
10606
10607static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
10608                                                   vector int __b) {
10609  return __builtin_altivec_vsubsws(__a, __b);
10610}
10611
10612static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
10613                                                   vector int __b) {
10614  return __builtin_altivec_vsubsws((vector int)__a, __b);
10615}
10616
10617static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
10618                                                   vector bool int __b) {
10619  return __builtin_altivec_vsubsws(__a, (vector int)__b);
10620}
10621
10622static __inline__ vector unsigned int __ATTRS_o_ai
10623vec_subs(vector unsigned int __a, vector unsigned int __b) {
10624  return __builtin_altivec_vsubuws(__a, __b);
10625}
10626
10627static __inline__ vector unsigned int __ATTRS_o_ai
10628vec_subs(vector bool int __a, vector unsigned int __b) {
10629  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
10630}
10631
10632static __inline__ vector unsigned int __ATTRS_o_ai
10633vec_subs(vector unsigned int __a, vector bool int __b) {
10634  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
10635}
10636
10637/* vec_vsubsbs */
10638
10639static __inline__ vector signed char __ATTRS_o_ai
10640vec_vsubsbs(vector signed char __a, vector signed char __b) {
10641  return __builtin_altivec_vsubsbs(__a, __b);
10642}
10643
10644static __inline__ vector signed char __ATTRS_o_ai
10645vec_vsubsbs(vector bool char __a, vector signed char __b) {
10646  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
10647}
10648
10649static __inline__ vector signed char __ATTRS_o_ai
10650vec_vsubsbs(vector signed char __a, vector bool char __b) {
10651  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
10652}
10653
10654/* vec_vsububs */
10655
10656static __inline__ vector unsigned char __ATTRS_o_ai
10657vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
10658  return __builtin_altivec_vsububs(__a, __b);
10659}
10660
10661static __inline__ vector unsigned char __ATTRS_o_ai
10662vec_vsububs(vector bool char __a, vector unsigned char __b) {
10663  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
10664}
10665
10666static __inline__ vector unsigned char __ATTRS_o_ai
10667vec_vsububs(vector unsigned char __a, vector bool char __b) {
10668  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
10669}
10670
10671/* vec_vsubshs */
10672
10673static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
10674                                                        vector short __b) {
10675  return __builtin_altivec_vsubshs(__a, __b);
10676}
10677
10678static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
10679                                                        vector short __b) {
10680  return __builtin_altivec_vsubshs((vector short)__a, __b);
10681}
10682
10683static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
10684                                                        vector bool short __b) {
10685  return __builtin_altivec_vsubshs(__a, (vector short)__b);
10686}
10687
10688/* vec_vsubuhs */
10689
10690static __inline__ vector unsigned short __ATTRS_o_ai
10691vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
10692  return __builtin_altivec_vsubuhs(__a, __b);
10693}
10694
10695static __inline__ vector unsigned short __ATTRS_o_ai
10696vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
10697  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
10698}
10699
10700static __inline__ vector unsigned short __ATTRS_o_ai
10701vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
10702  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
10703}
10704
10705/* vec_vsubsws */
10706
10707static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
10708                                                      vector int __b) {
10709  return __builtin_altivec_vsubsws(__a, __b);
10710}
10711
10712static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
10713                                                      vector int __b) {
10714  return __builtin_altivec_vsubsws((vector int)__a, __b);
10715}
10716
10717static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
10718                                                      vector bool int __b) {
10719  return __builtin_altivec_vsubsws(__a, (vector int)__b);
10720}
10721
10722/* vec_vsubuws */
10723
10724static __inline__ vector unsigned int __ATTRS_o_ai
10725vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
10726  return __builtin_altivec_vsubuws(__a, __b);
10727}
10728
10729static __inline__ vector unsigned int __ATTRS_o_ai
10730vec_vsubuws(vector bool int __a, vector unsigned int __b) {
10731  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
10732}
10733
10734static __inline__ vector unsigned int __ATTRS_o_ai
10735vec_vsubuws(vector unsigned int __a, vector bool int __b) {
10736  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
10737}
10738
10739#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10740/* vec_vsubuqm */
10741
10742static __inline__ vector signed __int128 __ATTRS_o_ai
10743vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
10744  return __a - __b;
10745}
10746
10747static __inline__ vector unsigned __int128 __ATTRS_o_ai
10748vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
10749  return __a - __b;
10750}
10751
10752/* vec_vsubeuqm */
10753
10754static __inline__ vector signed __int128 __ATTRS_o_ai
10755vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
10756             vector signed __int128 __c) {
10757  return __builtin_altivec_vsubeuqm(__a, __b, __c);
10758}
10759
10760static __inline__ vector unsigned __int128 __ATTRS_o_ai
10761vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
10762             vector unsigned __int128 __c) {
10763  return __builtin_altivec_vsubeuqm(__a, __b, __c);
10764}
10765
10766/* vec_vsubcuq */
10767
10768static __inline__ vector signed __int128 __ATTRS_o_ai
10769vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
10770  return __builtin_altivec_vsubcuq(__a, __b);
10771}
10772
10773static __inline__ vector unsigned __int128 __ATTRS_o_ai
10774vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
10775  return __builtin_altivec_vsubcuq(__a, __b);
10776}
10777
10778/* vec_vsubecuq */
10779
10780static __inline__ vector signed __int128 __ATTRS_o_ai
10781vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
10782             vector signed __int128 __c) {
10783  return __builtin_altivec_vsubecuq(__a, __b, __c);
10784}
10785
10786static __inline__ vector unsigned __int128 __ATTRS_o_ai
10787vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
10788             vector unsigned __int128 __c) {
10789  return __builtin_altivec_vsubecuq(__a, __b, __c);
10790}
10791#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10792
10793/* vec_sum4s */
10794
10795static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
10796                                                    vector int __b) {
10797  return __builtin_altivec_vsum4sbs(__a, __b);
10798}
10799
10800static __inline__ vector unsigned int __ATTRS_o_ai
10801vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
10802  return __builtin_altivec_vsum4ubs(__a, __b);
10803}
10804
10805static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
10806                                                    vector int __b) {
10807  return __builtin_altivec_vsum4shs(__a, __b);
10808}
10809
10810/* vec_vsum4sbs */
10811
10812static __inline__ vector int __attribute__((__always_inline__))
10813vec_vsum4sbs(vector signed char __a, vector int __b) {
10814  return __builtin_altivec_vsum4sbs(__a, __b);
10815}
10816
10817/* vec_vsum4ubs */
10818
10819static __inline__ vector unsigned int __attribute__((__always_inline__))
10820vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
10821  return __builtin_altivec_vsum4ubs(__a, __b);
10822}
10823
10824/* vec_vsum4shs */
10825
10826static __inline__ vector int __attribute__((__always_inline__))
10827vec_vsum4shs(vector signed short __a, vector int __b) {
10828  return __builtin_altivec_vsum4shs(__a, __b);
10829}
10830
10831/* vec_sum2s */
10832
10833/* The vsum2sws instruction has a big-endian bias, so that the second
10834   input vector and the result always reference big-endian elements
10835   1 and 3 (little-endian element 0 and 2).  For ease of porting the
10836   programmer wants elements 1 and 3 in both cases, so for little
10837   endian we must perform some permutes.  */
10838
10839static __inline__ vector signed int __attribute__((__always_inline__))
10840vec_sum2s(vector int __a, vector int __b) {
10841#ifdef __LITTLE_ENDIAN__
10842  vector int __c = (vector signed int)vec_perm(
10843      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
10844                                       8, 9, 10, 11));
10845  __c = __builtin_altivec_vsum2sws(__a, __c);
10846  return (vector signed int)vec_perm(
10847      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
10848                                       8, 9, 10, 11));
10849#else
10850  return __builtin_altivec_vsum2sws(__a, __b);
10851#endif
10852}
10853
10854/* vec_vsum2sws */
10855
10856static __inline__ vector signed int __attribute__((__always_inline__))
10857vec_vsum2sws(vector int __a, vector int __b) {
10858#ifdef __LITTLE_ENDIAN__
10859  vector int __c = (vector signed int)vec_perm(
10860      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
10861                                       8, 9, 10, 11));
10862  __c = __builtin_altivec_vsum2sws(__a, __c);
10863  return (vector signed int)vec_perm(
10864      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
10865                                       8, 9, 10, 11));
10866#else
10867  return __builtin_altivec_vsum2sws(__a, __b);
10868#endif
10869}
10870
10871/* vec_sums */
10872
10873/* The vsumsws instruction has a big-endian bias, so that the second
10874   input vector and the result always reference big-endian element 3
10875   (little-endian element 0).  For ease of porting the programmer
10876   wants element 3 in both cases, so for little endian we must perform
10877   some permutes.  */
10878
10879static __inline__ vector signed int __attribute__((__always_inline__))
10880vec_sums(vector signed int __a, vector signed int __b) {
10881#ifdef __LITTLE_ENDIAN__
10882  __b = (vector signed int)vec_splat(__b, 3);
10883  __b = __builtin_altivec_vsumsws(__a, __b);
10884  return (vector signed int)(0, 0, 0, __b[0]);
10885#else
10886  return __builtin_altivec_vsumsws(__a, __b);
10887#endif
10888}
10889
10890/* vec_vsumsws */
10891
10892static __inline__ vector signed int __attribute__((__always_inline__))
10893vec_vsumsws(vector signed int __a, vector signed int __b) {
10894#ifdef __LITTLE_ENDIAN__
10895  __b = (vector signed int)vec_splat(__b, 3);
10896  __b = __builtin_altivec_vsumsws(__a, __b);
10897  return (vector signed int)(0, 0, 0, __b[0]);
10898#else
10899  return __builtin_altivec_vsumsws(__a, __b);
10900#endif
10901}
10902
10903/* vec_trunc */
10904
10905static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
10906#ifdef __VSX__
10907  return __builtin_vsx_xvrspiz(__a);
10908#else
10909  return __builtin_altivec_vrfiz(__a);
10910#endif
10911}
10912
10913#ifdef __VSX__
10914static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
10915  return __builtin_vsx_xvrdpiz(__a);
10916}
10917#endif
10918
10919/* vec_vrfiz */
10920
10921static __inline__ vector float __attribute__((__always_inline__))
10922vec_vrfiz(vector float __a) {
10923  return __builtin_altivec_vrfiz(__a);
10924}
10925
10926/* vec_unpackh */
10927
10928/* The vector unpack instructions all have a big-endian bias, so for
10929   little endian we must reverse the meanings of "high" and "low."  */
10930
10931static __inline__ vector short __ATTRS_o_ai
10932vec_unpackh(vector signed char __a) {
10933#ifdef __LITTLE_ENDIAN__
10934  return __builtin_altivec_vupklsb((vector char)__a);
10935#else
10936  return __builtin_altivec_vupkhsb((vector char)__a);
10937#endif
10938}
10939
10940static __inline__ vector bool short __ATTRS_o_ai
10941vec_unpackh(vector bool char __a) {
10942#ifdef __LITTLE_ENDIAN__
10943  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10944#else
10945  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10946#endif
10947}
10948
10949static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
10950#ifdef __LITTLE_ENDIAN__
10951  return __builtin_altivec_vupklsh(__a);
10952#else
10953  return __builtin_altivec_vupkhsh(__a);
10954#endif
10955}
10956
10957static __inline__ vector bool int __ATTRS_o_ai
10958vec_unpackh(vector bool short __a) {
10959#ifdef __LITTLE_ENDIAN__
10960  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10961#else
10962  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10963#endif
10964}
10965
10966static __inline__ vector unsigned int __ATTRS_o_ai
10967vec_unpackh(vector pixel __a) {
10968#ifdef __LITTLE_ENDIAN__
10969  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10970#else
10971  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10972#endif
10973}
10974
10975#ifdef __POWER8_VECTOR__
10976static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
10977#ifdef __LITTLE_ENDIAN__
10978  return __builtin_altivec_vupklsw(__a);
10979#else
10980  return __builtin_altivec_vupkhsw(__a);
10981#endif
10982}
10983
10984static __inline__ vector bool long long __ATTRS_o_ai
10985vec_unpackh(vector bool int __a) {
10986#ifdef __LITTLE_ENDIAN__
10987  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10988#else
10989  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10990#endif
10991}
10992#endif
10993
10994/* vec_vupkhsb */
10995
10996static __inline__ vector short __ATTRS_o_ai
10997vec_vupkhsb(vector signed char __a) {
10998#ifdef __LITTLE_ENDIAN__
10999  return __builtin_altivec_vupklsb((vector char)__a);
11000#else
11001  return __builtin_altivec_vupkhsb((vector char)__a);
11002#endif
11003}
11004
11005static __inline__ vector bool short __ATTRS_o_ai
11006vec_vupkhsb(vector bool char __a) {
11007#ifdef __LITTLE_ENDIAN__
11008  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11009#else
11010  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11011#endif
11012}
11013
11014/* vec_vupkhsh */
11015
11016static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11017#ifdef __LITTLE_ENDIAN__
11018  return __builtin_altivec_vupklsh(__a);
11019#else
11020  return __builtin_altivec_vupkhsh(__a);
11021#endif
11022}
11023
11024static __inline__ vector bool int __ATTRS_o_ai
11025vec_vupkhsh(vector bool short __a) {
11026#ifdef __LITTLE_ENDIAN__
11027  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11028#else
11029  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11030#endif
11031}
11032
11033static __inline__ vector unsigned int __ATTRS_o_ai
11034vec_vupkhsh(vector pixel __a) {
11035#ifdef __LITTLE_ENDIAN__
11036  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11037#else
11038  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11039#endif
11040}
11041
11042/* vec_vupkhsw */
11043
11044#ifdef __POWER8_VECTOR__
11045static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11046#ifdef __LITTLE_ENDIAN__
11047  return __builtin_altivec_vupklsw(__a);
11048#else
11049  return __builtin_altivec_vupkhsw(__a);
11050#endif
11051}
11052
11053static __inline__ vector bool long long __ATTRS_o_ai
11054vec_vupkhsw(vector bool int __a) {
11055#ifdef __LITTLE_ENDIAN__
11056  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11057#else
11058  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11059#endif
11060}
11061#endif
11062
11063/* vec_unpackl */
11064
11065static __inline__ vector short __ATTRS_o_ai
11066vec_unpackl(vector signed char __a) {
11067#ifdef __LITTLE_ENDIAN__
11068  return __builtin_altivec_vupkhsb((vector char)__a);
11069#else
11070  return __builtin_altivec_vupklsb((vector char)__a);
11071#endif
11072}
11073
11074static __inline__ vector bool short __ATTRS_o_ai
11075vec_unpackl(vector bool char __a) {
11076#ifdef __LITTLE_ENDIAN__
11077  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11078#else
11079  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11080#endif
11081}
11082
11083static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11084#ifdef __LITTLE_ENDIAN__
11085  return __builtin_altivec_vupkhsh(__a);
11086#else
11087  return __builtin_altivec_vupklsh(__a);
11088#endif
11089}
11090
11091static __inline__ vector bool int __ATTRS_o_ai
11092vec_unpackl(vector bool short __a) {
11093#ifdef __LITTLE_ENDIAN__
11094  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11095#else
11096  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11097#endif
11098}
11099
11100static __inline__ vector unsigned int __ATTRS_o_ai
11101vec_unpackl(vector pixel __a) {
11102#ifdef __LITTLE_ENDIAN__
11103  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11104#else
11105  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11106#endif
11107}
11108
11109#ifdef __POWER8_VECTOR__
11110static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11111#ifdef __LITTLE_ENDIAN__
11112  return __builtin_altivec_vupkhsw(__a);
11113#else
11114  return __builtin_altivec_vupklsw(__a);
11115#endif
11116}
11117
11118static __inline__ vector bool long long __ATTRS_o_ai
11119vec_unpackl(vector bool int __a) {
11120#ifdef __LITTLE_ENDIAN__
11121  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11122#else
11123  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11124#endif
11125}
11126#endif
11127
11128/* vec_vupklsb */
11129
11130static __inline__ vector short __ATTRS_o_ai
11131vec_vupklsb(vector signed char __a) {
11132#ifdef __LITTLE_ENDIAN__
11133  return __builtin_altivec_vupkhsb((vector char)__a);
11134#else
11135  return __builtin_altivec_vupklsb((vector char)__a);
11136#endif
11137}
11138
11139static __inline__ vector bool short __ATTRS_o_ai
11140vec_vupklsb(vector bool char __a) {
11141#ifdef __LITTLE_ENDIAN__
11142  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11143#else
11144  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11145#endif
11146}
11147
11148/* vec_vupklsh */
11149
11150static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11151#ifdef __LITTLE_ENDIAN__
11152  return __builtin_altivec_vupkhsh(__a);
11153#else
11154  return __builtin_altivec_vupklsh(__a);
11155#endif
11156}
11157
11158static __inline__ vector bool int __ATTRS_o_ai
11159vec_vupklsh(vector bool short __a) {
11160#ifdef __LITTLE_ENDIAN__
11161  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11162#else
11163  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11164#endif
11165}
11166
11167static __inline__ vector unsigned int __ATTRS_o_ai
11168vec_vupklsh(vector pixel __a) {
11169#ifdef __LITTLE_ENDIAN__
11170  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11171#else
11172  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11173#endif
11174}
11175
11176/* vec_vupklsw */
11177
11178#ifdef __POWER8_VECTOR__
11179static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11180#ifdef __LITTLE_ENDIAN__
11181  return __builtin_altivec_vupkhsw(__a);
11182#else
11183  return __builtin_altivec_vupklsw(__a);
11184#endif
11185}
11186
11187static __inline__ vector bool long long __ATTRS_o_ai
11188vec_vupklsw(vector bool int __a) {
11189#ifdef __LITTLE_ENDIAN__
11190  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11191#else
11192  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11193#endif
11194}
11195#endif
11196
11197/* vec_vsx_ld */
11198
11199#ifdef __VSX__
11200
11201static __inline__ vector bool int __ATTRS_o_ai
11202vec_vsx_ld(int __a, const vector bool int *__b) {
11203  return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11204}
11205
11206static __inline__ vector signed int __ATTRS_o_ai
11207vec_vsx_ld(int __a, const vector signed int *__b) {
11208  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11209}
11210
11211static __inline__ vector signed int __ATTRS_o_ai
11212vec_vsx_ld(int __a, const signed int *__b) {
11213  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11214}
11215
11216static __inline__ vector unsigned int __ATTRS_o_ai
11217vec_vsx_ld(int __a, const vector unsigned int *__b) {
11218  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11219}
11220
11221static __inline__ vector unsigned int __ATTRS_o_ai
11222vec_vsx_ld(int __a, const unsigned int *__b) {
11223  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11224}
11225
11226static __inline__ vector float __ATTRS_o_ai
11227vec_vsx_ld(int __a, const vector float *__b) {
11228  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11229}
11230
11231static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11232                                                       const float *__b) {
11233  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11234}
11235
11236static __inline__ vector signed long long __ATTRS_o_ai
11237vec_vsx_ld(int __a, const vector signed long long *__b) {
11238  return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11239}
11240
11241static __inline__ vector unsigned long long __ATTRS_o_ai
11242vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11243  return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11244}
11245
11246static __inline__ vector double __ATTRS_o_ai
11247vec_vsx_ld(int __a, const vector double *__b) {
11248  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11249}
11250
11251static __inline__ vector double __ATTRS_o_ai
11252vec_vsx_ld(int __a, const double *__b) {
11253  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11254}
11255
11256static __inline__ vector bool short __ATTRS_o_ai
11257vec_vsx_ld(int __a, const vector bool short *__b) {
11258  return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11259}
11260
11261static __inline__ vector signed short __ATTRS_o_ai
11262vec_vsx_ld(int __a, const vector signed short *__b) {
11263  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11264}
11265
11266static __inline__ vector signed short __ATTRS_o_ai
11267vec_vsx_ld(int __a, const signed short *__b) {
11268  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11269}
11270
11271static __inline__ vector unsigned short __ATTRS_o_ai
11272vec_vsx_ld(int __a, const vector unsigned short *__b) {
11273  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11274}
11275
11276static __inline__ vector unsigned short __ATTRS_o_ai
11277vec_vsx_ld(int __a, const unsigned short *__b) {
11278  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11279}
11280
11281static __inline__ vector bool char __ATTRS_o_ai
11282vec_vsx_ld(int __a, const vector bool char *__b) {
11283  return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11284}
11285
11286static __inline__ vector signed char __ATTRS_o_ai
11287vec_vsx_ld(int __a, const vector signed char *__b) {
11288  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11289}
11290
11291static __inline__ vector signed char __ATTRS_o_ai
11292vec_vsx_ld(int __a, const signed char *__b) {
11293  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11294}
11295
11296static __inline__ vector unsigned char __ATTRS_o_ai
11297vec_vsx_ld(int __a, const vector unsigned char *__b) {
11298  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11299}
11300
11301static __inline__ vector unsigned char __ATTRS_o_ai
11302vec_vsx_ld(int __a, const unsigned char *__b) {
11303  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11304}
11305
11306#endif
11307
11308/* vec_vsx_st */
11309
11310#ifdef __VSX__
11311
11312static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
11313                                               vector bool int *__c) {
11314  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11315}
11316
11317static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
11318                                               signed int *__c) {
11319  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11320}
11321
11322static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
11323                                               unsigned int *__c) {
11324  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11325}
11326
11327static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
11328                                               vector signed int *__c) {
11329  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11330}
11331
11332static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
11333                                               signed int *__c) {
11334  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11335}
11336
11337static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
11338                                               vector unsigned int *__c) {
11339  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11340}
11341
11342static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
11343                                               unsigned int *__c) {
11344  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11345}
11346
11347static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
11348                                               vector float *__c) {
11349  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11350}
11351
11352static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
11353                                               float *__c) {
11354  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11355}
11356
11357static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
11358                                               int __b,
11359                                               vector signed long long *__c) {
11360  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
11361}
11362
11363static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
11364                                               int __b,
11365                                               vector unsigned long long *__c) {
11366  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
11367}
11368
11369static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
11370                                               vector double *__c) {
11371  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
11372}
11373
11374static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
11375                                               double *__c) {
11376  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
11377}
11378
11379static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
11380                                               vector bool short *__c) {
11381  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11382}
11383
11384static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
11385                                               signed short *__c) {
11386  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11387}
11388
11389static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
11390                                               unsigned short *__c) {
11391  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11392}
11393static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
11394                                               vector signed short *__c) {
11395  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11396}
11397
11398static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
11399                                               signed short *__c) {
11400  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11401}
11402
11403static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
11404                                               int __b,
11405                                               vector unsigned short *__c) {
11406  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11407}
11408
11409static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
11410                                               int __b, unsigned short *__c) {
11411  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11412}
11413
11414static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
11415                                               vector bool char *__c) {
11416  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11417}
11418
11419static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
11420                                               signed char *__c) {
11421  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11422}
11423
11424static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
11425                                               unsigned char *__c) {
11426  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11427}
11428
11429static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
11430                                               vector signed char *__c) {
11431  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11432}
11433
11434static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
11435                                               signed char *__c) {
11436  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11437}
11438
11439static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
11440                                               int __b,
11441                                               vector unsigned char *__c) {
11442  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11443}
11444
11445static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
11446                                               int __b, unsigned char *__c) {
11447  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
11448}
11449
11450#endif
11451
11452/* vec_xor */
11453
11454#define __builtin_altivec_vxor vec_xor
11455
11456static __inline__ vector signed char __ATTRS_o_ai
11457vec_xor(vector signed char __a, vector signed char __b) {
11458  return __a ^ __b;
11459}
11460
11461static __inline__ vector signed char __ATTRS_o_ai
11462vec_xor(vector bool char __a, vector signed char __b) {
11463  return (vector signed char)__a ^ __b;
11464}
11465
11466static __inline__ vector signed char __ATTRS_o_ai
11467vec_xor(vector signed char __a, vector bool char __b) {
11468  return __a ^ (vector signed char)__b;
11469}
11470
11471static __inline__ vector unsigned char __ATTRS_o_ai
11472vec_xor(vector unsigned char __a, vector unsigned char __b) {
11473  return __a ^ __b;
11474}
11475
11476static __inline__ vector unsigned char __ATTRS_o_ai
11477vec_xor(vector bool char __a, vector unsigned char __b) {
11478  return (vector unsigned char)__a ^ __b;
11479}
11480
11481static __inline__ vector unsigned char __ATTRS_o_ai
11482vec_xor(vector unsigned char __a, vector bool char __b) {
11483  return __a ^ (vector unsigned char)__b;
11484}
11485
11486static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
11487                                                        vector bool char __b) {
11488  return __a ^ __b;
11489}
11490
11491static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
11492                                                    vector short __b) {
11493  return __a ^ __b;
11494}
11495
11496static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
11497                                                    vector short __b) {
11498  return (vector short)__a ^ __b;
11499}
11500
11501static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
11502                                                    vector bool short __b) {
11503  return __a ^ (vector short)__b;
11504}
11505
11506static __inline__ vector unsigned short __ATTRS_o_ai
11507vec_xor(vector unsigned short __a, vector unsigned short __b) {
11508  return __a ^ __b;
11509}
11510
11511static __inline__ vector unsigned short __ATTRS_o_ai
11512vec_xor(vector bool short __a, vector unsigned short __b) {
11513  return (vector unsigned short)__a ^ __b;
11514}
11515
11516static __inline__ vector unsigned short __ATTRS_o_ai
11517vec_xor(vector unsigned short __a, vector bool short __b) {
11518  return __a ^ (vector unsigned short)__b;
11519}
11520
11521static __inline__ vector bool short __ATTRS_o_ai
11522vec_xor(vector bool short __a, vector bool short __b) {
11523  return __a ^ __b;
11524}
11525
11526static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
11527                                                  vector int __b) {
11528  return __a ^ __b;
11529}
11530
11531static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
11532                                                  vector int __b) {
11533  return (vector int)__a ^ __b;
11534}
11535
11536static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
11537                                                  vector bool int __b) {
11538  return __a ^ (vector int)__b;
11539}
11540
11541static __inline__ vector unsigned int __ATTRS_o_ai
11542vec_xor(vector unsigned int __a, vector unsigned int __b) {
11543  return __a ^ __b;
11544}
11545
11546static __inline__ vector unsigned int __ATTRS_o_ai
11547vec_xor(vector bool int __a, vector unsigned int __b) {
11548  return (vector unsigned int)__a ^ __b;
11549}
11550
11551static __inline__ vector unsigned int __ATTRS_o_ai
11552vec_xor(vector unsigned int __a, vector bool int __b) {
11553  return __a ^ (vector unsigned int)__b;
11554}
11555
11556static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
11557                                                       vector bool int __b) {
11558  return __a ^ __b;
11559}
11560
11561static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
11562                                                    vector float __b) {
11563  vector unsigned int __res =
11564      (vector unsigned int)__a ^ (vector unsigned int)__b;
11565  return (vector float)__res;
11566}
11567
11568static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
11569                                                    vector float __b) {
11570  vector unsigned int __res =
11571      (vector unsigned int)__a ^ (vector unsigned int)__b;
11572  return (vector float)__res;
11573}
11574
11575static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
11576                                                    vector bool int __b) {
11577  vector unsigned int __res =
11578      (vector unsigned int)__a ^ (vector unsigned int)__b;
11579  return (vector float)__res;
11580}
11581
11582#ifdef __VSX__
11583static __inline__ vector signed long long __ATTRS_o_ai
11584vec_xor(vector signed long long __a, vector signed long long __b) {
11585  return __a ^ __b;
11586}
11587
11588static __inline__ vector signed long long __ATTRS_o_ai
11589vec_xor(vector bool long long __a, vector signed long long __b) {
11590  return (vector signed long long)__a ^ __b;
11591}
11592
11593static __inline__ vector signed long long __ATTRS_o_ai
11594vec_xor(vector signed long long __a, vector bool long long __b) {
11595  return __a ^ (vector signed long long)__b;
11596}
11597
11598static __inline__ vector unsigned long long __ATTRS_o_ai
11599vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
11600  return __a ^ __b;
11601}
11602
11603static __inline__ vector unsigned long long __ATTRS_o_ai
11604vec_xor(vector bool long long __a, vector unsigned long long __b) {
11605  return (vector unsigned long long)__a ^ __b;
11606}
11607
11608static __inline__ vector unsigned long long __ATTRS_o_ai
11609vec_xor(vector unsigned long long __a, vector bool long long __b) {
11610  return __a ^ (vector unsigned long long)__b;
11611}
11612
11613static __inline__ vector bool long long __ATTRS_o_ai
11614vec_xor(vector bool long long __a, vector bool long long __b) {
11615  return __a ^ __b;
11616}
11617
11618static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
11619                                                     vector double __b) {
11620  return (vector double)((vector unsigned long long)__a ^
11621                         (vector unsigned long long)__b);
11622}
11623
11624static __inline__ vector double __ATTRS_o_ai
11625vec_xor(vector double __a, vector bool long long __b) {
11626  return (vector double)((vector unsigned long long)__a ^
11627                         (vector unsigned long long)__b);
11628}
11629
11630static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
11631                                                     vector double __b) {
11632  return (vector double)((vector unsigned long long)__a ^
11633                         (vector unsigned long long)__b);
11634}
11635#endif
11636
11637/* vec_vxor */
11638
11639static __inline__ vector signed char __ATTRS_o_ai
11640vec_vxor(vector signed char __a, vector signed char __b) {
11641  return __a ^ __b;
11642}
11643
11644static __inline__ vector signed char __ATTRS_o_ai
11645vec_vxor(vector bool char __a, vector signed char __b) {
11646  return (vector signed char)__a ^ __b;
11647}
11648
11649static __inline__ vector signed char __ATTRS_o_ai
11650vec_vxor(vector signed char __a, vector bool char __b) {
11651  return __a ^ (vector signed char)__b;
11652}
11653
11654static __inline__ vector unsigned char __ATTRS_o_ai
11655vec_vxor(vector unsigned char __a, vector unsigned char __b) {
11656  return __a ^ __b;
11657}
11658
11659static __inline__ vector unsigned char __ATTRS_o_ai
11660vec_vxor(vector bool char __a, vector unsigned char __b) {
11661  return (vector unsigned char)__a ^ __b;
11662}
11663
11664static __inline__ vector unsigned char __ATTRS_o_ai
11665vec_vxor(vector unsigned char __a, vector bool char __b) {
11666  return __a ^ (vector unsigned char)__b;
11667}
11668
11669static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
11670                                                         vector bool char __b) {
11671  return __a ^ __b;
11672}
11673
11674static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
11675                                                     vector short __b) {
11676  return __a ^ __b;
11677}
11678
11679static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
11680                                                     vector short __b) {
11681  return (vector short)__a ^ __b;
11682}
11683
11684static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
11685                                                     vector bool short __b) {
11686  return __a ^ (vector short)__b;
11687}
11688
11689static __inline__ vector unsigned short __ATTRS_o_ai
11690vec_vxor(vector unsigned short __a, vector unsigned short __b) {
11691  return __a ^ __b;
11692}
11693
11694static __inline__ vector unsigned short __ATTRS_o_ai
11695vec_vxor(vector bool short __a, vector unsigned short __b) {
11696  return (vector unsigned short)__a ^ __b;
11697}
11698
11699static __inline__ vector unsigned short __ATTRS_o_ai
11700vec_vxor(vector unsigned short __a, vector bool short __b) {
11701  return __a ^ (vector unsigned short)__b;
11702}
11703
11704static __inline__ vector bool short __ATTRS_o_ai
11705vec_vxor(vector bool short __a, vector bool short __b) {
11706  return __a ^ __b;
11707}
11708
11709static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
11710                                                   vector int __b) {
11711  return __a ^ __b;
11712}
11713
11714static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
11715                                                   vector int __b) {
11716  return (vector int)__a ^ __b;
11717}
11718
11719static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
11720                                                   vector bool int __b) {
11721  return __a ^ (vector int)__b;
11722}
11723
11724static __inline__ vector unsigned int __ATTRS_o_ai
11725vec_vxor(vector unsigned int __a, vector unsigned int __b) {
11726  return __a ^ __b;
11727}
11728
11729static __inline__ vector unsigned int __ATTRS_o_ai
11730vec_vxor(vector bool int __a, vector unsigned int __b) {
11731  return (vector unsigned int)__a ^ __b;
11732}
11733
11734static __inline__ vector unsigned int __ATTRS_o_ai
11735vec_vxor(vector unsigned int __a, vector bool int __b) {
11736  return __a ^ (vector unsigned int)__b;
11737}
11738
11739static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
11740                                                        vector bool int __b) {
11741  return __a ^ __b;
11742}
11743
11744static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
11745                                                     vector float __b) {
11746  vector unsigned int __res =
11747      (vector unsigned int)__a ^ (vector unsigned int)__b;
11748  return (vector float)__res;
11749}
11750
11751static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
11752                                                     vector float __b) {
11753  vector unsigned int __res =
11754      (vector unsigned int)__a ^ (vector unsigned int)__b;
11755  return (vector float)__res;
11756}
11757
11758static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
11759                                                     vector bool int __b) {
11760  vector unsigned int __res =
11761      (vector unsigned int)__a ^ (vector unsigned int)__b;
11762  return (vector float)__res;
11763}
11764
11765#ifdef __VSX__
11766static __inline__ vector signed long long __ATTRS_o_ai
11767vec_vxor(vector signed long long __a, vector signed long long __b) {
11768  return __a ^ __b;
11769}
11770
11771static __inline__ vector signed long long __ATTRS_o_ai
11772vec_vxor(vector bool long long __a, vector signed long long __b) {
11773  return (vector signed long long)__a ^ __b;
11774}
11775
11776static __inline__ vector signed long long __ATTRS_o_ai
11777vec_vxor(vector signed long long __a, vector bool long long __b) {
11778  return __a ^ (vector signed long long)__b;
11779}
11780
11781static __inline__ vector unsigned long long __ATTRS_o_ai
11782vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
11783  return __a ^ __b;
11784}
11785
11786static __inline__ vector unsigned long long __ATTRS_o_ai
11787vec_vxor(vector bool long long __a, vector unsigned long long __b) {
11788  return (vector unsigned long long)__a ^ __b;
11789}
11790
11791static __inline__ vector unsigned long long __ATTRS_o_ai
11792vec_vxor(vector unsigned long long __a, vector bool long long __b) {
11793  return __a ^ (vector unsigned long long)__b;
11794}
11795
11796static __inline__ vector bool long long __ATTRS_o_ai
11797vec_vxor(vector bool long long __a, vector bool long long __b) {
11798  return __a ^ __b;
11799}
11800#endif
11801
11802/* ------------------------ extensions for CBEA ----------------------------- */
11803
11804/* vec_extract */
11805
11806static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
11807                                                       int __b) {
11808  return __a[__b];
11809}
11810
11811static __inline__ unsigned char __ATTRS_o_ai
11812vec_extract(vector unsigned char __a, int __b) {
11813  return __a[__b];
11814}
11815
11816static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
11817                                                         int __b) {
11818  return __a[__b];
11819}
11820
11821static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
11822                                                        int __b) {
11823  return __a[__b];
11824}
11825
11826static __inline__ unsigned short __ATTRS_o_ai
11827vec_extract(vector unsigned short __a, int __b) {
11828  return __a[__b];
11829}
11830
11831static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
11832                                                          int __b) {
11833  return __a[__b];
11834}
11835
11836static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
11837                                                      int __b) {
11838  return __a[__b];
11839}
11840
11841static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
11842                                                        int __b) {
11843  return __a[__b];
11844}
11845
11846static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
11847                                                        int __b) {
11848  return __a[__b];
11849}
11850
11851#ifdef __VSX__
11852static __inline__ signed long long __ATTRS_o_ai
11853vec_extract(vector signed long long __a, int __b) {
11854  return __a[__b];
11855}
11856
11857static __inline__ unsigned long long __ATTRS_o_ai
11858vec_extract(vector unsigned long long __a, int __b) {
11859  return __a[__b];
11860}
11861
11862static __inline__ unsigned long long __ATTRS_o_ai
11863vec_extract(vector bool long long __a, int __b) {
11864  return __a[__b];
11865}
11866
11867static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
11868  return __a[__b];
11869}
11870#endif
11871
11872static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
11873  return __a[__b];
11874}
11875
11876/* vec_insert */
11877
11878static __inline__ vector signed char __ATTRS_o_ai
11879vec_insert(signed char __a, vector signed char __b, int __c) {
11880  __b[__c] = __a;
11881  return __b;
11882}
11883
11884static __inline__ vector unsigned char __ATTRS_o_ai
11885vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
11886  __b[__c] = __a;
11887  return __b;
11888}
11889
11890static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
11891                                                           vector bool char __b,
11892                                                           int __c) {
11893  __b[__c] = __a;
11894  return __b;
11895}
11896
11897static __inline__ vector signed short __ATTRS_o_ai
11898vec_insert(signed short __a, vector signed short __b, int __c) {
11899  __b[__c] = __a;
11900  return __b;
11901}
11902
11903static __inline__ vector unsigned short __ATTRS_o_ai
11904vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
11905  __b[__c] = __a;
11906  return __b;
11907}
11908
11909static __inline__ vector bool short __ATTRS_o_ai
11910vec_insert(unsigned short __a, vector bool short __b, int __c) {
11911  __b[__c] = __a;
11912  return __b;
11913}
11914
11915static __inline__ vector signed int __ATTRS_o_ai
11916vec_insert(signed int __a, vector signed int __b, int __c) {
11917  __b[__c] = __a;
11918  return __b;
11919}
11920
11921static __inline__ vector unsigned int __ATTRS_o_ai
11922vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
11923  __b[__c] = __a;
11924  return __b;
11925}
11926
11927static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
11928                                                          vector bool int __b,
11929                                                          int __c) {
11930  __b[__c] = __a;
11931  return __b;
11932}
11933
11934#ifdef __VSX__
11935static __inline__ vector signed long long __ATTRS_o_ai
11936vec_insert(signed long long __a, vector signed long long __b, int __c) {
11937  __b[__c] = __a;
11938  return __b;
11939}
11940
11941static __inline__ vector unsigned long long __ATTRS_o_ai
11942vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
11943  __b[__c] = __a;
11944  return __b;
11945}
11946
11947static __inline__ vector bool long long __ATTRS_o_ai
11948vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
11949  __b[__c] = __a;
11950  return __b;
11951}
11952static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
11953                                                        vector double __b,
11954                                                        int __c) {
11955  __b[__c] = __a;
11956  return __b;
11957}
11958#endif
11959
11960static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
11961                                                       vector float __b,
11962                                                       int __c) {
11963  __b[__c] = __a;
11964  return __b;
11965}
11966
11967/* vec_lvlx */
11968
11969static __inline__ vector signed char __ATTRS_o_ai
11970vec_lvlx(int __a, const signed char *__b) {
11971  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11972                  vec_lvsl(__a, __b));
11973}
11974
11975static __inline__ vector signed char __ATTRS_o_ai
11976vec_lvlx(int __a, const vector signed char *__b) {
11977  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11978                  vec_lvsl(__a, (unsigned char *)__b));
11979}
11980
11981static __inline__ vector unsigned char __ATTRS_o_ai
11982vec_lvlx(int __a, const unsigned char *__b) {
11983  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11984                  vec_lvsl(__a, __b));
11985}
11986
11987static __inline__ vector unsigned char __ATTRS_o_ai
11988vec_lvlx(int __a, const vector unsigned char *__b) {
11989  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11990                  vec_lvsl(__a, (unsigned char *)__b));
11991}
11992
11993static __inline__ vector bool char __ATTRS_o_ai
11994vec_lvlx(int __a, const vector bool char *__b) {
11995  return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
11996                  vec_lvsl(__a, (unsigned char *)__b));
11997}
11998
11999static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12000                                                     const short *__b) {
12001  return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12002}
12003
12004static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12005                                                     const vector short *__b) {
12006  return vec_perm(vec_ld(__a, __b), (vector short)(0),
12007                  vec_lvsl(__a, (unsigned char *)__b));
12008}
12009
12010static __inline__ vector unsigned short __ATTRS_o_ai
12011vec_lvlx(int __a, const unsigned short *__b) {
12012  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12013                  vec_lvsl(__a, __b));
12014}
12015
12016static __inline__ vector unsigned short __ATTRS_o_ai
12017vec_lvlx(int __a, const vector unsigned short *__b) {
12018  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12019                  vec_lvsl(__a, (unsigned char *)__b));
12020}
12021
12022static __inline__ vector bool short __ATTRS_o_ai
12023vec_lvlx(int __a, const vector bool short *__b) {
12024  return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12025                  vec_lvsl(__a, (unsigned char *)__b));
12026}
12027
12028static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12029                                                     const vector pixel *__b) {
12030  return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12031                  vec_lvsl(__a, (unsigned char *)__b));
12032}
12033
12034static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12035  return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12036}
12037
12038static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12039                                                   const vector int *__b) {
12040  return vec_perm(vec_ld(__a, __b), (vector int)(0),
12041                  vec_lvsl(__a, (unsigned char *)__b));
12042}
12043
12044static __inline__ vector unsigned int __ATTRS_o_ai
12045vec_lvlx(int __a, const unsigned int *__b) {
12046  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12047                  vec_lvsl(__a, __b));
12048}
12049
12050static __inline__ vector unsigned int __ATTRS_o_ai
12051vec_lvlx(int __a, const vector unsigned int *__b) {
12052  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12053                  vec_lvsl(__a, (unsigned char *)__b));
12054}
12055
12056static __inline__ vector bool int __ATTRS_o_ai
12057vec_lvlx(int __a, const vector bool int *__b) {
12058  return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12059                  vec_lvsl(__a, (unsigned char *)__b));
12060}
12061
12062static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12063                                                     const float *__b) {
12064  return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12065}
12066
12067static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12068                                                     const vector float *__b) {
12069  return vec_perm(vec_ld(__a, __b), (vector float)(0),
12070                  vec_lvsl(__a, (unsigned char *)__b));
12071}
12072
12073/* vec_lvlxl */
12074
12075static __inline__ vector signed char __ATTRS_o_ai
12076vec_lvlxl(int __a, const signed char *__b) {
12077  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12078                  vec_lvsl(__a, __b));
12079}
12080
12081static __inline__ vector signed char __ATTRS_o_ai
12082vec_lvlxl(int __a, const vector signed char *__b) {
12083  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12084                  vec_lvsl(__a, (unsigned char *)__b));
12085}
12086
12087static __inline__ vector unsigned char __ATTRS_o_ai
12088vec_lvlxl(int __a, const unsigned char *__b) {
12089  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12090                  vec_lvsl(__a, __b));
12091}
12092
12093static __inline__ vector unsigned char __ATTRS_o_ai
12094vec_lvlxl(int __a, const vector unsigned char *__b) {
12095  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12096                  vec_lvsl(__a, (unsigned char *)__b));
12097}
12098
12099static __inline__ vector bool char __ATTRS_o_ai
12100vec_lvlxl(int __a, const vector bool char *__b) {
12101  return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12102                  vec_lvsl(__a, (unsigned char *)__b));
12103}
12104
12105static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12106                                                      const short *__b) {
12107  return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12108}
12109
12110static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12111                                                      const vector short *__b) {
12112  return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12113                  vec_lvsl(__a, (unsigned char *)__b));
12114}
12115
12116static __inline__ vector unsigned short __ATTRS_o_ai
12117vec_lvlxl(int __a, const unsigned short *__b) {
12118  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12119                  vec_lvsl(__a, __b));
12120}
12121
12122static __inline__ vector unsigned short __ATTRS_o_ai
12123vec_lvlxl(int __a, const vector unsigned short *__b) {
12124  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12125                  vec_lvsl(__a, (unsigned char *)__b));
12126}
12127
12128static __inline__ vector bool short __ATTRS_o_ai
12129vec_lvlxl(int __a, const vector bool short *__b) {
12130  return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12131                  vec_lvsl(__a, (unsigned char *)__b));
12132}
12133
12134static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12135                                                      const vector pixel *__b) {
12136  return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12137                  vec_lvsl(__a, (unsigned char *)__b));
12138}
12139
12140static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12141  return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12142}
12143
12144static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12145                                                    const vector int *__b) {
12146  return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12147                  vec_lvsl(__a, (unsigned char *)__b));
12148}
12149
12150static __inline__ vector unsigned int __ATTRS_o_ai
12151vec_lvlxl(int __a, const unsigned int *__b) {
12152  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12153                  vec_lvsl(__a, __b));
12154}
12155
12156static __inline__ vector unsigned int __ATTRS_o_ai
12157vec_lvlxl(int __a, const vector unsigned int *__b) {
12158  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12159                  vec_lvsl(__a, (unsigned char *)__b));
12160}
12161
12162static __inline__ vector bool int __ATTRS_o_ai
12163vec_lvlxl(int __a, const vector bool int *__b) {
12164  return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12165                  vec_lvsl(__a, (unsigned char *)__b));
12166}
12167
12168static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12169                                                      const float *__b) {
12170  return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12171}
12172
12173static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12174                                                      vector float *__b) {
12175  return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12176                  vec_lvsl(__a, (unsigned char *)__b));
12177}
12178
12179/* vec_lvrx */
12180
12181static __inline__ vector signed char __ATTRS_o_ai
12182vec_lvrx(int __a, const signed char *__b) {
12183  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12184                  vec_lvsl(__a, __b));
12185}
12186
12187static __inline__ vector signed char __ATTRS_o_ai
12188vec_lvrx(int __a, const vector signed char *__b) {
12189  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12190                  vec_lvsl(__a, (unsigned char *)__b));
12191}
12192
12193static __inline__ vector unsigned char __ATTRS_o_ai
12194vec_lvrx(int __a, const unsigned char *__b) {
12195  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12196                  vec_lvsl(__a, __b));
12197}
12198
12199static __inline__ vector unsigned char __ATTRS_o_ai
12200vec_lvrx(int __a, const vector unsigned char *__b) {
12201  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12202                  vec_lvsl(__a, (unsigned char *)__b));
12203}
12204
12205static __inline__ vector bool char __ATTRS_o_ai
12206vec_lvrx(int __a, const vector bool char *__b) {
12207  return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12208                  vec_lvsl(__a, (unsigned char *)__b));
12209}
12210
12211static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12212                                                     const short *__b) {
12213  return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12214}
12215
12216static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12217                                                     const vector short *__b) {
12218  return vec_perm((vector short)(0), vec_ld(__a, __b),
12219                  vec_lvsl(__a, (unsigned char *)__b));
12220}
12221
12222static __inline__ vector unsigned short __ATTRS_o_ai
12223vec_lvrx(int __a, const unsigned short *__b) {
12224  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12225                  vec_lvsl(__a, __b));
12226}
12227
12228static __inline__ vector unsigned short __ATTRS_o_ai
12229vec_lvrx(int __a, const vector unsigned short *__b) {
12230  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12231                  vec_lvsl(__a, (unsigned char *)__b));
12232}
12233
12234static __inline__ vector bool short __ATTRS_o_ai
12235vec_lvrx(int __a, const vector bool short *__b) {
12236  return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12237                  vec_lvsl(__a, (unsigned char *)__b));
12238}
12239
12240static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12241                                                     const vector pixel *__b) {
12242  return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12243                  vec_lvsl(__a, (unsigned char *)__b));
12244}
12245
12246static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
12247  return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12248}
12249
12250static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
12251                                                   const vector int *__b) {
12252  return vec_perm((vector int)(0), vec_ld(__a, __b),
12253                  vec_lvsl(__a, (unsigned char *)__b));
12254}
12255
12256static __inline__ vector unsigned int __ATTRS_o_ai
12257vec_lvrx(int __a, const unsigned int *__b) {
12258  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
12259                  vec_lvsl(__a, __b));
12260}
12261
12262static __inline__ vector unsigned int __ATTRS_o_ai
12263vec_lvrx(int __a, const vector unsigned int *__b) {
12264  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
12265                  vec_lvsl(__a, (unsigned char *)__b));
12266}
12267
12268static __inline__ vector bool int __ATTRS_o_ai
12269vec_lvrx(int __a, const vector bool int *__b) {
12270  return vec_perm((vector bool int)(0), vec_ld(__a, __b),
12271                  vec_lvsl(__a, (unsigned char *)__b));
12272}
12273
12274static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
12275                                                     const float *__b) {
12276  return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12277}
12278
12279static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
12280                                                     const vector float *__b) {
12281  return vec_perm((vector float)(0), vec_ld(__a, __b),
12282                  vec_lvsl(__a, (unsigned char *)__b));
12283}
12284
12285/* vec_lvrxl */
12286
12287static __inline__ vector signed char __ATTRS_o_ai
12288vec_lvrxl(int __a, const signed char *__b) {
12289  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
12290                  vec_lvsl(__a, __b));
12291}
12292
12293static __inline__ vector signed char __ATTRS_o_ai
12294vec_lvrxl(int __a, const vector signed char *__b) {
12295  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
12296                  vec_lvsl(__a, (unsigned char *)__b));
12297}
12298
12299static __inline__ vector unsigned char __ATTRS_o_ai
12300vec_lvrxl(int __a, const unsigned char *__b) {
12301  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
12302                  vec_lvsl(__a, __b));
12303}
12304
12305static __inline__ vector unsigned char __ATTRS_o_ai
12306vec_lvrxl(int __a, const vector unsigned char *__b) {
12307  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
12308                  vec_lvsl(__a, (unsigned char *)__b));
12309}
12310
12311static __inline__ vector bool char __ATTRS_o_ai
12312vec_lvrxl(int __a, const vector bool char *__b) {
12313  return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
12314                  vec_lvsl(__a, (unsigned char *)__b));
12315}
12316
12317static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
12318                                                      const short *__b) {
12319  return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
12320}
12321
12322static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
12323                                                      const vector short *__b) {
12324  return vec_perm((vector short)(0), vec_ldl(__a, __b),
12325                  vec_lvsl(__a, (unsigned char *)__b));
12326}
12327
12328static __inline__ vector unsigned short __ATTRS_o_ai
12329vec_lvrxl(int __a, const unsigned short *__b) {
12330  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
12331                  vec_lvsl(__a, __b));
12332}
12333
12334static __inline__ vector unsigned short __ATTRS_o_ai
12335vec_lvrxl(int __a, const vector unsigned short *__b) {
12336  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
12337                  vec_lvsl(__a, (unsigned char *)__b));
12338}
12339
12340static __inline__ vector bool short __ATTRS_o_ai
12341vec_lvrxl(int __a, const vector bool short *__b) {
12342  return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
12343                  vec_lvsl(__a, (unsigned char *)__b));
12344}
12345
12346static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
12347                                                      const vector pixel *__b) {
12348  return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
12349                  vec_lvsl(__a, (unsigned char *)__b));
12350}
12351
12352static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
12353  return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
12354}
12355
12356static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
12357                                                    const vector int *__b) {
12358  return vec_perm((vector int)(0), vec_ldl(__a, __b),
12359                  vec_lvsl(__a, (unsigned char *)__b));
12360}
12361
12362static __inline__ vector unsigned int __ATTRS_o_ai
12363vec_lvrxl(int __a, const unsigned int *__b) {
12364  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
12365                  vec_lvsl(__a, __b));
12366}
12367
12368static __inline__ vector unsigned int __ATTRS_o_ai
12369vec_lvrxl(int __a, const vector unsigned int *__b) {
12370  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
12371                  vec_lvsl(__a, (unsigned char *)__b));
12372}
12373
12374static __inline__ vector bool int __ATTRS_o_ai
12375vec_lvrxl(int __a, const vector bool int *__b) {
12376  return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
12377                  vec_lvsl(__a, (unsigned char *)__b));
12378}
12379
12380static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
12381                                                      const float *__b) {
12382  return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
12383}
12384
12385static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
12386                                                      const vector float *__b) {
12387  return vec_perm((vector float)(0), vec_ldl(__a, __b),
12388                  vec_lvsl(__a, (unsigned char *)__b));
12389}
12390
12391/* vec_stvlx */
12392
12393static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
12394                                              signed char *__c) {
12395  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12396                __c);
12397}
12398
12399static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
12400                                              vector signed char *__c) {
12401  return vec_st(
12402      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12403      __b, __c);
12404}
12405
12406static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
12407                                              unsigned char *__c) {
12408  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12409                __c);
12410}
12411
12412static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
12413                                              vector unsigned char *__c) {
12414  return vec_st(
12415      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12416      __b, __c);
12417}
12418
12419static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
12420                                              vector bool char *__c) {
12421  return vec_st(
12422      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12423      __b, __c);
12424}
12425
12426static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
12427                                              short *__c) {
12428  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12429                __c);
12430}
12431
12432static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
12433                                              vector short *__c) {
12434  return vec_st(
12435      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12436      __b, __c);
12437}
12438
12439static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
12440                                              int __b, unsigned short *__c) {
12441  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12442                __c);
12443}
12444
12445static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
12446                                              int __b,
12447                                              vector unsigned short *__c) {
12448  return vec_st(
12449      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12450      __b, __c);
12451}
12452
12453static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
12454                                              vector bool short *__c) {
12455  return vec_st(
12456      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12457      __b, __c);
12458}
12459
12460static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
12461                                              vector pixel *__c) {
12462  return vec_st(
12463      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12464      __b, __c);
12465}
12466
12467static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
12468                                              int *__c) {
12469  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12470                __c);
12471}
12472
12473static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
12474                                              vector int *__c) {
12475  return vec_st(
12476      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12477      __b, __c);
12478}
12479
12480static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
12481                                              unsigned int *__c) {
12482  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12483                __c);
12484}
12485
12486static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
12487                                              vector unsigned int *__c) {
12488  return vec_st(
12489      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12490      __b, __c);
12491}
12492
12493static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
12494                                              vector bool int *__c) {
12495  return vec_st(
12496      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12497      __b, __c);
12498}
12499
12500static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
12501                                              vector float *__c) {
12502  return vec_st(
12503      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12504      __b, __c);
12505}
12506
12507/* vec_stvlxl */
12508
12509static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
12510                                               signed char *__c) {
12511  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12512                 __c);
12513}
12514
12515static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
12516                                               vector signed char *__c) {
12517  return vec_stl(
12518      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12519      __b, __c);
12520}
12521
12522static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
12523                                               int __b, unsigned char *__c) {
12524  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12525                 __c);
12526}
12527
12528static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
12529                                               int __b,
12530                                               vector unsigned char *__c) {
12531  return vec_stl(
12532      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12533      __b, __c);
12534}
12535
12536static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
12537                                               vector bool char *__c) {
12538  return vec_stl(
12539      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12540      __b, __c);
12541}
12542
12543static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
12544                                               short *__c) {
12545  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12546                 __c);
12547}
12548
12549static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
12550                                               vector short *__c) {
12551  return vec_stl(
12552      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12553      __b, __c);
12554}
12555
12556static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
12557                                               int __b, unsigned short *__c) {
12558  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12559                 __c);
12560}
12561
12562static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
12563                                               int __b,
12564                                               vector unsigned short *__c) {
12565  return vec_stl(
12566      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12567      __b, __c);
12568}
12569
12570static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
12571                                               vector bool short *__c) {
12572  return vec_stl(
12573      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12574      __b, __c);
12575}
12576
12577static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
12578                                               vector pixel *__c) {
12579  return vec_stl(
12580      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12581      __b, __c);
12582}
12583
12584static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
12585                                               int *__c) {
12586  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12587                 __c);
12588}
12589
12590static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
12591                                               vector int *__c) {
12592  return vec_stl(
12593      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12594      __b, __c);
12595}
12596
12597static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
12598                                               unsigned int *__c) {
12599  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
12600                 __c);
12601}
12602
12603static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
12604                                               vector unsigned int *__c) {
12605  return vec_stl(
12606      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12607      __b, __c);
12608}
12609
12610static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
12611                                               vector bool int *__c) {
12612  return vec_stl(
12613      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12614      __b, __c);
12615}
12616
12617static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
12618                                               vector float *__c) {
12619  return vec_stl(
12620      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
12621      __b, __c);
12622}
12623
12624/* vec_stvrx */
12625
12626static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
12627                                              signed char *__c) {
12628  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12629                __c);
12630}
12631
12632static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
12633                                              vector signed char *__c) {
12634  return vec_st(
12635      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12636      __b, __c);
12637}
12638
12639static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
12640                                              unsigned char *__c) {
12641  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12642                __c);
12643}
12644
12645static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
12646                                              vector unsigned char *__c) {
12647  return vec_st(
12648      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12649      __b, __c);
12650}
12651
12652static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
12653                                              vector bool char *__c) {
12654  return vec_st(
12655      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12656      __b, __c);
12657}
12658
12659static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
12660                                              short *__c) {
12661  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12662                __c);
12663}
12664
12665static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
12666                                              vector short *__c) {
12667  return vec_st(
12668      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12669      __b, __c);
12670}
12671
12672static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
12673                                              int __b, unsigned short *__c) {
12674  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12675                __c);
12676}
12677
12678static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
12679                                              int __b,
12680                                              vector unsigned short *__c) {
12681  return vec_st(
12682      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12683      __b, __c);
12684}
12685
12686static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
12687                                              vector bool short *__c) {
12688  return vec_st(
12689      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12690      __b, __c);
12691}
12692
12693static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
12694                                              vector pixel *__c) {
12695  return vec_st(
12696      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12697      __b, __c);
12698}
12699
12700static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
12701                                              int *__c) {
12702  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12703                __c);
12704}
12705
12706static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
12707                                              vector int *__c) {
12708  return vec_st(
12709      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12710      __b, __c);
12711}
12712
12713static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
12714                                              unsigned int *__c) {
12715  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12716                __c);
12717}
12718
12719static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
12720                                              vector unsigned int *__c) {
12721  return vec_st(
12722      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12723      __b, __c);
12724}
12725
12726static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
12727                                              vector bool int *__c) {
12728  return vec_st(
12729      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12730      __b, __c);
12731}
12732
12733static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
12734                                              vector float *__c) {
12735  return vec_st(
12736      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12737      __b, __c);
12738}
12739
12740/* vec_stvrxl */
12741
12742static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
12743                                               signed char *__c) {
12744  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12745                 __c);
12746}
12747
12748static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
12749                                               vector signed char *__c) {
12750  return vec_stl(
12751      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12752      __b, __c);
12753}
12754
12755static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
12756                                               int __b, unsigned char *__c) {
12757  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12758                 __c);
12759}
12760
12761static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
12762                                               int __b,
12763                                               vector unsigned char *__c) {
12764  return vec_stl(
12765      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12766      __b, __c);
12767}
12768
12769static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
12770                                               vector bool char *__c) {
12771  return vec_stl(
12772      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12773      __b, __c);
12774}
12775
12776static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
12777                                               short *__c) {
12778  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12779                 __c);
12780}
12781
12782static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
12783                                               vector short *__c) {
12784  return vec_stl(
12785      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12786      __b, __c);
12787}
12788
12789static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
12790                                               int __b, unsigned short *__c) {
12791  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12792                 __c);
12793}
12794
12795static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
12796                                               int __b,
12797                                               vector unsigned short *__c) {
12798  return vec_stl(
12799      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12800      __b, __c);
12801}
12802
12803static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
12804                                               vector bool short *__c) {
12805  return vec_stl(
12806      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12807      __b, __c);
12808}
12809
12810static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
12811                                               vector pixel *__c) {
12812  return vec_stl(
12813      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12814      __b, __c);
12815}
12816
12817static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
12818                                               int *__c) {
12819  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12820                 __c);
12821}
12822
12823static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
12824                                               vector int *__c) {
12825  return vec_stl(
12826      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12827      __b, __c);
12828}
12829
12830static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
12831                                               unsigned int *__c) {
12832  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
12833                 __c);
12834}
12835
12836static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
12837                                               vector unsigned int *__c) {
12838  return vec_stl(
12839      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12840      __b, __c);
12841}
12842
12843static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
12844                                               vector bool int *__c) {
12845  return vec_stl(
12846      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12847      __b, __c);
12848}
12849
12850static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
12851                                               vector float *__c) {
12852  return vec_stl(
12853      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
12854      __b, __c);
12855}
12856
12857/* vec_promote */
12858
12859static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
12860                                                              int __b) {
12861  vector signed char __res = (vector signed char)(0);
12862  __res[__b] = __a;
12863  return __res;
12864}
12865
12866static __inline__ vector unsigned char __ATTRS_o_ai
12867vec_promote(unsigned char __a, int __b) {
12868  vector unsigned char __res = (vector unsigned char)(0);
12869  __res[__b] = __a;
12870  return __res;
12871}
12872
12873static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
12874  vector short __res = (vector short)(0);
12875  __res[__b] = __a;
12876  return __res;
12877}
12878
12879static __inline__ vector unsigned short __ATTRS_o_ai
12880vec_promote(unsigned short __a, int __b) {
12881  vector unsigned short __res = (vector unsigned short)(0);
12882  __res[__b] = __a;
12883  return __res;
12884}
12885
12886static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
12887  vector int __res = (vector int)(0);
12888  __res[__b] = __a;
12889  return __res;
12890}
12891
12892static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
12893                                                               int __b) {
12894  vector unsigned int __res = (vector unsigned int)(0);
12895  __res[__b] = __a;
12896  return __res;
12897}
12898
12899static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
12900  vector float __res = (vector float)(0);
12901  __res[__b] = __a;
12902  return __res;
12903}
12904
12905/* vec_splats */
12906
12907static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
12908  return (vector signed char)(__a);
12909}
12910
12911static __inline__ vector unsigned char __ATTRS_o_ai
12912vec_splats(unsigned char __a) {
12913  return (vector unsigned char)(__a);
12914}
12915
12916static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
12917  return (vector short)(__a);
12918}
12919
12920static __inline__ vector unsigned short __ATTRS_o_ai
12921vec_splats(unsigned short __a) {
12922  return (vector unsigned short)(__a);
12923}
12924
12925static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
12926  return (vector int)(__a);
12927}
12928
12929static __inline__ vector unsigned int __ATTRS_o_ai
12930vec_splats(unsigned int __a) {
12931  return (vector unsigned int)(__a);
12932}
12933
12934#ifdef __VSX__
12935static __inline__ vector signed long long __ATTRS_o_ai
12936vec_splats(signed long long __a) {
12937  return (vector signed long long)(__a);
12938}
12939
12940static __inline__ vector unsigned long long __ATTRS_o_ai
12941vec_splats(unsigned long long __a) {
12942  return (vector unsigned long long)(__a);
12943}
12944
12945#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
12946static __inline__ vector signed __int128 __ATTRS_o_ai
12947vec_splats(signed __int128 __a) {
12948  return (vector signed __int128)(__a);
12949}
12950
12951static __inline__ vector unsigned __int128 __ATTRS_o_ai
12952vec_splats(unsigned __int128 __a) {
12953  return (vector unsigned __int128)(__a);
12954}
12955
12956#endif
12957
12958static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
12959  return (vector double)(__a);
12960}
12961#endif
12962
12963static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
12964  return (vector float)(__a);
12965}
12966
12967/* ----------------------------- predicates --------------------------------- */
12968
12969/* vec_all_eq */
12970
12971static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12972                                              vector signed char __b) {
12973  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12974                                      (vector char)__b);
12975}
12976
12977static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12978                                              vector bool char __b) {
12979  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12980                                      (vector char)__b);
12981}
12982
12983static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12984                                              vector unsigned char __b) {
12985  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12986                                      (vector char)__b);
12987}
12988
12989static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12990                                              vector bool char __b) {
12991  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12992                                      (vector char)__b);
12993}
12994
12995static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12996                                              vector signed char __b) {
12997  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12998                                      (vector char)__b);
12999}
13000
13001static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13002                                              vector unsigned char __b) {
13003  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13004                                      (vector char)__b);
13005}
13006
13007static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13008                                              vector bool char __b) {
13009  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13010                                      (vector char)__b);
13011}
13012
13013static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13014                                              vector short __b) {
13015  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13016}
13017
13018static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13019                                              vector bool short __b) {
13020  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13021}
13022
13023static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13024                                              vector unsigned short __b) {
13025  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13026                                      (vector short)__b);
13027}
13028
13029static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13030                                              vector bool short __b) {
13031  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13032                                      (vector short)__b);
13033}
13034
13035static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13036                                              vector short __b) {
13037  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13038                                      (vector short)__b);
13039}
13040
13041static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13042                                              vector unsigned short __b) {
13043  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13044                                      (vector short)__b);
13045}
13046
13047static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13048                                              vector bool short __b) {
13049  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13050                                      (vector short)__b);
13051}
13052
13053static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13054                                              vector pixel __b) {
13055  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13056                                      (vector short)__b);
13057}
13058
13059static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13060  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13061}
13062
13063static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13064                                              vector bool int __b) {
13065  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13066}
13067
13068static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13069                                              vector unsigned int __b) {
13070  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13071                                      (vector int)__b);
13072}
13073
13074static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13075                                              vector bool int __b) {
13076  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13077                                      (vector int)__b);
13078}
13079
13080static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13081                                              vector int __b) {
13082  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13083                                      (vector int)__b);
13084}
13085
13086static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13087                                              vector unsigned int __b) {
13088  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13089                                      (vector int)__b);
13090}
13091
13092static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13093                                              vector bool int __b) {
13094  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13095                                      (vector int)__b);
13096}
13097
13098#ifdef __POWER8_VECTOR__
13099static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13100                                              vector signed long long __b) {
13101  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13102}
13103
13104static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13105                                              vector bool long long __b) {
13106  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13107}
13108
13109static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13110                                              vector unsigned long long __b) {
13111  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13112                                      (vector long long)__b);
13113}
13114
13115static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13116                                              vector bool long long __b) {
13117  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13118                                      (vector long long)__b);
13119}
13120
13121static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13122                                              vector long long __b) {
13123  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13124                                      (vector long long)__b);
13125}
13126
13127static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13128                                              vector unsigned long long __b) {
13129  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13130                                      (vector long long)__b);
13131}
13132
13133static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13134                                              vector bool long long __b) {
13135  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13136                                      (vector long long)__b);
13137}
13138#endif
13139
13140static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13141                                              vector float __b) {
13142#ifdef __VSX__
13143  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13144#else
13145  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13146#endif
13147}
13148
13149#ifdef __VSX__
13150static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13151                                              vector double __b) {
13152  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13153}
13154#endif
13155
13156/* vec_all_ge */
13157
13158static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13159                                              vector signed char __b) {
13160  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13161}
13162
13163static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13164                                              vector bool char __b) {
13165  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13166}
13167
13168static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13169                                              vector unsigned char __b) {
13170  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13171}
13172
13173static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13174                                              vector bool char __b) {
13175  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13176}
13177
13178static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13179                                              vector signed char __b) {
13180  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13181                                      (vector unsigned char)__a);
13182}
13183
13184static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13185                                              vector unsigned char __b) {
13186  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13187}
13188
13189static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13190                                              vector bool char __b) {
13191  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13192                                      (vector unsigned char)__a);
13193}
13194
13195static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13196                                              vector short __b) {
13197  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13198}
13199
13200static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13201                                              vector bool short __b) {
13202  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13203}
13204
13205static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13206                                              vector unsigned short __b) {
13207  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13208}
13209
13210static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13211                                              vector bool short __b) {
13212  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13213                                      __a);
13214}
13215
13216static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13217                                              vector short __b) {
13218  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13219                                      (vector unsigned short)__a);
13220}
13221
13222static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13223                                              vector unsigned short __b) {
13224  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13225                                      (vector unsigned short)__a);
13226}
13227
13228static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13229                                              vector bool short __b) {
13230  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13231                                      (vector unsigned short)__a);
13232}
13233
13234static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13235  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13236}
13237
13238static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13239                                              vector bool int __b) {
13240  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13241}
13242
13243static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13244                                              vector unsigned int __b) {
13245  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13246}
13247
13248static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13249                                              vector bool int __b) {
13250  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
13251}
13252
13253static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
13254                                              vector int __b) {
13255  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
13256                                      (vector unsigned int)__a);
13257}
13258
13259static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
13260                                              vector unsigned int __b) {
13261  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
13262}
13263
13264static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
13265                                              vector bool int __b) {
13266  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
13267                                      (vector unsigned int)__a);
13268}
13269
13270#ifdef __POWER8_VECTOR__
13271static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
13272                                              vector signed long long __b) {
13273  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
13274}
13275static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
13276                                              vector bool long long __b) {
13277  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
13278                                      __a);
13279}
13280
13281static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
13282                                              vector unsigned long long __b) {
13283  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
13284}
13285
13286static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
13287                                              vector bool long long __b) {
13288  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
13289                                      __a);
13290}
13291
13292static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
13293                                              vector signed long long __b) {
13294  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
13295                                      (vector unsigned long long)__a);
13296}
13297
13298static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
13299                                              vector unsigned long long __b) {
13300  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
13301                                      (vector unsigned long long)__a);
13302}
13303
13304static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
13305                                              vector bool long long __b) {
13306  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
13307                                      (vector unsigned long long)__a);
13308}
13309#endif
13310
13311static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
13312                                              vector float __b) {
13313#ifdef __VSX__
13314  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
13315#else
13316  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
13317#endif
13318}
13319
13320#ifdef __VSX__
13321static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
13322                                              vector double __b) {
13323  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
13324}
13325#endif
13326
13327/* vec_all_gt */
13328
13329static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
13330                                              vector signed char __b) {
13331  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
13332}
13333
13334static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
13335                                              vector bool char __b) {
13336  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
13337}
13338
13339static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
13340                                              vector unsigned char __b) {
13341  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
13342}
13343
13344static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
13345                                              vector bool char __b) {
13346  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
13347}
13348
13349static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
13350                                              vector signed char __b) {
13351  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
13352                                      (vector unsigned char)__b);
13353}
13354
13355static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
13356                                              vector unsigned char __b) {
13357  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
13358}
13359
13360static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
13361                                              vector bool char __b) {
13362  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
13363                                      (vector unsigned char)__b);
13364}
13365
13366static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
13367                                              vector short __b) {
13368  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
13369}
13370
13371static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
13372                                              vector bool short __b) {
13373  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
13374}
13375
13376static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
13377                                              vector unsigned short __b) {
13378  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
13379}
13380
13381static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
13382                                              vector bool short __b) {
13383  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
13384                                      (vector unsigned short)__b);
13385}
13386
13387static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
13388                                              vector short __b) {
13389  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
13390                                      (vector unsigned short)__b);
13391}
13392
13393static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
13394                                              vector unsigned short __b) {
13395  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
13396                                      __b);
13397}
13398
13399static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
13400                                              vector bool short __b) {
13401  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
13402                                      (vector unsigned short)__b);
13403}
13404
13405static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
13406  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
13407}
13408
13409static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
13410                                              vector bool int __b) {
13411  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
13412}
13413
13414static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
13415                                              vector unsigned int __b) {
13416  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
13417}
13418
13419static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
13420                                              vector bool int __b) {
13421  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
13422}
13423
13424static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
13425                                              vector int __b) {
13426  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
13427                                      (vector unsigned int)__b);
13428}
13429
13430static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
13431                                              vector unsigned int __b) {
13432  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
13433}
13434
13435static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
13436                                              vector bool int __b) {
13437  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
13438                                      (vector unsigned int)__b);
13439}
13440
13441#ifdef __POWER8_VECTOR__
13442static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
13443                                              vector signed long long __b) {
13444  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
13445}
13446static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
13447                                              vector bool long long __b) {
13448  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
13449                                      (vector signed long long)__b);
13450}
13451
13452static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
13453                                              vector unsigned long long __b) {
13454  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
13455}
13456
13457static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
13458                                              vector bool long long __b) {
13459  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
13460                                      (vector unsigned long long)__b);
13461}
13462
13463static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
13464                                              vector signed long long __b) {
13465  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
13466                                      (vector unsigned long long)__b);
13467}
13468
13469static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
13470                                              vector unsigned long long __b) {
13471  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
13472                                      __b);
13473}
13474
13475static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
13476                                              vector bool long long __b) {
13477  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
13478                                      (vector unsigned long long)__b);
13479}
13480#endif
13481
13482static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
13483                                              vector float __b) {
13484#ifdef __VSX__
13485  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
13486#else
13487  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
13488#endif
13489}
13490
13491#ifdef __VSX__
13492static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
13493                                              vector double __b) {
13494  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
13495}
13496#endif
13497
13498/* vec_all_in */
13499
13500static __inline__ int __attribute__((__always_inline__))
13501vec_all_in(vector float __a, vector float __b) {
13502  return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
13503}
13504
13505/* vec_all_le */
13506
13507static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
13508                                              vector signed char __b) {
13509  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
13510}
13511
13512static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
13513                                              vector bool char __b) {
13514  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
13515}
13516
13517static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
13518                                              vector unsigned char __b) {
13519  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
13520}
13521
13522static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
13523                                              vector bool char __b) {
13524  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
13525}
13526
13527static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
13528                                              vector signed char __b) {
13529  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
13530                                      (vector unsigned char)__b);
13531}
13532
13533static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
13534                                              vector unsigned char __b) {
13535  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
13536}
13537
13538static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
13539                                              vector bool char __b) {
13540  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
13541                                      (vector unsigned char)__b);
13542}
13543
13544static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
13545                                              vector short __b) {
13546  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
13547}
13548
13549static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
13550                                              vector bool short __b) {
13551  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
13552}
13553
13554static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
13555                                              vector unsigned short __b) {
13556  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
13557}
13558
13559static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
13560                                              vector bool short __b) {
13561  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
13562                                      (vector unsigned short)__b);
13563}
13564
13565static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
13566                                              vector short __b) {
13567  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
13568                                      (vector unsigned short)__b);
13569}
13570
13571static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
13572                                              vector unsigned short __b) {
13573  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
13574                                      __b);
13575}
13576
13577static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
13578                                              vector bool short __b) {
13579  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
13580                                      (vector unsigned short)__b);
13581}
13582
13583static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
13584  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
13585}
13586
13587static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
13588                                              vector bool int __b) {
13589  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
13590}
13591
13592static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
13593                                              vector unsigned int __b) {
13594  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
13595}
13596
13597static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
13598                                              vector bool int __b) {
13599  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
13600}
13601
13602static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
13603                                              vector int __b) {
13604  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
13605                                      (vector unsigned int)__b);
13606}
13607
13608static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
13609                                              vector unsigned int __b) {
13610  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
13611}
13612
13613static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
13614                                              vector bool int __b) {
13615  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
13616                                      (vector unsigned int)__b);
13617}
13618
13619#ifdef __POWER8_VECTOR__
13620static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
13621                                              vector signed long long __b) {
13622  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
13623}
13624
13625static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
13626                                              vector unsigned long long __b) {
13627  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
13628}
13629
13630static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
13631                                              vector bool long long __b) {
13632  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
13633                                      (vector signed long long)__b);
13634}
13635
13636static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
13637                                              vector bool long long __b) {
13638  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
13639                                      (vector unsigned long long)__b);
13640}
13641
13642static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
13643                                              vector signed long long __b) {
13644  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
13645                                      (vector unsigned long long)__b);
13646}
13647
13648static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
13649                                              vector unsigned long long __b) {
13650  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
13651                                      __b);
13652}
13653
13654static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
13655                                              vector bool long long __b) {
13656  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
13657                                      (vector unsigned long long)__b);
13658}
13659#endif
13660
13661static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
13662                                              vector float __b) {
13663#ifdef __VSX__
13664  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
13665#else
13666  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
13667#endif
13668}
13669
13670#ifdef __VSX__
13671static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
13672                                              vector double __b) {
13673  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
13674}
13675#endif
13676
13677/* vec_all_lt */
13678
13679static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
13680                                              vector signed char __b) {
13681  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
13682}
13683
13684static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
13685                                              vector bool char __b) {
13686  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
13687}
13688
13689static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
13690                                              vector unsigned char __b) {
13691  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
13692}
13693
13694static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
13695                                              vector bool char __b) {
13696  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
13697}
13698
13699static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
13700                                              vector signed char __b) {
13701  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
13702                                      (vector unsigned char)__a);
13703}
13704
13705static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
13706                                              vector unsigned char __b) {
13707  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
13708}
13709
13710static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
13711                                              vector bool char __b) {
13712  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
13713                                      (vector unsigned char)__a);
13714}
13715
13716static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
13717                                              vector short __b) {
13718  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
13719}
13720
13721static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
13722                                              vector bool short __b) {
13723  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
13724}
13725
13726static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
13727                                              vector unsigned short __b) {
13728  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
13729}
13730
13731static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
13732                                              vector bool short __b) {
13733  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
13734                                      __a);
13735}
13736
13737static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
13738                                              vector short __b) {
13739  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
13740                                      (vector unsigned short)__a);
13741}
13742
13743static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
13744                                              vector unsigned short __b) {
13745  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
13746                                      (vector unsigned short)__a);
13747}
13748
13749static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
13750                                              vector bool short __b) {
13751  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
13752                                      (vector unsigned short)__a);
13753}
13754
13755static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
13756  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
13757}
13758
13759static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
13760                                              vector bool int __b) {
13761  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
13762}
13763
13764static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
13765                                              vector unsigned int __b) {
13766  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
13767}
13768
13769static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
13770                                              vector bool int __b) {
13771  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
13772}
13773
13774static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
13775                                              vector int __b) {
13776  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
13777                                      (vector unsigned int)__a);
13778}
13779
13780static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
13781                                              vector unsigned int __b) {
13782  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
13783}
13784
13785static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
13786                                              vector bool int __b) {
13787  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
13788                                      (vector unsigned int)__a);
13789}
13790
13791#ifdef __POWER8_VECTOR__
13792static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
13793                                              vector signed long long __b) {
13794  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
13795}
13796
13797static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
13798                                              vector unsigned long long __b) {
13799  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
13800}
13801
13802static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
13803                                              vector bool long long __b) {
13804  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
13805                                      __a);
13806}
13807
13808static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
13809                                              vector bool long long __b) {
13810  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
13811                                      __a);
13812}
13813
13814static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
13815                                              vector signed long long __b) {
13816  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
13817                                      (vector unsigned long long)__a);
13818}
13819
13820static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
13821                                              vector unsigned long long __b) {
13822  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
13823                                      (vector unsigned long long)__a);
13824}
13825
13826static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
13827                                              vector bool long long __b) {
13828  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
13829                                      (vector unsigned long long)__a);
13830}
13831#endif
13832
13833static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
13834                                              vector float __b) {
13835#ifdef __VSX__
13836  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
13837#else
13838  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
13839#endif
13840}
13841
13842#ifdef __VSX__
13843static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
13844                                              vector double __b) {
13845  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
13846}
13847#endif
13848
13849/* vec_all_nan */
13850
13851static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
13852#ifdef __VSX__
13853  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
13854#else
13855  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
13856#endif
13857}
13858
13859#ifdef __VSX__
13860static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
13861  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
13862}
13863#endif
13864
13865/* vec_all_ne */
13866
13867static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
13868                                              vector signed char __b) {
13869  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13870                                      (vector char)__b);
13871}
13872
13873static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
13874                                              vector bool char __b) {
13875  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13876                                      (vector char)__b);
13877}
13878
13879static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
13880                                              vector unsigned char __b) {
13881  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13882                                      (vector char)__b);
13883}
13884
13885static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
13886                                              vector bool char __b) {
13887  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13888                                      (vector char)__b);
13889}
13890
13891static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
13892                                              vector signed char __b) {
13893  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13894                                      (vector char)__b);
13895}
13896
13897static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
13898                                              vector unsigned char __b) {
13899  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13900                                      (vector char)__b);
13901}
13902
13903static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
13904                                              vector bool char __b) {
13905  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
13906                                      (vector char)__b);
13907}
13908
13909static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
13910                                              vector short __b) {
13911  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
13912}
13913
13914static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
13915                                              vector bool short __b) {
13916  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
13917}
13918
13919static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
13920                                              vector unsigned short __b) {
13921  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13922                                      (vector short)__b);
13923}
13924
13925static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
13926                                              vector bool short __b) {
13927  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13928                                      (vector short)__b);
13929}
13930
13931static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13932                                              vector short __b) {
13933  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13934                                      (vector short)__b);
13935}
13936
13937static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13938                                              vector unsigned short __b) {
13939  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13940                                      (vector short)__b);
13941}
13942
13943static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13944                                              vector bool short __b) {
13945  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13946                                      (vector short)__b);
13947}
13948
13949static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
13950                                              vector pixel __b) {
13951  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13952                                      (vector short)__b);
13953}
13954
13955static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
13956  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
13957}
13958
13959static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
13960                                              vector bool int __b) {
13961  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
13962}
13963
13964static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13965                                              vector unsigned int __b) {
13966  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13967                                      (vector int)__b);
13968}
13969
13970static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13971                                              vector bool int __b) {
13972  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13973                                      (vector int)__b);
13974}
13975
13976static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13977                                              vector int __b) {
13978  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13979                                      (vector int)__b);
13980}
13981
13982static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13983                                              vector unsigned int __b) {
13984  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13985                                      (vector int)__b);
13986}
13987
13988static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13989                                              vector bool int __b) {
13990  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13991                                      (vector int)__b);
13992}
13993
13994#ifdef __POWER8_VECTOR__
13995static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
13996                                              vector signed long long __b) {
13997  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
13998}
13999
14000static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14001                                              vector unsigned long long __b) {
14002  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14003                                      (vector long long)__b);
14004}
14005
14006static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14007                                              vector bool long long __b) {
14008  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14009                                      (vector signed long long)__b);
14010}
14011
14012static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14013                                              vector bool long long __b) {
14014  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14015                                      (vector signed long long)__b);
14016}
14017
14018static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14019                                              vector signed long long __b) {
14020  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14021                                      (vector signed long long)__b);
14022}
14023
14024static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14025                                              vector unsigned long long __b) {
14026  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14027                                      (vector signed long long)__b);
14028}
14029
14030static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14031                                              vector bool long long __b) {
14032  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14033                                      (vector signed long long)__b);
14034}
14035#endif
14036
14037static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14038                                              vector float __b) {
14039#ifdef __VSX__
14040  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14041#else
14042  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14043#endif
14044}
14045
14046#ifdef __VSX__
14047static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14048                                              vector double __b) {
14049  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14050}
14051#endif
14052
14053/* vec_all_nge */
14054
14055static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14056                                               vector float __b) {
14057#ifdef __VSX__
14058  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14059#else
14060  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14061#endif
14062}
14063
14064#ifdef __VSX__
14065static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14066                                               vector double __b) {
14067  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14068}
14069#endif
14070
14071/* vec_all_ngt */
14072
14073static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14074                                               vector float __b) {
14075#ifdef __VSX__
14076  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14077#else
14078  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14079#endif
14080}
14081
14082#ifdef __VSX__
14083static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14084                                               vector double __b) {
14085  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14086}
14087#endif
14088
14089/* vec_all_nle */
14090
14091static __inline__ int __attribute__((__always_inline__))
14092vec_all_nle(vector float __a, vector float __b) {
14093  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14094}
14095
14096/* vec_all_nlt */
14097
14098static __inline__ int __attribute__((__always_inline__))
14099vec_all_nlt(vector float __a, vector float __b) {
14100  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14101}
14102
14103/* vec_all_numeric */
14104
14105static __inline__ int __attribute__((__always_inline__))
14106vec_all_numeric(vector float __a) {
14107  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14108}
14109
14110/* vec_any_eq */
14111
14112static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14113                                              vector signed char __b) {
14114  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14115                                      (vector char)__b);
14116}
14117
14118static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14119                                              vector bool char __b) {
14120  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14121                                      (vector char)__b);
14122}
14123
14124static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14125                                              vector unsigned char __b) {
14126  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14127                                      (vector char)__b);
14128}
14129
14130static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14131                                              vector bool char __b) {
14132  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14133                                      (vector char)__b);
14134}
14135
14136static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14137                                              vector signed char __b) {
14138  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14139                                      (vector char)__b);
14140}
14141
14142static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14143                                              vector unsigned char __b) {
14144  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14145                                      (vector char)__b);
14146}
14147
14148static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14149                                              vector bool char __b) {
14150  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14151                                      (vector char)__b);
14152}
14153
14154static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14155                                              vector short __b) {
14156  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14157}
14158
14159static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14160                                              vector bool short __b) {
14161  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14162}
14163
14164static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14165                                              vector unsigned short __b) {
14166  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14167                                      (vector short)__b);
14168}
14169
14170static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14171                                              vector bool short __b) {
14172  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14173                                      (vector short)__b);
14174}
14175
14176static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14177                                              vector short __b) {
14178  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14179                                      (vector short)__b);
14180}
14181
14182static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14183                                              vector unsigned short __b) {
14184  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14185                                      (vector short)__b);
14186}
14187
14188static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14189                                              vector bool short __b) {
14190  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14191                                      (vector short)__b);
14192}
14193
14194static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14195                                              vector pixel __b) {
14196  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14197                                      (vector short)__b);
14198}
14199
14200static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14201  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14202}
14203
14204static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14205                                              vector bool int __b) {
14206  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14207}
14208
14209static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14210                                              vector unsigned int __b) {
14211  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14212                                      (vector int)__b);
14213}
14214
14215static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14216                                              vector bool int __b) {
14217  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14218                                      (vector int)__b);
14219}
14220
14221static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14222                                              vector int __b) {
14223  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14224                                      (vector int)__b);
14225}
14226
14227static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14228                                              vector unsigned int __b) {
14229  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14230                                      (vector int)__b);
14231}
14232
14233static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14234                                              vector bool int __b) {
14235  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14236                                      (vector int)__b);
14237}
14238
14239#ifdef __POWER8_VECTOR__
14240static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14241                                              vector signed long long __b) {
14242  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14243}
14244
14245static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14246                                              vector unsigned long long __b) {
14247  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
14248                                      (vector long long)__b);
14249}
14250
14251static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14252                                              vector bool long long __b) {
14253  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
14254                                      (vector signed long long)__b);
14255}
14256
14257static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14258                                              vector bool long long __b) {
14259  return __builtin_altivec_vcmpequd_p(
14260      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
14261}
14262
14263static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
14264                                              vector signed long long __b) {
14265  return __builtin_altivec_vcmpequd_p(
14266      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
14267}
14268
14269static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
14270                                              vector unsigned long long __b) {
14271  return __builtin_altivec_vcmpequd_p(
14272      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
14273}
14274
14275static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
14276                                              vector bool long long __b) {
14277  return __builtin_altivec_vcmpequd_p(
14278      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
14279}
14280#endif
14281
14282static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
14283                                              vector float __b) {
14284#ifdef __VSX__
14285  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
14286#else
14287  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
14288#endif
14289}
14290
14291#ifdef __VSX__
14292static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
14293                                              vector double __b) {
14294  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
14295}
14296#endif
14297
14298/* vec_any_ge */
14299
14300static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
14301                                              vector signed char __b) {
14302  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
14303}
14304
14305static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
14306                                              vector bool char __b) {
14307  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
14308                                      __a);
14309}
14310
14311static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
14312                                              vector unsigned char __b) {
14313  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
14314}
14315
14316static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
14317                                              vector bool char __b) {
14318  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
14319                                      __a);
14320}
14321
14322static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
14323                                              vector signed char __b) {
14324  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
14325                                      (vector unsigned char)__a);
14326}
14327
14328static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
14329                                              vector unsigned char __b) {
14330  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
14331                                      (vector unsigned char)__a);
14332}
14333
14334static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
14335                                              vector bool char __b) {
14336  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
14337                                      (vector unsigned char)__a);
14338}
14339
14340static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
14341                                              vector short __b) {
14342  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
14343}
14344
14345static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
14346                                              vector bool short __b) {
14347  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
14348}
14349
14350static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
14351                                              vector unsigned short __b) {
14352  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
14353}
14354
14355static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
14356                                              vector bool short __b) {
14357  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
14358                                      __a);
14359}
14360
14361static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
14362                                              vector short __b) {
14363  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
14364                                      (vector unsigned short)__a);
14365}
14366
14367static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
14368                                              vector unsigned short __b) {
14369  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
14370                                      (vector unsigned short)__a);
14371}
14372
14373static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
14374                                              vector bool short __b) {
14375  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
14376                                      (vector unsigned short)__a);
14377}
14378
14379static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
14380  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
14381}
14382
14383static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
14384                                              vector bool int __b) {
14385  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
14386}
14387
14388static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
14389                                              vector unsigned int __b) {
14390  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
14391}
14392
14393static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
14394                                              vector bool int __b) {
14395  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
14396                                      __a);
14397}
14398
14399static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
14400                                              vector int __b) {
14401  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
14402                                      (vector unsigned int)__a);
14403}
14404
14405static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
14406                                              vector unsigned int __b) {
14407  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
14408                                      (vector unsigned int)__a);
14409}
14410
14411static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
14412                                              vector bool int __b) {
14413  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
14414                                      (vector unsigned int)__a);
14415}
14416
14417#ifdef __POWER8_VECTOR__
14418static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
14419                                              vector signed long long __b) {
14420  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
14421}
14422
14423static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
14424                                              vector unsigned long long __b) {
14425  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
14426}
14427
14428static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
14429                                              vector bool long long __b) {
14430  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
14431                                      (vector signed long long)__b, __a);
14432}
14433
14434static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
14435                                              vector bool long long __b) {
14436  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14437                                      (vector unsigned long long)__b, __a);
14438}
14439
14440static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
14441                                              vector signed long long __b) {
14442  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14443                                      (vector unsigned long long)__b,
14444                                      (vector unsigned long long)__a);
14445}
14446
14447static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
14448                                              vector unsigned long long __b) {
14449  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
14450                                      (vector unsigned long long)__a);
14451}
14452
14453static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
14454                                              vector bool long long __b) {
14455  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14456                                      (vector unsigned long long)__b,
14457                                      (vector unsigned long long)__a);
14458}
14459#endif
14460
14461static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
14462                                              vector float __b) {
14463#ifdef __VSX__
14464  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
14465#else
14466  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
14467#endif
14468}
14469
14470#ifdef __VSX__
14471static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
14472                                              vector double __b) {
14473  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
14474}
14475#endif
14476
14477/* vec_any_gt */
14478
14479static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
14480                                              vector signed char __b) {
14481  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
14482}
14483
14484static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
14485                                              vector bool char __b) {
14486  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
14487                                      (vector signed char)__b);
14488}
14489
14490static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
14491                                              vector unsigned char __b) {
14492  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
14493}
14494
14495static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
14496                                              vector bool char __b) {
14497  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
14498                                      (vector unsigned char)__b);
14499}
14500
14501static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
14502                                              vector signed char __b) {
14503  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
14504                                      (vector unsigned char)__b);
14505}
14506
14507static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
14508                                              vector unsigned char __b) {
14509  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
14510                                      __b);
14511}
14512
14513static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
14514                                              vector bool char __b) {
14515  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
14516                                      (vector unsigned char)__b);
14517}
14518
14519static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
14520                                              vector short __b) {
14521  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
14522}
14523
14524static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
14525                                              vector bool short __b) {
14526  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
14527}
14528
14529static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
14530                                              vector unsigned short __b) {
14531  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
14532}
14533
14534static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
14535                                              vector bool short __b) {
14536  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
14537                                      (vector unsigned short)__b);
14538}
14539
14540static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
14541                                              vector short __b) {
14542  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
14543                                      (vector unsigned short)__b);
14544}
14545
14546static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
14547                                              vector unsigned short __b) {
14548  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
14549                                      __b);
14550}
14551
14552static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
14553                                              vector bool short __b) {
14554  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
14555                                      (vector unsigned short)__b);
14556}
14557
14558static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
14559  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
14560}
14561
14562static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
14563                                              vector bool int __b) {
14564  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
14565}
14566
14567static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
14568                                              vector unsigned int __b) {
14569  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
14570}
14571
14572static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
14573                                              vector bool int __b) {
14574  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
14575                                      (vector unsigned int)__b);
14576}
14577
14578static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
14579                                              vector int __b) {
14580  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
14581                                      (vector unsigned int)__b);
14582}
14583
14584static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
14585                                              vector unsigned int __b) {
14586  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
14587                                      __b);
14588}
14589
14590static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
14591                                              vector bool int __b) {
14592  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
14593                                      (vector unsigned int)__b);
14594}
14595
14596#ifdef __POWER8_VECTOR__
14597static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
14598                                              vector signed long long __b) {
14599  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
14600}
14601
14602static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
14603                                              vector unsigned long long __b) {
14604  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
14605}
14606
14607static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
14608                                              vector bool long long __b) {
14609  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
14610                                      (vector signed long long)__b);
14611}
14612
14613static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
14614                                              vector bool long long __b) {
14615  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
14616                                      (vector unsigned long long)__b);
14617}
14618
14619static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
14620                                              vector signed long long __b) {
14621  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14622                                      (vector unsigned long long)__a,
14623                                      (vector unsigned long long)__b);
14624}
14625
14626static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
14627                                              vector unsigned long long __b) {
14628  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14629                                      (vector unsigned long long)__a, __b);
14630}
14631
14632static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
14633                                              vector bool long long __b) {
14634  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14635                                      (vector unsigned long long)__a,
14636                                      (vector unsigned long long)__b);
14637}
14638#endif
14639
14640static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
14641                                              vector float __b) {
14642#ifdef __VSX__
14643  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
14644#else
14645  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
14646#endif
14647}
14648
14649#ifdef __VSX__
14650static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
14651                                              vector double __b) {
14652  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
14653}
14654#endif
14655
14656/* vec_any_le */
14657
14658static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
14659                                              vector signed char __b) {
14660  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
14661}
14662
14663static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
14664                                              vector bool char __b) {
14665  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
14666                                      (vector signed char)__b);
14667}
14668
14669static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
14670                                              vector unsigned char __b) {
14671  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
14672}
14673
14674static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
14675                                              vector bool char __b) {
14676  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
14677                                      (vector unsigned char)__b);
14678}
14679
14680static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
14681                                              vector signed char __b) {
14682  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
14683                                      (vector unsigned char)__b);
14684}
14685
14686static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
14687                                              vector unsigned char __b) {
14688  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
14689                                      __b);
14690}
14691
14692static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
14693                                              vector bool char __b) {
14694  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
14695                                      (vector unsigned char)__b);
14696}
14697
14698static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
14699                                              vector short __b) {
14700  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
14701}
14702
14703static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
14704                                              vector bool short __b) {
14705  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
14706}
14707
14708static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
14709                                              vector unsigned short __b) {
14710  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
14711}
14712
14713static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
14714                                              vector bool short __b) {
14715  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
14716                                      (vector unsigned short)__b);
14717}
14718
14719static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
14720                                              vector short __b) {
14721  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
14722                                      (vector unsigned short)__b);
14723}
14724
14725static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
14726                                              vector unsigned short __b) {
14727  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
14728                                      __b);
14729}
14730
14731static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
14732                                              vector bool short __b) {
14733  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
14734                                      (vector unsigned short)__b);
14735}
14736
14737static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
14738  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
14739}
14740
14741static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
14742                                              vector bool int __b) {
14743  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
14744}
14745
14746static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
14747                                              vector unsigned int __b) {
14748  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
14749}
14750
14751static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
14752                                              vector bool int __b) {
14753  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
14754                                      (vector unsigned int)__b);
14755}
14756
14757static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
14758                                              vector int __b) {
14759  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
14760                                      (vector unsigned int)__b);
14761}
14762
14763static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
14764                                              vector unsigned int __b) {
14765  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
14766                                      __b);
14767}
14768
14769static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
14770                                              vector bool int __b) {
14771  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
14772                                      (vector unsigned int)__b);
14773}
14774
14775#ifdef __POWER8_VECTOR__
14776static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
14777                                              vector signed long long __b) {
14778  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
14779}
14780
14781static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
14782                                              vector unsigned long long __b) {
14783  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
14784}
14785
14786static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
14787                                              vector bool long long __b) {
14788  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
14789                                      (vector signed long long)__b);
14790}
14791
14792static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
14793                                              vector bool long long __b) {
14794  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
14795                                      (vector unsigned long long)__b);
14796}
14797
14798static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
14799                                              vector signed long long __b) {
14800  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14801                                      (vector unsigned long long)__a,
14802                                      (vector unsigned long long)__b);
14803}
14804
14805static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
14806                                              vector unsigned long long __b) {
14807  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14808                                      (vector unsigned long long)__a, __b);
14809}
14810
14811static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
14812                                              vector bool long long __b) {
14813  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
14814                                      (vector unsigned long long)__a,
14815                                      (vector unsigned long long)__b);
14816}
14817#endif
14818
14819static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
14820                                              vector float __b) {
14821#ifdef __VSX__
14822  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
14823#else
14824  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
14825#endif
14826}
14827
14828#ifdef __VSX__
14829static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
14830                                              vector double __b) {
14831  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
14832}
14833#endif
14834
14835/* vec_any_lt */
14836
14837static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
14838                                              vector signed char __b) {
14839  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
14840}
14841
14842static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
14843                                              vector bool char __b) {
14844  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
14845                                      __a);
14846}
14847
14848static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
14849                                              vector unsigned char __b) {
14850  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
14851}
14852
14853static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
14854                                              vector bool char __b) {
14855  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
14856                                      __a);
14857}
14858
14859static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
14860                                              vector signed char __b) {
14861  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
14862                                      (vector unsigned char)__a);
14863}
14864
14865static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
14866                                              vector unsigned char __b) {
14867  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
14868                                      (vector unsigned char)__a);
14869}
14870
14871static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
14872                                              vector bool char __b) {
14873  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
14874                                      (vector unsigned char)__a);
14875}
14876
14877static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
14878                                              vector short __b) {
14879  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
14880}
14881
14882static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
14883                                              vector bool short __b) {
14884  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
14885}
14886
14887static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
14888                                              vector unsigned short __b) {
14889  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
14890}
14891
14892static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
14893                                              vector bool short __b) {
14894  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
14895                                      __a);
14896}
14897
14898static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
14899                                              vector short __b) {
14900  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
14901                                      (vector unsigned short)__a);
14902}
14903
14904static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
14905                                              vector unsigned short __b) {
14906  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
14907                                      (vector unsigned short)__a);
14908}
14909
14910static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
14911                                              vector bool short __b) {
14912  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
14913                                      (vector unsigned short)__a);
14914}
14915
14916static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
14917  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
14918}
14919
14920static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
14921                                              vector bool int __b) {
14922  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
14923}
14924
14925static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
14926                                              vector unsigned int __b) {
14927  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
14928}
14929
14930static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
14931                                              vector bool int __b) {
14932  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14933                                      __a);
14934}
14935
14936static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14937                                              vector int __b) {
14938  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14939                                      (vector unsigned int)__a);
14940}
14941
14942static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14943                                              vector unsigned int __b) {
14944  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
14945                                      (vector unsigned int)__a);
14946}
14947
14948static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14949                                              vector bool int __b) {
14950  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14951                                      (vector unsigned int)__a);
14952}
14953
14954#ifdef __POWER8_VECTOR__
14955static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14956                                              vector signed long long __b) {
14957  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
14958}
14959
14960static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14961                                              vector unsigned long long __b) {
14962  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
14963}
14964
14965static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14966                                              vector bool long long __b) {
14967  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
14968                                      (vector signed long long)__b, __a);
14969}
14970
14971static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14972                                              vector bool long long __b) {
14973  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14974                                      (vector unsigned long long)__b, __a);
14975}
14976
14977static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14978                                              vector signed long long __b) {
14979  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14980                                      (vector unsigned long long)__b,
14981                                      (vector unsigned long long)__a);
14982}
14983
14984static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14985                                              vector unsigned long long __b) {
14986  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
14987                                      (vector unsigned long long)__a);
14988}
14989
14990static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14991                                              vector bool long long __b) {
14992  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14993                                      (vector unsigned long long)__b,
14994                                      (vector unsigned long long)__a);
14995}
14996#endif
14997
14998static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
14999                                              vector float __b) {
15000#ifdef __VSX__
15001  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15002#else
15003  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15004#endif
15005}
15006
15007#ifdef __VSX__
15008static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15009                                              vector double __b) {
15010  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15011}
15012#endif
15013
15014/* vec_any_nan */
15015
15016static __inline__ int __attribute__((__always_inline__))
15017vec_any_nan(vector float __a) {
15018  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15019}
15020
15021/* vec_any_ne */
15022
15023static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15024                                              vector signed char __b) {
15025  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15026                                      (vector char)__b);
15027}
15028
15029static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15030                                              vector bool char __b) {
15031  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15032                                      (vector char)__b);
15033}
15034
15035static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15036                                              vector unsigned char __b) {
15037  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15038                                      (vector char)__b);
15039}
15040
15041static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15042                                              vector bool char __b) {
15043  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15044                                      (vector char)__b);
15045}
15046
15047static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15048                                              vector signed char __b) {
15049  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15050                                      (vector char)__b);
15051}
15052
15053static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15054                                              vector unsigned char __b) {
15055  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15056                                      (vector char)__b);
15057}
15058
15059static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15060                                              vector bool char __b) {
15061  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15062                                      (vector char)__b);
15063}
15064
15065static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15066                                              vector short __b) {
15067  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15068}
15069
15070static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15071                                              vector bool short __b) {
15072  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15073}
15074
15075static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15076                                              vector unsigned short __b) {
15077  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15078                                      (vector short)__b);
15079}
15080
15081static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15082                                              vector bool short __b) {
15083  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15084                                      (vector short)__b);
15085}
15086
15087static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15088                                              vector short __b) {
15089  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15090                                      (vector short)__b);
15091}
15092
15093static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15094                                              vector unsigned short __b) {
15095  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15096                                      (vector short)__b);
15097}
15098
15099static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15100                                              vector bool short __b) {
15101  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15102                                      (vector short)__b);
15103}
15104
15105static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15106                                              vector pixel __b) {
15107  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15108                                      (vector short)__b);
15109}
15110
15111static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15112  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15113}
15114
15115static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15116                                              vector bool int __b) {
15117  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15118}
15119
15120static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15121                                              vector unsigned int __b) {
15122  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15123                                      (vector int)__b);
15124}
15125
15126static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15127                                              vector bool int __b) {
15128  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15129                                      (vector int)__b);
15130}
15131
15132static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15133                                              vector int __b) {
15134  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15135                                      (vector int)__b);
15136}
15137
15138static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15139                                              vector unsigned int __b) {
15140  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15141                                      (vector int)__b);
15142}
15143
15144static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15145                                              vector bool int __b) {
15146  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15147                                      (vector int)__b);
15148}
15149
15150#ifdef __POWER8_VECTOR__
15151static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15152                                              vector signed long long __b) {
15153  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15154}
15155
15156static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15157                                              vector unsigned long long __b) {
15158  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15159                                      (vector long long)__b);
15160}
15161
15162static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15163                                              vector bool long long __b) {
15164  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15165                                      (vector signed long long)__b);
15166}
15167
15168static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15169                                              vector bool long long __b) {
15170  return __builtin_altivec_vcmpequd_p(
15171      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15172}
15173
15174static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15175                                              vector signed long long __b) {
15176  return __builtin_altivec_vcmpequd_p(
15177      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15178}
15179
15180static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15181                                              vector unsigned long long __b) {
15182  return __builtin_altivec_vcmpequd_p(
15183      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15184}
15185
15186static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15187                                              vector bool long long __b) {
15188  return __builtin_altivec_vcmpequd_p(
15189      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15190}
15191#endif
15192
15193static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15194                                              vector float __b) {
15195#ifdef __VSX__
15196  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15197#else
15198  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15199#endif
15200}
15201
15202#ifdef __VSX__
15203static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15204                                              vector double __b) {
15205  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15206}
15207#endif
15208
15209/* vec_any_nge */
15210
15211static __inline__ int __attribute__((__always_inline__))
15212vec_any_nge(vector float __a, vector float __b) {
15213  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15214}
15215
15216/* vec_any_ngt */
15217
15218static __inline__ int __attribute__((__always_inline__))
15219vec_any_ngt(vector float __a, vector float __b) {
15220  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15221}
15222
15223/* vec_any_nle */
15224
15225static __inline__ int __attribute__((__always_inline__))
15226vec_any_nle(vector float __a, vector float __b) {
15227  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15228}
15229
15230/* vec_any_nlt */
15231
15232static __inline__ int __attribute__((__always_inline__))
15233vec_any_nlt(vector float __a, vector float __b) {
15234  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15235}
15236
15237/* vec_any_numeric */
15238
15239static __inline__ int __attribute__((__always_inline__))
15240vec_any_numeric(vector float __a) {
15241  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15242}
15243
15244/* vec_any_out */
15245
15246static __inline__ int __attribute__((__always_inline__))
15247vec_any_out(vector float __a, vector float __b) {
15248  return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
15249}
15250
15251/* Power 8 Crypto functions
15252Note: We diverge from the current GCC implementation with regard
15253to cryptography and related functions as follows:
15254- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
15255- The remaining ones are only available on Power8 and up so
15256  require -mpower8-vector
15257The justification for this is that export requirements require that
15258Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
15259support). As a result, we need to be able to turn off support for those.
15260The remaining ones (currently controlled by -mcrypto for GCC) still
15261need to be provided on compliant hardware even if Vector.Crypto is not
15262provided.
15263*/
15264#ifdef __CRYPTO__
15265#define vec_sbox_be __builtin_altivec_crypto_vsbox
15266#define vec_cipher_be __builtin_altivec_crypto_vcipher
15267#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
15268#define vec_ncipher_be __builtin_altivec_crypto_vncipher
15269#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
15270
15271static __inline__ vector unsigned long long __attribute__((__always_inline__))
15272__builtin_crypto_vsbox(vector unsigned long long __a) {
15273  return __builtin_altivec_crypto_vsbox(__a);
15274}
15275
15276static __inline__ vector unsigned long long __attribute__((__always_inline__))
15277__builtin_crypto_vcipher(vector unsigned long long __a,
15278                         vector unsigned long long __b) {
15279  return __builtin_altivec_crypto_vcipher(__a, __b);
15280}
15281
15282static __inline__ vector unsigned long long __attribute__((__always_inline__))
15283__builtin_crypto_vcipherlast(vector unsigned long long __a,
15284                             vector unsigned long long __b) {
15285  return __builtin_altivec_crypto_vcipherlast(__a, __b);
15286}
15287
15288static __inline__ vector unsigned long long __attribute__((__always_inline__))
15289__builtin_crypto_vncipher(vector unsigned long long __a,
15290                          vector unsigned long long __b) {
15291  return __builtin_altivec_crypto_vncipher(__a, __b);
15292}
15293
15294static __inline__ vector unsigned long long __attribute__((__always_inline__))
15295__builtin_crypto_vncipherlast(vector unsigned long long __a,
15296                              vector unsigned long long __b) {
15297  return __builtin_altivec_crypto_vncipherlast(__a, __b);
15298}
15299
15300#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
15301#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
15302
15303#define vec_shasigma_be(X, Y, Z)                                               \
15304  _Generic((X), vector unsigned int                                            \
15305           : __builtin_crypto_vshasigmaw, vector unsigned long long            \
15306           : __builtin_crypto_vshasigmad)((X), (Y), (Z))
15307#endif
15308
15309#ifdef __POWER8_VECTOR__
15310static __inline__ vector unsigned char __ATTRS_o_ai
15311__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
15312                          vector unsigned char __c) {
15313  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
15314}
15315
15316static __inline__ vector unsigned short __ATTRS_o_ai
15317__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
15318                          vector unsigned short __c) {
15319  return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
15320      (vector unsigned char)__a, (vector unsigned char)__b,
15321      (vector unsigned char)__c);
15322}
15323
15324static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
15325    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
15326  return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
15327      (vector unsigned char)__a, (vector unsigned char)__b,
15328      (vector unsigned char)__c);
15329}
15330
15331static __inline__ vector unsigned long long __ATTRS_o_ai
15332__builtin_crypto_vpermxor(vector unsigned long long __a,
15333                          vector unsigned long long __b,
15334                          vector unsigned long long __c) {
15335  return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
15336      (vector unsigned char)__a, (vector unsigned char)__b,
15337      (vector unsigned char)__c);
15338}
15339
15340static __inline__ vector unsigned char __ATTRS_o_ai
15341__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
15342  return __builtin_altivec_crypto_vpmsumb(__a, __b);
15343}
15344
15345static __inline__ vector unsigned short __ATTRS_o_ai
15346__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
15347  return __builtin_altivec_crypto_vpmsumh(__a, __b);
15348}
15349
15350static __inline__ vector unsigned int __ATTRS_o_ai
15351__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
15352  return __builtin_altivec_crypto_vpmsumw(__a, __b);
15353}
15354
15355static __inline__ vector unsigned long long __ATTRS_o_ai
15356__builtin_crypto_vpmsumb(vector unsigned long long __a,
15357                         vector unsigned long long __b) {
15358  return __builtin_altivec_crypto_vpmsumd(__a, __b);
15359}
15360
15361static __inline__ vector signed char __ATTRS_o_ai
15362vec_vgbbd(vector signed char __a) {
15363  return __builtin_altivec_vgbbd((vector unsigned char)__a);
15364}
15365
15366#define vec_pmsum_be __builtin_crypto_vpmsumb
15367#define vec_gb __builtin_altivec_vgbbd
15368
15369static __inline__ vector unsigned char __ATTRS_o_ai
15370vec_vgbbd(vector unsigned char __a) {
15371  return __builtin_altivec_vgbbd(__a);
15372}
15373
15374static __inline__ vector long long __ATTRS_o_ai
15375vec_vbpermq(vector signed char __a, vector signed char __b) {
15376  return __builtin_altivec_vbpermq((vector unsigned char)__a,
15377                                   (vector unsigned char)__b);
15378}
15379
15380static __inline__ vector long long __ATTRS_o_ai
15381vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
15382  return __builtin_altivec_vbpermq(__a, __b);
15383}
15384
15385#ifdef __powerpc64__
15386static __inline__ vector unsigned long long __attribute__((__always_inline__))
15387vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
15388  return __builtin_altivec_vbpermq((vector unsigned char)__a,
15389                                   (vector unsigned char)__b);
15390}
15391#endif
15392#endif
15393
15394
15395/* vec_reve */
15396
15397static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
15398  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
15399                                 5, 4, 3, 2, 1, 0);
15400}
15401
15402static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
15403  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
15404                                 5, 4, 3, 2, 1, 0);
15405}
15406
15407static inline __ATTRS_o_ai vector unsigned char
15408vec_reve(vector unsigned char __a) {
15409  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
15410                                 5, 4, 3, 2, 1, 0);
15411}
15412
15413static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
15414  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
15415}
15416
15417static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
15418  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
15419}
15420
15421static inline __ATTRS_o_ai vector unsigned int
15422vec_reve(vector unsigned int __a) {
15423  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
15424}
15425
15426static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
15427  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
15428}
15429
15430static inline __ATTRS_o_ai vector signed short
15431vec_reve(vector signed short __a) {
15432  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
15433}
15434
15435static inline __ATTRS_o_ai vector unsigned short
15436vec_reve(vector unsigned short __a) {
15437  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
15438}
15439
15440static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
15441  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
15442}
15443
15444#ifdef __VSX__
15445static inline __ATTRS_o_ai vector bool long long
15446vec_reve(vector bool long long __a) {
15447  return __builtin_shufflevector(__a, __a, 1, 0);
15448}
15449
15450static inline __ATTRS_o_ai vector signed long long
15451vec_reve(vector signed long long __a) {
15452  return __builtin_shufflevector(__a, __a, 1, 0);
15453}
15454
15455static inline __ATTRS_o_ai vector unsigned long long
15456vec_reve(vector unsigned long long __a) {
15457  return __builtin_shufflevector(__a, __a, 1, 0);
15458}
15459
15460static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
15461  return __builtin_shufflevector(__a, __a, 1, 0);
15462}
15463#endif
15464
15465/* vec_revb */
15466static __inline__ vector bool char __ATTRS_o_ai
15467vec_revb(vector bool char __a) {
15468  return __a;
15469}
15470
15471static __inline__ vector signed char __ATTRS_o_ai
15472vec_revb(vector signed char __a) {
15473  return __a;
15474}
15475
15476static __inline__ vector unsigned char __ATTRS_o_ai
15477vec_revb(vector unsigned char __a) {
15478  return __a;
15479}
15480
15481static __inline__ vector bool short __ATTRS_o_ai
15482vec_revb(vector bool short __a) {
15483  vector unsigned char __indices =
15484      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
15485  return vec_perm(__a, __a, __indices);
15486}
15487
15488static __inline__ vector signed short __ATTRS_o_ai
15489vec_revb(vector signed short __a) {
15490  vector unsigned char __indices =
15491      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
15492  return vec_perm(__a, __a, __indices);
15493}
15494
15495static __inline__ vector unsigned short __ATTRS_o_ai
15496vec_revb(vector unsigned short __a) {
15497  vector unsigned char __indices =
15498     { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
15499  return vec_perm(__a, __a, __indices);
15500}
15501
15502static __inline__ vector bool int __ATTRS_o_ai
15503vec_revb(vector bool int __a) {
15504  vector unsigned char __indices =
15505      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
15506  return vec_perm(__a, __a, __indices);
15507}
15508
15509static __inline__ vector signed int __ATTRS_o_ai
15510vec_revb(vector signed int __a) {
15511  vector unsigned char __indices =
15512      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
15513  return vec_perm(__a, __a, __indices);
15514}
15515
15516static __inline__ vector unsigned int __ATTRS_o_ai
15517vec_revb(vector unsigned int __a) {
15518  vector unsigned char __indices =
15519      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
15520  return vec_perm(__a, __a, __indices);
15521}
15522
15523static __inline__ vector float __ATTRS_o_ai
15524vec_revb(vector float __a) {
15525 vector unsigned char __indices =
15526      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
15527 return vec_perm(__a, __a, __indices);
15528}
15529
15530#ifdef __VSX__
15531static __inline__ vector bool long long __ATTRS_o_ai
15532vec_revb(vector bool long long __a) {
15533  vector unsigned char __indices =
15534      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
15535  return vec_perm(__a, __a, __indices);
15536}
15537
15538static __inline__ vector signed long long __ATTRS_o_ai
15539vec_revb(vector signed long long __a) {
15540  vector unsigned char __indices =
15541      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
15542  return vec_perm(__a, __a, __indices);
15543}
15544
15545static __inline__ vector unsigned long long __ATTRS_o_ai
15546vec_revb(vector unsigned long long __a) {
15547  vector unsigned char __indices =
15548      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
15549  return vec_perm(__a, __a, __indices);
15550}
15551
15552static __inline__ vector double __ATTRS_o_ai
15553vec_revb(vector double __a) {
15554  vector unsigned char __indices =
15555      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
15556  return vec_perm(__a, __a, __indices);
15557}
15558#endif /* End __VSX__ */
15559
15560#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
15561static __inline__ vector signed __int128 __ATTRS_o_ai
15562vec_revb(vector signed __int128 __a) {
15563  vector unsigned char __indices =
15564      { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
15565  return (vector signed __int128)vec_perm((vector signed int)__a,
15566                                          (vector signed int)__a,
15567                                           __indices);
15568}
15569
15570static __inline__ vector unsigned __int128 __ATTRS_o_ai
15571vec_revb(vector unsigned __int128 __a) {
15572  vector unsigned char __indices =
15573      { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
15574  return (vector unsigned __int128)vec_perm((vector signed int)__a,
15575                                            (vector signed int)__a,
15576                                             __indices);
15577}
15578#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
15579
15580#undef __ATTRS_o_ai
15581
15582#endif /* __ALTIVEC_H */
15583