clang 23.0.0git
altivec.h
Go to the documentation of this file.
1/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7\*===----------------------------------------------------------------------===*/
8
9#ifndef __ALTIVEC_H
10#define __ALTIVEC_H
11
12#ifndef __ALTIVEC__
13#error "AltiVec support not enabled"
14#endif
15
16/* Constants for mapping CR6 bits to predicate result. */
17
18#define __CR6_EQ 0
19#define __CR6_EQ_REV 1
20#define __CR6_LT 2
21#define __CR6_LT_REV 3
22#define __CR6_GT 4
23#define __CR6_GT_REV 5
24#define __CR6_SO 6
25#define __CR6_SO_REV 7
26
27/* Constants for vec_test_data_class */
28#define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
29#define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
30#define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
31 __VEC_CLASS_FP_SUBNORMAL_N)
32#define __VEC_CLASS_FP_ZERO_N (1<<2)
33#define __VEC_CLASS_FP_ZERO_P (1<<3)
34#define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \
35 __VEC_CLASS_FP_ZERO_N)
36#define __VEC_CLASS_FP_INFINITY_N (1<<4)
37#define __VEC_CLASS_FP_INFINITY_P (1<<5)
38#define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \
39 __VEC_CLASS_FP_INFINITY_N)
40#define __VEC_CLASS_FP_NAN (1<<6)
41#define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \
42 __VEC_CLASS_FP_SUBNORMAL | \
43 __VEC_CLASS_FP_ZERO | \
44 __VEC_CLASS_FP_INFINITY)
45
46#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
47
48#include <stddef.h>
49
50static __inline__ vector signed char __ATTRS_o_ai vec_perm(
51 vector signed char __a, vector signed char __b, vector unsigned char __c);
52
53static __inline__ vector unsigned char __ATTRS_o_ai
54vec_perm(vector unsigned char __a, vector unsigned char __b,
55 vector unsigned char __c);
56
57static __inline__ vector bool char __ATTRS_o_ai
58vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
59
60static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
61 vector signed short __b,
62 vector unsigned char __c);
63
64static __inline__ vector unsigned short __ATTRS_o_ai
65vec_perm(vector unsigned short __a, vector unsigned short __b,
66 vector unsigned char __c);
67
68static __inline__ vector bool short __ATTRS_o_ai vec_perm(
69 vector bool short __a, vector bool short __b, vector unsigned char __c);
70
71static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
72 vector pixel __b,
73 vector unsigned char __c);
74
75static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
76 vector signed int __b,
77 vector unsigned char __c);
78
79static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
80 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
81
82static __inline__ vector bool int __ATTRS_o_ai
83vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
84
85static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
86 vector float __b,
87 vector unsigned char __c);
88
89#ifdef __VSX__
90static __inline__ vector long long __ATTRS_o_ai
91vec_perm(vector signed long long __a, vector signed long long __b,
92 vector unsigned char __c);
93
94static __inline__ vector unsigned long long __ATTRS_o_ai
95vec_perm(vector unsigned long long __a, vector unsigned long long __b,
96 vector unsigned char __c);
97
98static __inline__ vector bool long long __ATTRS_o_ai
99vec_perm(vector bool long long __a, vector bool long long __b,
100 vector unsigned char __c);
101
102static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
103 vector double __b,
104 vector unsigned char __c);
105#endif
106
107static __inline__ vector unsigned char __ATTRS_o_ai
108vec_xor(vector unsigned char __a, vector unsigned char __b);
109
110/* vec_abs */
111
112#define __builtin_altivec_abs_v16qi vec_abs
113#define __builtin_altivec_abs_v8hi vec_abs
114#define __builtin_altivec_abs_v4si vec_abs
115
116static __inline__ vector signed char __ATTRS_o_ai
117vec_abs(vector signed char __a) {
118 return __builtin_altivec_vmaxsb(__a, -__a);
119}
120
121static __inline__ vector signed short __ATTRS_o_ai
122vec_abs(vector signed short __a) {
123 return __builtin_altivec_vmaxsh(__a, -__a);
124}
125
126static __inline__ vector signed int __ATTRS_o_ai
127vec_abs(vector signed int __a) {
128 return __builtin_altivec_vmaxsw(__a, -__a);
129}
130
131#ifdef __POWER8_VECTOR__
132static __inline__ vector signed long long __ATTRS_o_ai
133vec_abs(vector signed long long __a) {
134 return __builtin_altivec_vmaxsd(__a, -__a);
135}
136#endif
137
138static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
139#ifdef __VSX__
140 return __builtin_vsx_xvabssp(__a);
141#else
142 vector unsigned int __res =
143 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
144 return (vector float)__res;
145#endif
146}
147
148#ifdef __VSX__
149static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
150 return __builtin_vsx_xvabsdp(__a);
151}
152#endif
153
154/* vec_abss */
155#define __builtin_altivec_abss_v16qi vec_abss
156#define __builtin_altivec_abss_v8hi vec_abss
157#define __builtin_altivec_abss_v4si vec_abss
158
159static __inline__ vector signed char __ATTRS_o_ai
160vec_abss(vector signed char __a) {
161 return __builtin_altivec_vmaxsb(
162 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
163}
164
165static __inline__ vector signed short __ATTRS_o_ai
166vec_abss(vector signed short __a) {
167 return __builtin_altivec_vmaxsh(
168 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
169}
170
171static __inline__ vector signed int __ATTRS_o_ai
172vec_abss(vector signed int __a) {
173 return __builtin_altivec_vmaxsw(
174 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
175}
176
177/* vec_absd */
178#if defined(__POWER9_VECTOR__)
179
180static __inline__ vector unsigned char __ATTRS_o_ai
181vec_absd(vector unsigned char __a, vector unsigned char __b) {
182 return __builtin_altivec_vabsdub(__a, __b);
183}
184
185static __inline__ vector unsigned short __ATTRS_o_ai
186vec_absd(vector unsigned short __a, vector unsigned short __b) {
187 return __builtin_altivec_vabsduh(__a, __b);
188}
189
190static __inline__ vector unsigned int __ATTRS_o_ai
191vec_absd(vector unsigned int __a, vector unsigned int __b) {
192 return __builtin_altivec_vabsduw(__a, __b);
193}
194
195#endif /* End __POWER9_VECTOR__ */
196
197/* vec_add */
198
199static __inline__ vector signed char __ATTRS_o_ai
200vec_add(vector signed char __a, vector signed char __b) {
201 return __a + __b;
202}
203
204static __inline__ vector signed char __ATTRS_o_ai
205vec_add(vector bool char __a, vector signed char __b) {
206 return (vector signed char)__a + __b;
207}
208
209static __inline__ vector signed char __ATTRS_o_ai
210vec_add(vector signed char __a, vector bool char __b) {
211 return __a + (vector signed char)__b;
212}
213
214static __inline__ vector unsigned char __ATTRS_o_ai
215vec_add(vector unsigned char __a, vector unsigned char __b) {
216 return __a + __b;
217}
218
219static __inline__ vector unsigned char __ATTRS_o_ai
220vec_add(vector bool char __a, vector unsigned char __b) {
221 return (vector unsigned char)__a + __b;
222}
223
224static __inline__ vector unsigned char __ATTRS_o_ai
225vec_add(vector unsigned char __a, vector bool char __b) {
226 return __a + (vector unsigned char)__b;
227}
228
229static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
230 vector short __b) {
231 return __a + __b;
232}
233
234static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
235 vector short __b) {
236 return (vector short)__a + __b;
237}
238
239static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
240 vector bool short __b) {
241 return __a + (vector short)__b;
242}
243
244static __inline__ vector unsigned short __ATTRS_o_ai
245vec_add(vector unsigned short __a, vector unsigned short __b) {
246 return __a + __b;
247}
248
249static __inline__ vector unsigned short __ATTRS_o_ai
250vec_add(vector bool short __a, vector unsigned short __b) {
251 return (vector unsigned short)__a + __b;
252}
253
254static __inline__ vector unsigned short __ATTRS_o_ai
255vec_add(vector unsigned short __a, vector bool short __b) {
256 return __a + (vector unsigned short)__b;
257}
258
259static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
260 vector int __b) {
261 return __a + __b;
262}
263
264static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
265 vector int __b) {
266 return (vector int)__a + __b;
267}
268
269static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
270 vector bool int __b) {
271 return __a + (vector int)__b;
272}
273
274static __inline__ vector unsigned int __ATTRS_o_ai
275vec_add(vector unsigned int __a, vector unsigned int __b) {
276 return __a + __b;
277}
278
279static __inline__ vector unsigned int __ATTRS_o_ai
280vec_add(vector bool int __a, vector unsigned int __b) {
281 return (vector unsigned int)__a + __b;
282}
283
284static __inline__ vector unsigned int __ATTRS_o_ai
285vec_add(vector unsigned int __a, vector bool int __b) {
286 return __a + (vector unsigned int)__b;
287}
288
289#ifdef __POWER8_VECTOR__
290static __inline__ vector signed long long __ATTRS_o_ai
291vec_add(vector signed long long __a, vector signed long long __b) {
292 return __a + __b;
293}
294
295static __inline__ vector unsigned long long __ATTRS_o_ai
296vec_add(vector unsigned long long __a, vector unsigned long long __b) {
297 return __a + __b;
298}
299
300#ifdef __SIZEOF_INT128__
301static __inline__ vector signed __int128 __ATTRS_o_ai
302vec_add(vector signed __int128 __a, vector signed __int128 __b) {
303 return __a + __b;
304}
305
306static __inline__ vector unsigned __int128 __ATTRS_o_ai
307vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
308 return __a + __b;
309}
310#endif
311
312static __inline__ vector unsigned char __attribute__((__always_inline__))
313vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
314 return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
315}
316#elif defined(__VSX__)
317static __inline__ vector signed long long __ATTRS_o_ai
318vec_add(vector signed long long __a, vector signed long long __b) {
319#ifdef __LITTLE_ENDIAN__
320 // Little endian systems on CPU's prior to Power8 don't really exist
321 // so scalarizing is fine.
322 return __a + __b;
323#else
324 vector unsigned int __res =
325 (vector unsigned int)__a + (vector unsigned int)__b;
326 vector unsigned int __carry = __builtin_altivec_vaddcuw(
327 (vector unsigned int)__a, (vector unsigned int)__b);
328 __carry = (vector unsigned int)__builtin_shufflevector(
329 (vector unsigned char)__carry, (vector unsigned char)__carry, 0, 0, 0, 7,
330 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
331 return (vector signed long long)(__res + __carry);
332#endif
333}
334
335static __inline__ vector unsigned long long __ATTRS_o_ai
336vec_add(vector unsigned long long __a, vector unsigned long long __b) {
337 return (vector unsigned long long)vec_add((vector signed long long)__a,
338 (vector signed long long)__b);
339}
340#endif // __POWER8_VECTOR__
341
342static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
343 vector float __b) {
344 return __a + __b;
345}
346
347#ifdef __VSX__
348static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
349 vector double __b) {
350 return __a + __b;
351}
352#endif // __VSX__
353
354/* vec_adde */
355
356#ifdef __POWER8_VECTOR__
357#ifdef __SIZEOF_INT128__
358static __inline__ vector signed __int128 __ATTRS_o_ai
359vec_adde(vector signed __int128 __a, vector signed __int128 __b,
360 vector signed __int128 __c) {
361 return (vector signed __int128)__builtin_altivec_vaddeuqm(
362 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
363 (vector unsigned __int128)__c);
364}
365
366static __inline__ vector unsigned __int128 __ATTRS_o_ai
367vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
368 vector unsigned __int128 __c) {
369 return __builtin_altivec_vaddeuqm(__a, __b, __c);
370}
371#endif
372
373static __inline__ vector unsigned char __attribute__((__always_inline__))
374vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
375 vector unsigned char __c) {
376 return (vector unsigned char)__builtin_altivec_vaddeuqm_c(
377 (vector unsigned char)__a, (vector unsigned char)__b,
378 (vector unsigned char)__c);
379}
380#endif
381
382static __inline__ vector signed int __ATTRS_o_ai
383vec_adde(vector signed int __a, vector signed int __b,
384 vector signed int __c) {
385 vector signed int __mask = {1, 1, 1, 1};
386 vector signed int __carry = __c & __mask;
387 return vec_add(vec_add(__a, __b), __carry);
388}
389
390static __inline__ vector unsigned int __ATTRS_o_ai
391vec_adde(vector unsigned int __a, vector unsigned int __b,
392 vector unsigned int __c) {
393 vector unsigned int __mask = {1, 1, 1, 1};
394 vector unsigned int __carry = __c & __mask;
395 return vec_add(vec_add(__a, __b), __carry);
396}
397
398/* vec_addec */
399
400#ifdef __POWER8_VECTOR__
401#ifdef __SIZEOF_INT128__
402static __inline__ vector signed __int128 __ATTRS_o_ai
403vec_addec(vector signed __int128 __a, vector signed __int128 __b,
404 vector signed __int128 __c) {
405 return (vector signed __int128)__builtin_altivec_vaddecuq(
406 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
407 (vector unsigned __int128)__c);
408}
409
410static __inline__ vector unsigned __int128 __ATTRS_o_ai
411vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
412 vector unsigned __int128 __c) {
413 return __builtin_altivec_vaddecuq(__a, __b, __c);
414}
415#endif
416
417static __inline__ vector unsigned char __attribute__((__always_inline__))
418vec_addec_u128(vector unsigned char __a, vector unsigned char __b,
419 vector unsigned char __c) {
420 return (vector unsigned char)__builtin_altivec_vaddecuq_c(
421 (vector unsigned char)__a, (vector unsigned char)__b,
422 (vector unsigned char)__c);
423}
424
425#ifdef __powerpc64__
426static __inline__ vector signed int __ATTRS_o_ai
427vec_addec(vector signed int __a, vector signed int __b,
428 vector signed int __c) {
429
430 signed int __result[4];
431 for (int i = 0; i < 4; i++) {
432 unsigned int __tempa = (unsigned int) __a[i];
433 unsigned int __tempb = (unsigned int) __b[i];
434 unsigned int __tempc = (unsigned int) __c[i];
435 __tempc = __tempc & 0x00000001;
436 unsigned long long __longa = (unsigned long long) __tempa;
437 unsigned long long __longb = (unsigned long long) __tempb;
438 unsigned long long __longc = (unsigned long long) __tempc;
439 unsigned long long __sum = __longa + __longb + __longc;
440 unsigned long long __res = (__sum >> 32) & 0x01;
441 unsigned long long __tempres = (unsigned int) __res;
442 __result[i] = (signed int) __tempres;
443 }
444
445 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
446 return ret;
447}
448
449static __inline__ vector unsigned int __ATTRS_o_ai
450vec_addec(vector unsigned int __a, vector unsigned int __b,
451 vector unsigned int __c) {
452
453 unsigned int __result[4];
454 for (int i = 0; i < 4; i++) {
455 unsigned int __tempc = __c[i] & 1;
456 unsigned long long __longa = (unsigned long long) __a[i];
457 unsigned long long __longb = (unsigned long long) __b[i];
458 unsigned long long __longc = (unsigned long long) __tempc;
459 unsigned long long __sum = __longa + __longb + __longc;
460 unsigned long long __res = (__sum >> 32) & 0x01;
461 unsigned long long __tempres = (unsigned int) __res;
462 __result[i] = (signed int) __tempres;
463 }
464
465 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
466 return ret;
467}
468#endif // __powerpc64__
469#endif // __POWER8_VECTOR__
470
471/* vec_vaddubm */
472
473#define __builtin_altivec_vaddubm vec_vaddubm
474
475static __inline__ vector signed char __ATTRS_o_ai
476vec_vaddubm(vector signed char __a, vector signed char __b) {
477 return __a + __b;
478}
479
480static __inline__ vector signed char __ATTRS_o_ai
481vec_vaddubm(vector bool char __a, vector signed char __b) {
482 return (vector signed char)__a + __b;
483}
484
485static __inline__ vector signed char __ATTRS_o_ai
486vec_vaddubm(vector signed char __a, vector bool char __b) {
487 return __a + (vector signed char)__b;
488}
489
490static __inline__ vector unsigned char __ATTRS_o_ai
491vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
492 return __a + __b;
493}
494
495static __inline__ vector unsigned char __ATTRS_o_ai
496vec_vaddubm(vector bool char __a, vector unsigned char __b) {
497 return (vector unsigned char)__a + __b;
498}
499
500static __inline__ vector unsigned char __ATTRS_o_ai
501vec_vaddubm(vector unsigned char __a, vector bool char __b) {
502 return __a + (vector unsigned char)__b;
503}
504
505/* vec_vadduhm */
506
507#define __builtin_altivec_vadduhm vec_vadduhm
508
509static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
510 vector short __b) {
511 return __a + __b;
512}
513
514static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
515 vector short __b) {
516 return (vector short)__a + __b;
517}
518
519static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
520 vector bool short __b) {
521 return __a + (vector short)__b;
522}
523
524static __inline__ vector unsigned short __ATTRS_o_ai
525vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
526 return __a + __b;
527}
528
529static __inline__ vector unsigned short __ATTRS_o_ai
530vec_vadduhm(vector bool short __a, vector unsigned short __b) {
531 return (vector unsigned short)__a + __b;
532}
533
534static __inline__ vector unsigned short __ATTRS_o_ai
535vec_vadduhm(vector unsigned short __a, vector bool short __b) {
536 return __a + (vector unsigned short)__b;
537}
538
539/* vec_vadduwm */
540
541#define __builtin_altivec_vadduwm vec_vadduwm
542
543static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
544 vector int __b) {
545 return __a + __b;
546}
547
548static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
549 vector int __b) {
550 return (vector int)__a + __b;
551}
552
553static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
554 vector bool int __b) {
555 return __a + (vector int)__b;
556}
557
558static __inline__ vector unsigned int __ATTRS_o_ai
559vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
560 return __a + __b;
561}
562
563static __inline__ vector unsigned int __ATTRS_o_ai
564vec_vadduwm(vector bool int __a, vector unsigned int __b) {
565 return (vector unsigned int)__a + __b;
566}
567
568static __inline__ vector unsigned int __ATTRS_o_ai
569vec_vadduwm(vector unsigned int __a, vector bool int __b) {
570 return __a + (vector unsigned int)__b;
571}
572
573/* vec_vaddfp */
574
575#define __builtin_altivec_vaddfp vec_vaddfp
576
577static __inline__ vector float __attribute__((__always_inline__))
578vec_vaddfp(vector float __a, vector float __b) {
579 return __a + __b;
580}
581
582/* vec_addc */
583
584static __inline__ vector signed int __ATTRS_o_ai
585vec_addc(vector signed int __a, vector signed int __b) {
586 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
587 (vector unsigned int)__b);
588}
589
590static __inline__ vector unsigned int __ATTRS_o_ai
591vec_addc(vector unsigned int __a, vector unsigned int __b) {
592 return __builtin_altivec_vaddcuw(__a, __b);
593}
594
595#ifdef __POWER8_VECTOR__
596#ifdef __SIZEOF_INT128__
597static __inline__ vector signed __int128 __ATTRS_o_ai
598vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
599 return (vector signed __int128)__builtin_altivec_vaddcuq(
600 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
601}
602
603static __inline__ vector unsigned __int128 __ATTRS_o_ai
604vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
605 return __builtin_altivec_vaddcuq(__a, __b);
606}
607#endif
608
609static __inline__ vector unsigned char __attribute__((__always_inline__))
610vec_addc_u128(vector unsigned char __a, vector unsigned char __b) {
611 return (vector unsigned char)__builtin_altivec_vaddcuq_c(
612 (vector unsigned char)__a, (vector unsigned char)__b);
613}
614#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
615
616/* vec_vaddcuw */
617
618static __inline__ vector unsigned int __attribute__((__always_inline__))
619vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
620 return __builtin_altivec_vaddcuw(__a, __b);
621}
622
623/* vec_adds */
624
625static __inline__ vector signed char __ATTRS_o_ai
626vec_adds(vector signed char __a, vector signed char __b) {
627 return __builtin_altivec_vaddsbs(__a, __b);
628}
629
630static __inline__ vector signed char __ATTRS_o_ai
631vec_adds(vector bool char __a, vector signed char __b) {
632 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
633}
634
635static __inline__ vector signed char __ATTRS_o_ai
636vec_adds(vector signed char __a, vector bool char __b) {
637 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
638}
639
640static __inline__ vector unsigned char __ATTRS_o_ai
641vec_adds(vector unsigned char __a, vector unsigned char __b) {
642 return __builtin_altivec_vaddubs(__a, __b);
643}
644
645static __inline__ vector unsigned char __ATTRS_o_ai
646vec_adds(vector bool char __a, vector unsigned char __b) {
647 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
648}
649
650static __inline__ vector unsigned char __ATTRS_o_ai
651vec_adds(vector unsigned char __a, vector bool char __b) {
652 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
653}
654
655static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
656 vector short __b) {
657 return __builtin_altivec_vaddshs(__a, __b);
658}
659
660static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
661 vector short __b) {
662 return __builtin_altivec_vaddshs((vector short)__a, __b);
663}
664
665static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
666 vector bool short __b) {
667 return __builtin_altivec_vaddshs(__a, (vector short)__b);
668}
669
670static __inline__ vector unsigned short __ATTRS_o_ai
671vec_adds(vector unsigned short __a, vector unsigned short __b) {
672 return __builtin_altivec_vadduhs(__a, __b);
673}
674
675static __inline__ vector unsigned short __ATTRS_o_ai
676vec_adds(vector bool short __a, vector unsigned short __b) {
677 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
678}
679
680static __inline__ vector unsigned short __ATTRS_o_ai
681vec_adds(vector unsigned short __a, vector bool short __b) {
682 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
683}
684
685static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
686 vector int __b) {
687 return __builtin_altivec_vaddsws(__a, __b);
688}
689
690static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
691 vector int __b) {
692 return __builtin_altivec_vaddsws((vector int)__a, __b);
693}
694
695static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
696 vector bool int __b) {
697 return __builtin_altivec_vaddsws(__a, (vector int)__b);
698}
699
700static __inline__ vector unsigned int __ATTRS_o_ai
701vec_adds(vector unsigned int __a, vector unsigned int __b) {
702 return __builtin_altivec_vadduws(__a, __b);
703}
704
705static __inline__ vector unsigned int __ATTRS_o_ai
706vec_adds(vector bool int __a, vector unsigned int __b) {
707 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
708}
709
710static __inline__ vector unsigned int __ATTRS_o_ai
711vec_adds(vector unsigned int __a, vector bool int __b) {
712 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
713}
714
715/* vec_vaddsbs */
716
717static __inline__ vector signed char __ATTRS_o_ai
718vec_vaddsbs(vector signed char __a, vector signed char __b) {
719 return __builtin_altivec_vaddsbs(__a, __b);
720}
721
722static __inline__ vector signed char __ATTRS_o_ai
723vec_vaddsbs(vector bool char __a, vector signed char __b) {
724 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
725}
726
727static __inline__ vector signed char __ATTRS_o_ai
728vec_vaddsbs(vector signed char __a, vector bool char __b) {
729 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
730}
731
732/* vec_vaddubs */
733
734static __inline__ vector unsigned char __ATTRS_o_ai
735vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
736 return __builtin_altivec_vaddubs(__a, __b);
737}
738
739static __inline__ vector unsigned char __ATTRS_o_ai
740vec_vaddubs(vector bool char __a, vector unsigned char __b) {
741 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
742}
743
744static __inline__ vector unsigned char __ATTRS_o_ai
745vec_vaddubs(vector unsigned char __a, vector bool char __b) {
746 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
747}
748
749/* vec_vaddshs */
750
751static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
752 vector short __b) {
753 return __builtin_altivec_vaddshs(__a, __b);
754}
755
756static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
757 vector short __b) {
758 return __builtin_altivec_vaddshs((vector short)__a, __b);
759}
760
761static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
762 vector bool short __b) {
763 return __builtin_altivec_vaddshs(__a, (vector short)__b);
764}
765
766/* vec_vadduhs */
767
768static __inline__ vector unsigned short __ATTRS_o_ai
769vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
770 return __builtin_altivec_vadduhs(__a, __b);
771}
772
773static __inline__ vector unsigned short __ATTRS_o_ai
774vec_vadduhs(vector bool short __a, vector unsigned short __b) {
775 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
776}
777
778static __inline__ vector unsigned short __ATTRS_o_ai
779vec_vadduhs(vector unsigned short __a, vector bool short __b) {
780 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
781}
782
783/* vec_vaddsws */
784
785static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
786 vector int __b) {
787 return __builtin_altivec_vaddsws(__a, __b);
788}
789
790static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
791 vector int __b) {
792 return __builtin_altivec_vaddsws((vector int)__a, __b);
793}
794
795static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
796 vector bool int __b) {
797 return __builtin_altivec_vaddsws(__a, (vector int)__b);
798}
799
800/* vec_vadduws */
801
802static __inline__ vector unsigned int __ATTRS_o_ai
803vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
804 return __builtin_altivec_vadduws(__a, __b);
805}
806
807static __inline__ vector unsigned int __ATTRS_o_ai
808vec_vadduws(vector bool int __a, vector unsigned int __b) {
809 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
810}
811
812static __inline__ vector unsigned int __ATTRS_o_ai
813vec_vadduws(vector unsigned int __a, vector bool int __b) {
814 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
815}
816
817#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
818 defined(__SIZEOF_INT128__)
819/* vec_vadduqm */
820
821static __inline__ vector signed __int128 __ATTRS_o_ai
822vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
823 return __a + __b;
824}
825
826static __inline__ vector unsigned __int128 __ATTRS_o_ai
827vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
828 return __a + __b;
829}
830
831/* vec_vaddeuqm */
832
833static __inline__ vector signed __int128 __ATTRS_o_ai
834vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
835 vector signed __int128 __c) {
836 return (vector signed __int128)__builtin_altivec_vaddeuqm(
837 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
838 (vector unsigned __int128)__c);
839}
840
841static __inline__ vector unsigned __int128 __ATTRS_o_ai
842vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
843 vector unsigned __int128 __c) {
844 return __builtin_altivec_vaddeuqm(__a, __b, __c);
845}
846
847/* vec_vaddcuq */
848
849static __inline__ vector signed __int128 __ATTRS_o_ai
850vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
851 return (vector signed __int128)__builtin_altivec_vaddcuq(
852 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
853}
854
855static __inline__ vector unsigned __int128 __ATTRS_o_ai
856vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
857 return __builtin_altivec_vaddcuq(__a, __b);
858}
859
860/* vec_vaddecuq */
861
862static __inline__ vector signed __int128 __ATTRS_o_ai
863vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
864 vector signed __int128 __c) {
865 return (vector signed __int128)__builtin_altivec_vaddecuq(
866 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
867 (vector unsigned __int128)__c);
868}
869
870static __inline__ vector unsigned __int128 __ATTRS_o_ai
871vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
872 vector unsigned __int128 __c) {
873 return __builtin_altivec_vaddecuq(__a, __b, __c);
874}
875#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
876
877/* vec_and */
878
879#define __builtin_altivec_vand vec_and
880
881static __inline__ vector signed char __ATTRS_o_ai
882vec_and(vector signed char __a, vector signed char __b) {
883 return __a & __b;
884}
885
886static __inline__ vector signed char __ATTRS_o_ai
887vec_and(vector bool char __a, vector signed char __b) {
888 return (vector signed char)__a & __b;
889}
890
891static __inline__ vector signed char __ATTRS_o_ai
892vec_and(vector signed char __a, vector bool char __b) {
893 return __a & (vector signed char)__b;
894}
895
896static __inline__ vector unsigned char __ATTRS_o_ai
897vec_and(vector unsigned char __a, vector unsigned char __b) {
898 return __a & __b;
899}
900
901static __inline__ vector unsigned char __ATTRS_o_ai
902vec_and(vector bool char __a, vector unsigned char __b) {
903 return (vector unsigned char)__a & __b;
904}
905
906static __inline__ vector unsigned char __ATTRS_o_ai
907vec_and(vector unsigned char __a, vector bool char __b) {
908 return __a & (vector unsigned char)__b;
909}
910
911static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
912 vector bool char __b) {
913 return __a & __b;
914}
915
916static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
917 vector short __b) {
918 return __a & __b;
919}
920
921static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
922 vector short __b) {
923 return (vector short)__a & __b;
924}
925
926static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
927 vector bool short __b) {
928 return __a & (vector short)__b;
929}
930
931static __inline__ vector unsigned short __ATTRS_o_ai
932vec_and(vector unsigned short __a, vector unsigned short __b) {
933 return __a & __b;
934}
935
936static __inline__ vector unsigned short __ATTRS_o_ai
937vec_and(vector bool short __a, vector unsigned short __b) {
938 return (vector unsigned short)__a & __b;
939}
940
941static __inline__ vector unsigned short __ATTRS_o_ai
942vec_and(vector unsigned short __a, vector bool short __b) {
943 return __a & (vector unsigned short)__b;
944}
945
946static __inline__ vector bool short __ATTRS_o_ai
947vec_and(vector bool short __a, vector bool short __b) {
948 return __a & __b;
949}
950
951static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
952 vector int __b) {
953 return __a & __b;
954}
955
956static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
957 vector int __b) {
958 return (vector int)__a & __b;
959}
960
961static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
962 vector bool int __b) {
963 return __a & (vector int)__b;
964}
965
966static __inline__ vector unsigned int __ATTRS_o_ai
967vec_and(vector unsigned int __a, vector unsigned int __b) {
968 return __a & __b;
969}
970
971static __inline__ vector unsigned int __ATTRS_o_ai
972vec_and(vector bool int __a, vector unsigned int __b) {
973 return (vector unsigned int)__a & __b;
974}
975
976static __inline__ vector unsigned int __ATTRS_o_ai
977vec_and(vector unsigned int __a, vector bool int __b) {
978 return __a & (vector unsigned int)__b;
979}
980
981static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
982 vector bool int __b) {
983 return __a & __b;
984}
985
986static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
987 vector float __b) {
988 vector unsigned int __res =
989 (vector unsigned int)__a & (vector unsigned int)__b;
990 return (vector float)__res;
991}
992
993static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
994 vector float __b) {
995 vector unsigned int __res =
996 (vector unsigned int)__a & (vector unsigned int)__b;
997 return (vector float)__res;
998}
999
1000static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
1001 vector bool int __b) {
1002 vector unsigned int __res =
1003 (vector unsigned int)__a & (vector unsigned int)__b;
1004 return (vector float)__res;
1005}
1006
1007#ifdef __VSX__
1008static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
1009 vector double __b) {
1010 vector unsigned long long __res =
1011 (vector unsigned long long)__a & (vector unsigned long long)__b;
1012 return (vector double)__res;
1013}
1014
1015static __inline__ vector double __ATTRS_o_ai
1016vec_and(vector double __a, vector bool long long __b) {
1017 vector unsigned long long __res =
1018 (vector unsigned long long)__a & (vector unsigned long long)__b;
1019 return (vector double)__res;
1020}
1021
1022static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
1023 vector double __b) {
1024 vector unsigned long long __res =
1025 (vector unsigned long long)__a & (vector unsigned long long)__b;
1026 return (vector double)__res;
1027}
1028
1029static __inline__ vector signed long long __ATTRS_o_ai
1030vec_and(vector signed long long __a, vector signed long long __b) {
1031 return __a & __b;
1032}
1033
1034static __inline__ vector signed long long __ATTRS_o_ai
1035vec_and(vector bool long long __a, vector signed long long __b) {
1036 return (vector signed long long)__a & __b;
1037}
1038
1039static __inline__ vector signed long long __ATTRS_o_ai
1040vec_and(vector signed long long __a, vector bool long long __b) {
1041 return __a & (vector signed long long)__b;
1042}
1043
1044static __inline__ vector unsigned long long __ATTRS_o_ai
1045vec_and(vector unsigned long long __a, vector unsigned long long __b) {
1046 return __a & __b;
1047}
1048
1049static __inline__ vector unsigned long long __ATTRS_o_ai
1050vec_and(vector bool long long __a, vector unsigned long long __b) {
1051 return (vector unsigned long long)__a & __b;
1052}
1053
1054static __inline__ vector unsigned long long __ATTRS_o_ai
1055vec_and(vector unsigned long long __a, vector bool long long __b) {
1056 return __a & (vector unsigned long long)__b;
1057}
1058
1059static __inline__ vector bool long long __ATTRS_o_ai
1060vec_and(vector bool long long __a, vector bool long long __b) {
1061 return __a & __b;
1062}
1063#endif
1064
1065/* vec_vand */
1066
1067static __inline__ vector signed char __ATTRS_o_ai
1068vec_vand(vector signed char __a, vector signed char __b) {
1069 return __a & __b;
1070}
1071
1072static __inline__ vector signed char __ATTRS_o_ai
1073vec_vand(vector bool char __a, vector signed char __b) {
1074 return (vector signed char)__a & __b;
1075}
1076
1077static __inline__ vector signed char __ATTRS_o_ai
1078vec_vand(vector signed char __a, vector bool char __b) {
1079 return __a & (vector signed char)__b;
1080}
1081
1082static __inline__ vector unsigned char __ATTRS_o_ai
1083vec_vand(vector unsigned char __a, vector unsigned char __b) {
1084 return __a & __b;
1085}
1086
1087static __inline__ vector unsigned char __ATTRS_o_ai
1088vec_vand(vector bool char __a, vector unsigned char __b) {
1089 return (vector unsigned char)__a & __b;
1090}
1091
1092static __inline__ vector unsigned char __ATTRS_o_ai
1093vec_vand(vector unsigned char __a, vector bool char __b) {
1094 return __a & (vector unsigned char)__b;
1095}
1096
1097static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1098 vector bool char __b) {
1099 return __a & __b;
1100}
1101
1102static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1103 vector short __b) {
1104 return __a & __b;
1105}
1106
1107static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1108 vector short __b) {
1109 return (vector short)__a & __b;
1110}
1111
1112static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1113 vector bool short __b) {
1114 return __a & (vector short)__b;
1115}
1116
1117static __inline__ vector unsigned short __ATTRS_o_ai
1118vec_vand(vector unsigned short __a, vector unsigned short __b) {
1119 return __a & __b;
1120}
1121
1122static __inline__ vector unsigned short __ATTRS_o_ai
1123vec_vand(vector bool short __a, vector unsigned short __b) {
1124 return (vector unsigned short)__a & __b;
1125}
1126
1127static __inline__ vector unsigned short __ATTRS_o_ai
1128vec_vand(vector unsigned short __a, vector bool short __b) {
1129 return __a & (vector unsigned short)__b;
1130}
1131
1132static __inline__ vector bool short __ATTRS_o_ai
1133vec_vand(vector bool short __a, vector bool short __b) {
1134 return __a & __b;
1135}
1136
1137static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1138 vector int __b) {
1139 return __a & __b;
1140}
1141
1142static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1143 vector int __b) {
1144 return (vector int)__a & __b;
1145}
1146
1147static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1148 vector bool int __b) {
1149 return __a & (vector int)__b;
1150}
1151
1152static __inline__ vector unsigned int __ATTRS_o_ai
1153vec_vand(vector unsigned int __a, vector unsigned int __b) {
1154 return __a & __b;
1155}
1156
1157static __inline__ vector unsigned int __ATTRS_o_ai
1158vec_vand(vector bool int __a, vector unsigned int __b) {
1159 return (vector unsigned int)__a & __b;
1160}
1161
1162static __inline__ vector unsigned int __ATTRS_o_ai
1163vec_vand(vector unsigned int __a, vector bool int __b) {
1164 return __a & (vector unsigned int)__b;
1165}
1166
1167static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1168 vector bool int __b) {
1169 return __a & __b;
1170}
1171
1172static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1173 vector float __b) {
1174 vector unsigned int __res =
1175 (vector unsigned int)__a & (vector unsigned int)__b;
1176 return (vector float)__res;
1177}
1178
1179static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1180 vector float __b) {
1181 vector unsigned int __res =
1182 (vector unsigned int)__a & (vector unsigned int)__b;
1183 return (vector float)__res;
1184}
1185
1186static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1187 vector bool int __b) {
1188 vector unsigned int __res =
1189 (vector unsigned int)__a & (vector unsigned int)__b;
1190 return (vector float)__res;
1191}
1192
1193#ifdef __VSX__
1194static __inline__ vector signed long long __ATTRS_o_ai
1195vec_vand(vector signed long long __a, vector signed long long __b) {
1196 return __a & __b;
1197}
1198
1199static __inline__ vector signed long long __ATTRS_o_ai
1200vec_vand(vector bool long long __a, vector signed long long __b) {
1201 return (vector signed long long)__a & __b;
1202}
1203
1204static __inline__ vector signed long long __ATTRS_o_ai
1205vec_vand(vector signed long long __a, vector bool long long __b) {
1206 return __a & (vector signed long long)__b;
1207}
1208
1209static __inline__ vector unsigned long long __ATTRS_o_ai
1210vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1211 return __a & __b;
1212}
1213
1214static __inline__ vector unsigned long long __ATTRS_o_ai
1215vec_vand(vector bool long long __a, vector unsigned long long __b) {
1216 return (vector unsigned long long)__a & __b;
1217}
1218
1219static __inline__ vector unsigned long long __ATTRS_o_ai
1220vec_vand(vector unsigned long long __a, vector bool long long __b) {
1221 return __a & (vector unsigned long long)__b;
1222}
1223
1224static __inline__ vector bool long long __ATTRS_o_ai
1225vec_vand(vector bool long long __a, vector bool long long __b) {
1226 return __a & __b;
1227}
1228#endif
1229
1230/* vec_andc */
1231
1232#define __builtin_altivec_vandc vec_andc
1233
1234static __inline__ vector signed char __ATTRS_o_ai
1235vec_andc(vector signed char __a, vector signed char __b) {
1236 return __a & ~__b;
1237}
1238
1239static __inline__ vector signed char __ATTRS_o_ai
1240vec_andc(vector bool char __a, vector signed char __b) {
1241 return (vector signed char)__a & ~__b;
1242}
1243
1244static __inline__ vector signed char __ATTRS_o_ai
1245vec_andc(vector signed char __a, vector bool char __b) {
1246 return __a & ~(vector signed char)__b;
1247}
1248
1249static __inline__ vector unsigned char __ATTRS_o_ai
1250vec_andc(vector unsigned char __a, vector unsigned char __b) {
1251 return __a & ~__b;
1252}
1253
1254static __inline__ vector unsigned char __ATTRS_o_ai
1255vec_andc(vector bool char __a, vector unsigned char __b) {
1256 return (vector unsigned char)__a & ~__b;
1257}
1258
1259static __inline__ vector unsigned char __ATTRS_o_ai
1260vec_andc(vector unsigned char __a, vector bool char __b) {
1261 return __a & ~(vector unsigned char)__b;
1262}
1263
1264static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1265 vector bool char __b) {
1266 return __a & ~__b;
1267}
1268
1269static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1270 vector short __b) {
1271 return __a & ~__b;
1272}
1273
1274static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1275 vector short __b) {
1276 return (vector short)__a & ~__b;
1277}
1278
1279static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1280 vector bool short __b) {
1281 return __a & ~(vector short)__b;
1282}
1283
1284static __inline__ vector unsigned short __ATTRS_o_ai
1285vec_andc(vector unsigned short __a, vector unsigned short __b) {
1286 return __a & ~__b;
1287}
1288
1289static __inline__ vector unsigned short __ATTRS_o_ai
1290vec_andc(vector bool short __a, vector unsigned short __b) {
1291 return (vector unsigned short)__a & ~__b;
1292}
1293
1294static __inline__ vector unsigned short __ATTRS_o_ai
1295vec_andc(vector unsigned short __a, vector bool short __b) {
1296 return __a & ~(vector unsigned short)__b;
1297}
1298
1299static __inline__ vector bool short __ATTRS_o_ai
1300vec_andc(vector bool short __a, vector bool short __b) {
1301 return __a & ~__b;
1302}
1303
1304static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1305 vector int __b) {
1306 return __a & ~__b;
1307}
1308
1309static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1310 vector int __b) {
1311 return (vector int)__a & ~__b;
1312}
1313
1314static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1315 vector bool int __b) {
1316 return __a & ~(vector int)__b;
1317}
1318
1319static __inline__ vector unsigned int __ATTRS_o_ai
1320vec_andc(vector unsigned int __a, vector unsigned int __b) {
1321 return __a & ~__b;
1322}
1323
1324static __inline__ vector unsigned int __ATTRS_o_ai
1325vec_andc(vector bool int __a, vector unsigned int __b) {
1326 return (vector unsigned int)__a & ~__b;
1327}
1328
1329static __inline__ vector unsigned int __ATTRS_o_ai
1330vec_andc(vector unsigned int __a, vector bool int __b) {
1331 return __a & ~(vector unsigned int)__b;
1332}
1333
1334static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1335 vector bool int __b) {
1336 return __a & ~__b;
1337}
1338
1339static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1340 vector float __b) {
1341 vector unsigned int __res =
1342 (vector unsigned int)__a & ~(vector unsigned int)__b;
1343 return (vector float)__res;
1344}
1345
1346static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1347 vector float __b) {
1348 vector unsigned int __res =
1349 (vector unsigned int)__a & ~(vector unsigned int)__b;
1350 return (vector float)__res;
1351}
1352
1353static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1354 vector bool int __b) {
1355 vector unsigned int __res =
1356 (vector unsigned int)__a & ~(vector unsigned int)__b;
1357 return (vector float)__res;
1358}
1359
1360#ifdef __VSX__
1361static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1362 vector double __b) {
1363 vector unsigned long long __res =
1364 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1365 return (vector double)__res;
1366}
1367
1368static __inline__ vector double __ATTRS_o_ai
1369vec_andc(vector double __a, vector bool long long __b) {
1370 vector unsigned long long __res =
1371 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1372 return (vector double)__res;
1373}
1374
1375static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1376 vector double __b) {
1377 vector unsigned long long __res =
1378 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1379 return (vector double)__res;
1380}
1381
1382static __inline__ vector signed long long __ATTRS_o_ai
1383vec_andc(vector signed long long __a, vector signed long long __b) {
1384 return __a & ~__b;
1385}
1386
1387static __inline__ vector signed long long __ATTRS_o_ai
1388vec_andc(vector bool long long __a, vector signed long long __b) {
1389 return (vector signed long long)__a & ~__b;
1390}
1391
1392static __inline__ vector signed long long __ATTRS_o_ai
1393vec_andc(vector signed long long __a, vector bool long long __b) {
1394 return __a & ~(vector signed long long)__b;
1395}
1396
1397static __inline__ vector unsigned long long __ATTRS_o_ai
1398vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1399 return __a & ~__b;
1400}
1401
1402static __inline__ vector unsigned long long __ATTRS_o_ai
1403vec_andc(vector bool long long __a, vector unsigned long long __b) {
1404 return (vector unsigned long long)__a & ~__b;
1405}
1406
1407static __inline__ vector unsigned long long __ATTRS_o_ai
1408vec_andc(vector unsigned long long __a, vector bool long long __b) {
1409 return __a & ~(vector unsigned long long)__b;
1410}
1411
1412static __inline__ vector bool long long __ATTRS_o_ai
1413vec_andc(vector bool long long __a, vector bool long long __b) {
1414 return __a & ~__b;
1415}
1416#endif
1417
1418/* vec_vandc */
1419
1420static __inline__ vector signed char __ATTRS_o_ai
1421vec_vandc(vector signed char __a, vector signed char __b) {
1422 return __a & ~__b;
1423}
1424
1425static __inline__ vector signed char __ATTRS_o_ai
1426vec_vandc(vector bool char __a, vector signed char __b) {
1427 return (vector signed char)__a & ~__b;
1428}
1429
1430static __inline__ vector signed char __ATTRS_o_ai
1431vec_vandc(vector signed char __a, vector bool char __b) {
1432 return __a & ~(vector signed char)__b;
1433}
1434
1435static __inline__ vector unsigned char __ATTRS_o_ai
1436vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1437 return __a & ~__b;
1438}
1439
1440static __inline__ vector unsigned char __ATTRS_o_ai
1441vec_vandc(vector bool char __a, vector unsigned char __b) {
1442 return (vector unsigned char)__a & ~__b;
1443}
1444
1445static __inline__ vector unsigned char __ATTRS_o_ai
1446vec_vandc(vector unsigned char __a, vector bool char __b) {
1447 return __a & ~(vector unsigned char)__b;
1448}
1449
1450static __inline__ vector bool char __ATTRS_o_ai
1451vec_vandc(vector bool char __a, vector bool char __b) {
1452 return __a & ~__b;
1453}
1454
1455static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1456 vector short __b) {
1457 return __a & ~__b;
1458}
1459
1460static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1461 vector short __b) {
1462 return (vector short)__a & ~__b;
1463}
1464
1465static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1466 vector bool short __b) {
1467 return __a & ~(vector short)__b;
1468}
1469
1470static __inline__ vector unsigned short __ATTRS_o_ai
1471vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1472 return __a & ~__b;
1473}
1474
1475static __inline__ vector unsigned short __ATTRS_o_ai
1476vec_vandc(vector bool short __a, vector unsigned short __b) {
1477 return (vector unsigned short)__a & ~__b;
1478}
1479
1480static __inline__ vector unsigned short __ATTRS_o_ai
1481vec_vandc(vector unsigned short __a, vector bool short __b) {
1482 return __a & ~(vector unsigned short)__b;
1483}
1484
1485static __inline__ vector bool short __ATTRS_o_ai
1486vec_vandc(vector bool short __a, vector bool short __b) {
1487 return __a & ~__b;
1488}
1489
1490static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1491 vector int __b) {
1492 return __a & ~__b;
1493}
1494
1495static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1496 vector int __b) {
1497 return (vector int)__a & ~__b;
1498}
1499
1500static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1501 vector bool int __b) {
1502 return __a & ~(vector int)__b;
1503}
1504
1505static __inline__ vector unsigned int __ATTRS_o_ai
1506vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1507 return __a & ~__b;
1508}
1509
1510static __inline__ vector unsigned int __ATTRS_o_ai
1511vec_vandc(vector bool int __a, vector unsigned int __b) {
1512 return (vector unsigned int)__a & ~__b;
1513}
1514
1515static __inline__ vector unsigned int __ATTRS_o_ai
1516vec_vandc(vector unsigned int __a, vector bool int __b) {
1517 return __a & ~(vector unsigned int)__b;
1518}
1519
1520static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1521 vector bool int __b) {
1522 return __a & ~__b;
1523}
1524
1525static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1526 vector float __b) {
1527 vector unsigned int __res =
1528 (vector unsigned int)__a & ~(vector unsigned int)__b;
1529 return (vector float)__res;
1530}
1531
1532static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1533 vector float __b) {
1534 vector unsigned int __res =
1535 (vector unsigned int)__a & ~(vector unsigned int)__b;
1536 return (vector float)__res;
1537}
1538
1539static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1540 vector bool int __b) {
1541 vector unsigned int __res =
1542 (vector unsigned int)__a & ~(vector unsigned int)__b;
1543 return (vector float)__res;
1544}
1545
1546#ifdef __VSX__
1547static __inline__ vector signed long long __ATTRS_o_ai
1548vec_vandc(vector signed long long __a, vector signed long long __b) {
1549 return __a & ~__b;
1550}
1551
1552static __inline__ vector signed long long __ATTRS_o_ai
1553vec_vandc(vector bool long long __a, vector signed long long __b) {
1554 return (vector signed long long)__a & ~__b;
1555}
1556
1557static __inline__ vector signed long long __ATTRS_o_ai
1558vec_vandc(vector signed long long __a, vector bool long long __b) {
1559 return __a & ~(vector signed long long)__b;
1560}
1561
1562static __inline__ vector unsigned long long __ATTRS_o_ai
1563vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1564 return __a & ~__b;
1565}
1566
1567static __inline__ vector unsigned long long __ATTRS_o_ai
1568vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1569 return (vector unsigned long long)__a & ~__b;
1570}
1571
1572static __inline__ vector unsigned long long __ATTRS_o_ai
1573vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1574 return __a & ~(vector unsigned long long)__b;
1575}
1576
1577static __inline__ vector bool long long __ATTRS_o_ai
1578vec_vandc(vector bool long long __a, vector bool long long __b) {
1579 return __a & ~__b;
1580}
1581#endif
1582
1583/* vec_avg */
1584
1585static __inline__ vector signed char __ATTRS_o_ai
1586vec_avg(vector signed char __a, vector signed char __b) {
1587 return __builtin_altivec_vavgsb(__a, __b);
1588}
1589
1590static __inline__ vector unsigned char __ATTRS_o_ai
1591vec_avg(vector unsigned char __a, vector unsigned char __b) {
1592 return __builtin_altivec_vavgub(__a, __b);
1593}
1594
1595static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1596 vector short __b) {
1597 return __builtin_altivec_vavgsh(__a, __b);
1598}
1599
1600static __inline__ vector unsigned short __ATTRS_o_ai
1601vec_avg(vector unsigned short __a, vector unsigned short __b) {
1602 return __builtin_altivec_vavguh(__a, __b);
1603}
1604
1605static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1606 vector int __b) {
1607 return __builtin_altivec_vavgsw(__a, __b);
1608}
1609
1610static __inline__ vector unsigned int __ATTRS_o_ai
1611vec_avg(vector unsigned int __a, vector unsigned int __b) {
1612 return __builtin_altivec_vavguw(__a, __b);
1613}
1614
1615/* vec_vavgsb */
1616
1617static __inline__ vector signed char __attribute__((__always_inline__))
1618vec_vavgsb(vector signed char __a, vector signed char __b) {
1619 return __builtin_altivec_vavgsb(__a, __b);
1620}
1621
1622/* vec_vavgub */
1623
1624static __inline__ vector unsigned char __attribute__((__always_inline__))
1625vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1626 return __builtin_altivec_vavgub(__a, __b);
1627}
1628
1629/* vec_vavgsh */
1630
1631static __inline__ vector short __attribute__((__always_inline__))
1632vec_vavgsh(vector short __a, vector short __b) {
1633 return __builtin_altivec_vavgsh(__a, __b);
1634}
1635
1636/* vec_vavguh */
1637
1638static __inline__ vector unsigned short __attribute__((__always_inline__))
1639vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1640 return __builtin_altivec_vavguh(__a, __b);
1641}
1642
1643/* vec_vavgsw */
1644
1645static __inline__ vector int __attribute__((__always_inline__))
1646vec_vavgsw(vector int __a, vector int __b) {
1647 return __builtin_altivec_vavgsw(__a, __b);
1648}
1649
1650/* vec_vavguw */
1651
1652static __inline__ vector unsigned int __attribute__((__always_inline__))
1653vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1654 return __builtin_altivec_vavguw(__a, __b);
1655}
1656
1657/* vec_ceil */
1658
1659static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1660#ifdef __VSX__
1661 return __builtin_vsx_xvrspip(__a);
1662#else
1663 return __builtin_altivec_vrfip(__a);
1664#endif
1665}
1666
1667#ifdef __VSX__
1668static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1669 return __builtin_vsx_xvrdpip(__a);
1670}
1671#endif
1672
1673/* vec_roundp */
1674static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) {
1675 return vec_ceil(__a);
1676}
1677
1678#ifdef __VSX__
1679static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) {
1680 return vec_ceil(__a);
1681}
1682#endif
1683
1684/* vec_vrfip */
1685
1686static __inline__ vector float __attribute__((__always_inline__))
1687vec_vrfip(vector float __a) {
1688 return __builtin_altivec_vrfip(__a);
1689}
1690
1691/* vec_cmpb */
1692
1693static __inline__ vector int __attribute__((__always_inline__))
1694vec_cmpb(vector float __a, vector float __b) {
1695 return __builtin_altivec_vcmpbfp(__a, __b);
1696}
1697
1698/* vec_vcmpbfp */
1699
1700static __inline__ vector int __attribute__((__always_inline__))
1701vec_vcmpbfp(vector float __a, vector float __b) {
1702 return __builtin_altivec_vcmpbfp(__a, __b);
1703}
1704
1705/* vec_cmpeq */
1706
1707static __inline__ vector bool char __ATTRS_o_ai
1708vec_cmpeq(vector signed char __a, vector signed char __b) {
1709 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1710 (vector char)__b);
1711}
1712
1713static __inline__ vector bool char __ATTRS_o_ai
1714vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1715 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1716 (vector char)__b);
1717}
1718
1719static __inline__ vector bool char __ATTRS_o_ai
1720vec_cmpeq(vector bool char __a, vector bool char __b) {
1721 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1722 (vector char)__b);
1723}
1724
1725static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1726 vector short __b) {
1727 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1728}
1729
1730static __inline__ vector bool short __ATTRS_o_ai
1731vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1732 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1733 (vector short)__b);
1734}
1735
1736static __inline__ vector bool short __ATTRS_o_ai
1737vec_cmpeq(vector bool short __a, vector bool short __b) {
1738 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1739 (vector short)__b);
1740}
1741
1742static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1743 vector int __b) {
1744 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1745}
1746
1747static __inline__ vector bool int __ATTRS_o_ai
1748vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1749 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1750 (vector int)__b);
1751}
1752
1753static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1754 vector bool int __b) {
1755 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1756 (vector int)__b);
1757}
1758
1759#ifdef __POWER8_VECTOR__
1760static __inline__ vector bool long long __ATTRS_o_ai
1761vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1762 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1763}
1764
1765static __inline__ vector bool long long __ATTRS_o_ai
1766vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1767 return (vector bool long long)__builtin_altivec_vcmpequd(
1768 (vector long long)__a, (vector long long)__b);
1769}
1770
1771static __inline__ vector bool long long __ATTRS_o_ai
1772vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1773 return (vector bool long long)__builtin_altivec_vcmpequd(
1774 (vector long long)__a, (vector long long)__b);
1775}
1776#elif defined(__VSX__)
1777static __inline__ vector bool long long __ATTRS_o_ai
1778vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1779 vector bool int __wordcmp =
1780 vec_cmpeq((vector signed int)__a, (vector signed int)__b);
1781#ifdef __LITTLE_ENDIAN__
1782 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2);
1783 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1,
1784 1, 3, 3);
1785#else
1786 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0);
1787 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0,
1788 0, 2, 2);
1789#endif
1790}
1791
1792static __inline__ vector bool long long __ATTRS_o_ai
1793vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1794 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b);
1795}
1796
1797static __inline__ vector bool long long __ATTRS_o_ai
1798vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1799 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b);
1800}
1801#endif
1802
1803static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1804 vector float __b) {
1805#ifdef __VSX__
1806 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1807#else
1808 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1809#endif
1810}
1811
1812#ifdef __VSX__
1813static __inline__ vector bool long long __ATTRS_o_ai
1814vec_cmpeq(vector double __a, vector double __b) {
1815 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1816}
1817#endif
1818
1819#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1820static __inline__ vector bool __int128 __ATTRS_o_ai
1821vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) {
1822 return (vector bool __int128)__builtin_altivec_vcmpequq(
1823 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1824}
1825
1826static __inline__ vector bool __int128 __ATTRS_o_ai
1827vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1828 return (vector bool __int128)__builtin_altivec_vcmpequq(
1829 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1830}
1831
1832static __inline__ vector bool __int128 __ATTRS_o_ai
1833vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) {
1834 return (vector bool __int128)__builtin_altivec_vcmpequq(
1835 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1836}
1837#endif
1838
1839#ifdef __POWER9_VECTOR__
1840/* vec_cmpne */
1841
1842static __inline__ vector bool char __ATTRS_o_ai
1843vec_cmpne(vector bool char __a, vector bool char __b) {
1844 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1845 (vector char)__b);
1846}
1847
1848static __inline__ vector bool char __ATTRS_o_ai
1849vec_cmpne(vector signed char __a, vector signed char __b) {
1850 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1851 (vector char)__b);
1852}
1853
1854static __inline__ vector bool char __ATTRS_o_ai
1855vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1856 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1857 (vector char)__b);
1858}
1859
1860static __inline__ vector bool short __ATTRS_o_ai
1861vec_cmpne(vector bool short __a, vector bool short __b) {
1862 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1863 (vector short)__b);
1864}
1865
1866static __inline__ vector bool short __ATTRS_o_ai
1867vec_cmpne(vector signed short __a, vector signed short __b) {
1868 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1869 (vector short)__b);
1870}
1871
1872static __inline__ vector bool short __ATTRS_o_ai
1873vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1874 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1875 (vector short)__b);
1876}
1877
1878static __inline__ vector bool int __ATTRS_o_ai
1879vec_cmpne(vector bool int __a, vector bool int __b) {
1880 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1881 (vector int)__b);
1882}
1883
1884static __inline__ vector bool int __ATTRS_o_ai
1885vec_cmpne(vector signed int __a, vector signed int __b) {
1886 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1887 (vector int)__b);
1888}
1889
1890static __inline__ vector bool int __ATTRS_o_ai
1891vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1892 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1893 (vector int)__b);
1894}
1895
1896static __inline__ vector bool int __ATTRS_o_ai
1897vec_cmpne(vector float __a, vector float __b) {
1898 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1899 (vector int)__b);
1900}
1901
1902#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1903static __inline__ vector bool __int128 __ATTRS_o_ai
1904vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1905 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1906 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1907}
1908
1909static __inline__ vector bool __int128 __ATTRS_o_ai
1910vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) {
1911 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1912 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1913}
1914
1915static __inline__ vector bool __int128 __ATTRS_o_ai
1916vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) {
1917 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1918 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1919}
1920#endif
1921
1922/* vec_cmpnez */
1923
1924static __inline__ vector bool char __ATTRS_o_ai
1925vec_cmpnez(vector signed char __a, vector signed char __b) {
1926 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1927 (vector char)__b);
1928}
1929
1930static __inline__ vector bool char __ATTRS_o_ai
1931vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1932 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1933 (vector char)__b);
1934}
1935
1936static __inline__ vector bool short __ATTRS_o_ai
1937vec_cmpnez(vector signed short __a, vector signed short __b) {
1938 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1939 (vector short)__b);
1940}
1941
1942static __inline__ vector bool short __ATTRS_o_ai
1943vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1944 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1945 (vector short)__b);
1946}
1947
1948static __inline__ vector bool int __ATTRS_o_ai
1949vec_cmpnez(vector signed int __a, vector signed int __b) {
1950 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1951 (vector int)__b);
1952}
1953
1954static __inline__ vector bool int __ATTRS_o_ai
1955vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1956 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1957 (vector int)__b);
1958}
1959
1960static __inline__ signed int __ATTRS_o_ai
1961vec_cntlz_lsbb(vector signed char __a) {
1962#ifdef __LITTLE_ENDIAN__
1963 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1964#else
1965 return __builtin_altivec_vclzlsbb((vector unsigned char)__a);
1966#endif
1967}
1968
1969static __inline__ signed int __ATTRS_o_ai
1970vec_cntlz_lsbb(vector unsigned char __a) {
1971#ifdef __LITTLE_ENDIAN__
1972 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1973#else
1974 return __builtin_altivec_vclzlsbb(__a);
1975#endif
1976}
1977
1978static __inline__ signed int __ATTRS_o_ai
1979vec_cnttz_lsbb(vector signed char __a) {
1980#ifdef __LITTLE_ENDIAN__
1981 return __builtin_altivec_vclzlsbb((vector unsigned char)__a);
1982#else
1983 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1984#endif
1985}
1986
1987static __inline__ signed int __ATTRS_o_ai
1988vec_cnttz_lsbb(vector unsigned char __a) {
1989#ifdef __LITTLE_ENDIAN__
1990 return __builtin_altivec_vclzlsbb(__a);
1991#else
1992 return __builtin_altivec_vctzlsbb(__a);
1993#endif
1994}
1995
1996static __inline__ vector unsigned int __ATTRS_o_ai
1997vec_parity_lsbb(vector unsigned int __a) {
1998 return __builtin_altivec_vprtybw(__a);
1999}
2000
2001static __inline__ vector unsigned int __ATTRS_o_ai
2002vec_parity_lsbb(vector signed int __a) {
2003 return __builtin_altivec_vprtybw((vector unsigned int)__a);
2004}
2005
2006#ifdef __SIZEOF_INT128__
2007static __inline__ vector unsigned __int128 __ATTRS_o_ai
2008vec_parity_lsbb(vector unsigned __int128 __a) {
2009 return __builtin_altivec_vprtybq(__a);
2010}
2011
2012static __inline__ vector unsigned __int128 __ATTRS_o_ai
2013vec_parity_lsbb(vector signed __int128 __a) {
2014 return __builtin_altivec_vprtybq((vector unsigned __int128)__a);
2015}
2016#endif
2017
2018static __inline__ vector unsigned long long __ATTRS_o_ai
2019vec_parity_lsbb(vector unsigned long long __a) {
2020 return __builtin_altivec_vprtybd(__a);
2021}
2022
2023static __inline__ vector unsigned long long __ATTRS_o_ai
2024vec_parity_lsbb(vector signed long long __a) {
2025 return __builtin_altivec_vprtybd((vector unsigned long long)__a);
2026}
2027
2028#else
2029/* vec_cmpne */
2030
2031static __inline__ vector bool char __ATTRS_o_ai
2032vec_cmpne(vector bool char __a, vector bool char __b) {
2033 return ~(vec_cmpeq(__a, __b));
2034}
2035
2036static __inline__ vector bool char __ATTRS_o_ai
2037vec_cmpne(vector signed char __a, vector signed char __b) {
2038 return ~(vec_cmpeq(__a, __b));
2039}
2040
2041static __inline__ vector bool char __ATTRS_o_ai
2042vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
2043 return ~(vec_cmpeq(__a, __b));
2044}
2045
2046static __inline__ vector bool short __ATTRS_o_ai
2047vec_cmpne(vector bool short __a, vector bool short __b) {
2048 return ~(vec_cmpeq(__a, __b));
2049}
2050
2051static __inline__ vector bool short __ATTRS_o_ai
2052vec_cmpne(vector signed short __a, vector signed short __b) {
2053 return ~(vec_cmpeq(__a, __b));
2054}
2055
2056static __inline__ vector bool short __ATTRS_o_ai
2057vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
2058 return ~(vec_cmpeq(__a, __b));
2059}
2060
2061static __inline__ vector bool int __ATTRS_o_ai
2062vec_cmpne(vector bool int __a, vector bool int __b) {
2063 return ~(vec_cmpeq(__a, __b));
2064}
2065
2066static __inline__ vector bool int __ATTRS_o_ai
2067vec_cmpne(vector signed int __a, vector signed int __b) {
2068 return ~(vec_cmpeq(__a, __b));
2069}
2070
2071static __inline__ vector bool int __ATTRS_o_ai
2072vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
2073 return ~(vec_cmpeq(__a, __b));
2074}
2075
2076static __inline__ vector bool int __ATTRS_o_ai
2077vec_cmpne(vector float __a, vector float __b) {
2078 return ~(vec_cmpeq(__a, __b));
2079}
2080#endif
2081
2082#ifdef __POWER8_VECTOR__
2083static __inline__ vector bool long long __ATTRS_o_ai
2084vec_cmpne(vector bool long long __a, vector bool long long __b) {
2085 return (vector bool long long)
2086 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2087}
2088
2089static __inline__ vector bool long long __ATTRS_o_ai
2090vec_cmpne(vector signed long long __a, vector signed long long __b) {
2091 return (vector bool long long)
2092 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2093}
2094
2095static __inline__ vector bool long long __ATTRS_o_ai
2096vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
2097 return (vector bool long long)
2098 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2099}
2100#elif defined(__VSX__)
2101static __inline__ vector bool long long __ATTRS_o_ai
2102vec_cmpne(vector bool long long __a, vector bool long long __b) {
2103 return (vector bool long long)~(
2104 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2105}
2106
2107static __inline__ vector bool long long __ATTRS_o_ai
2108vec_cmpne(vector signed long long __a, vector signed long long __b) {
2109 return (vector bool long long)~(
2110 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2111}
2112
2113static __inline__ vector bool long long __ATTRS_o_ai
2114vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
2115 return (vector bool long long)~(
2116 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2117}
2118#endif
2119
2120#ifdef __POWER8_VECTOR__
2121static __inline__ vector bool long long __ATTRS_o_ai
2122vec_cmpne(vector double __a, vector double __b) {
2123 return (vector bool long long)
2124 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2125}
2126#endif
2127
2128/* vec_cmpgt */
2129
2130static __inline__ vector bool char __ATTRS_o_ai
2131vec_cmpgt(vector signed char __a, vector signed char __b) {
2132 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2133}
2134
2135static __inline__ vector bool char __ATTRS_o_ai
2136vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
2137 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2138}
2139
2140static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
2141 vector short __b) {
2142 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2143}
2144
2145static __inline__ vector bool short __ATTRS_o_ai
2146vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
2147 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2148}
2149
2150static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
2151 vector int __b) {
2152 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2153}
2154
2155static __inline__ vector bool int __ATTRS_o_ai
2156vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
2157 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2158}
2159
2160#ifdef __POWER8_VECTOR__
2161static __inline__ vector bool long long __ATTRS_o_ai
2162vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2163 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
2164}
2165
2166static __inline__ vector bool long long __ATTRS_o_ai
2167vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2168 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
2169}
2170#elif defined(__VSX__)
2171static __inline__ vector bool long long __ATTRS_o_ai
2172vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2173 vector signed int __sgtw = (vector signed int)vec_cmpgt(
2174 (vector signed int)__a, (vector signed int)__b);
2175 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt(
2176 (vector unsigned int)__a, (vector unsigned int)__b);
2177 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq(
2178 (vector signed int)__a, (vector signed int)__b);
2179#ifdef __LITTLE_ENDIAN__
2180 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2181 __sgtw |= (vector signed int)__ugtw;
2182 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3,
2183 3);
2184#else
2185 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2186 __sgtw |= (vector signed int)__ugtw;
2187 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2,
2188 2);
2189#endif
2190}
2191
2192static __inline__ vector bool long long __ATTRS_o_ai
2193vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2194 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt(
2195 (vector unsigned int)__a, (vector unsigned int)__b);
2196 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq(
2197 (vector signed int)__a, (vector signed int)__b);
2198#ifdef __LITTLE_ENDIAN__
2199 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2200 __ugtw |= __eqw;
2201 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3,
2202 3);
2203#else
2204 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2205 __ugtw |= __eqw;
2206 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2,
2207 2);
2208#endif
2209}
2210#endif
2211
2212static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
2213 vector float __b) {
2214#ifdef __VSX__
2215 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
2216#else
2217 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2218#endif
2219}
2220
2221#ifdef __VSX__
2222static __inline__ vector bool long long __ATTRS_o_ai
2223vec_cmpgt(vector double __a, vector double __b) {
2224 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
2225}
2226#endif
2227
2228#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2229static __inline__ vector bool __int128 __ATTRS_o_ai
2230vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) {
2231 return (vector bool __int128)__builtin_altivec_vcmpgtsq(__a, __b);
2232}
2233
2234static __inline__ vector bool __int128 __ATTRS_o_ai
2235vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2236 return (vector bool __int128)__builtin_altivec_vcmpgtuq(__a, __b);
2237}
2238#endif
2239
2240/* vec_cmpge */
2241
2242static __inline__ vector bool char __ATTRS_o_ai
2243vec_cmpge(vector signed char __a, vector signed char __b) {
2244 return ~(vec_cmpgt(__b, __a));
2245}
2246
2247static __inline__ vector bool char __ATTRS_o_ai
2248vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
2249 return ~(vec_cmpgt(__b, __a));
2250}
2251
2252static __inline__ vector bool short __ATTRS_o_ai
2253vec_cmpge(vector signed short __a, vector signed short __b) {
2254 return ~(vec_cmpgt(__b, __a));
2255}
2256
2257static __inline__ vector bool short __ATTRS_o_ai
2258vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
2259 return ~(vec_cmpgt(__b, __a));
2260}
2261
2262static __inline__ vector bool int __ATTRS_o_ai
2263vec_cmpge(vector signed int __a, vector signed int __b) {
2264 return ~(vec_cmpgt(__b, __a));
2265}
2266
2267static __inline__ vector bool int __ATTRS_o_ai
2268vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2269 return ~(vec_cmpgt(__b, __a));
2270}
2271
2272static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
2273 vector float __b) {
2274#ifdef __VSX__
2275 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2276#else
2277 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2278#endif
2279}
2280
2281#ifdef __VSX__
2282static __inline__ vector bool long long __ATTRS_o_ai
2283vec_cmpge(vector double __a, vector double __b) {
2284 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2285}
2286
2287static __inline__ vector bool long long __ATTRS_o_ai
2288vec_cmpge(vector signed long long __a, vector signed long long __b) {
2289 return ~(vec_cmpgt(__b, __a));
2290}
2291
2292static __inline__ vector bool long long __ATTRS_o_ai
2293vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2294 return ~(vec_cmpgt(__b, __a));
2295}
2296#endif
2297
2298#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2299static __inline__ vector bool __int128 __ATTRS_o_ai
2300vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) {
2301 return ~(vec_cmpgt(__b, __a));
2302}
2303
2304static __inline__ vector bool __int128 __ATTRS_o_ai
2305vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2306 return ~(vec_cmpgt(__b, __a));
2307}
2308#endif
2309
2310/* vec_vcmpgefp */
2311
2312static __inline__ vector bool int __attribute__((__always_inline__))
2313vec_vcmpgefp(vector float __a, vector float __b) {
2314 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2315}
2316
2317/* vec_vcmpgtsb */
2318
2319static __inline__ vector bool char __attribute__((__always_inline__))
2320vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2321 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2322}
2323
2324/* vec_vcmpgtub */
2325
2326static __inline__ vector bool char __attribute__((__always_inline__))
2327vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2328 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2329}
2330
2331/* vec_vcmpgtsh */
2332
2333static __inline__ vector bool short __attribute__((__always_inline__))
2334vec_vcmpgtsh(vector short __a, vector short __b) {
2335 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2336}
2337
2338/* vec_vcmpgtuh */
2339
2340static __inline__ vector bool short __attribute__((__always_inline__))
2341vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2342 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2343}
2344
2345/* vec_vcmpgtsw */
2346
2347static __inline__ vector bool int __attribute__((__always_inline__))
2348vec_vcmpgtsw(vector int __a, vector int __b) {
2349 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2350}
2351
2352/* vec_vcmpgtuw */
2353
2354static __inline__ vector bool int __attribute__((__always_inline__))
2355vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2356 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2357}
2358
2359/* vec_vcmpgtfp */
2360
2361static __inline__ vector bool int __attribute__((__always_inline__))
2362vec_vcmpgtfp(vector float __a, vector float __b) {
2363 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2364}
2365
2366/* vec_cmple */
2367
2368static __inline__ vector bool char __ATTRS_o_ai
2369vec_cmple(vector signed char __a, vector signed char __b) {
2370 return vec_cmpge(__b, __a);
2371}
2372
2373static __inline__ vector bool char __ATTRS_o_ai
2374vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2375 return vec_cmpge(__b, __a);
2376}
2377
2378static __inline__ vector bool short __ATTRS_o_ai
2379vec_cmple(vector signed short __a, vector signed short __b) {
2380 return vec_cmpge(__b, __a);
2381}
2382
2383static __inline__ vector bool short __ATTRS_o_ai
2384vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2385 return vec_cmpge(__b, __a);
2386}
2387
2388static __inline__ vector bool int __ATTRS_o_ai
2389vec_cmple(vector signed int __a, vector signed int __b) {
2390 return vec_cmpge(__b, __a);
2391}
2392
2393static __inline__ vector bool int __ATTRS_o_ai
2394vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2395 return vec_cmpge(__b, __a);
2396}
2397
2398static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2399 vector float __b) {
2400 return vec_cmpge(__b, __a);
2401}
2402
2403#ifdef __VSX__
2404static __inline__ vector bool long long __ATTRS_o_ai
2405vec_cmple(vector double __a, vector double __b) {
2406 return vec_cmpge(__b, __a);
2407}
2408
2409static __inline__ vector bool long long __ATTRS_o_ai
2410vec_cmple(vector signed long long __a, vector signed long long __b) {
2411 return vec_cmpge(__b, __a);
2412}
2413
2414static __inline__ vector bool long long __ATTRS_o_ai
2415vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2416 return vec_cmpge(__b, __a);
2417}
2418#endif
2419
2420#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2421static __inline__ vector bool __int128 __ATTRS_o_ai
2422vec_cmple(vector signed __int128 __a, vector signed __int128 __b) {
2423 return vec_cmpge(__b, __a);
2424}
2425
2426static __inline__ vector bool __int128 __ATTRS_o_ai
2427vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2428 return vec_cmpge(__b, __a);
2429}
2430#endif
2431
2432/* vec_cmplt */
2433
2434static __inline__ vector bool char __ATTRS_o_ai
2435vec_cmplt(vector signed char __a, vector signed char __b) {
2436 return vec_cmpgt(__b, __a);
2437}
2438
2439static __inline__ vector bool char __ATTRS_o_ai
2440vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2441 return vec_cmpgt(__b, __a);
2442}
2443
2444static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2445 vector short __b) {
2446 return vec_cmpgt(__b, __a);
2447}
2448
2449static __inline__ vector bool short __ATTRS_o_ai
2450vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2451 return vec_cmpgt(__b, __a);
2452}
2453
2454static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2455 vector int __b) {
2456 return vec_cmpgt(__b, __a);
2457}
2458
2459static __inline__ vector bool int __ATTRS_o_ai
2460vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2461 return vec_cmpgt(__b, __a);
2462}
2463
2464static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2465 vector float __b) {
2466 return vec_cmpgt(__b, __a);
2467}
2468
2469#ifdef __VSX__
2470static __inline__ vector bool long long __ATTRS_o_ai
2471vec_cmplt(vector double __a, vector double __b) {
2472 return vec_cmpgt(__b, __a);
2473}
2474#endif
2475
2476#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2477static __inline__ vector bool __int128 __ATTRS_o_ai
2478vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) {
2479 return vec_cmpgt(__b, __a);
2480}
2481
2482static __inline__ vector bool __int128 __ATTRS_o_ai
2483vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2484 return vec_cmpgt(__b, __a);
2485}
2486#endif
2487
2488#ifdef __VSX__
2489static __inline__ vector bool long long __ATTRS_o_ai
2490vec_cmplt(vector signed long long __a, vector signed long long __b) {
2491 return vec_cmpgt(__b, __a);
2492}
2493
2494static __inline__ vector bool long long __ATTRS_o_ai
2495vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2496 return vec_cmpgt(__b, __a);
2497}
2498#endif
2499
2500#ifdef __POWER8_VECTOR__
2501/* vec_popcnt */
2502
2503static __inline__ vector unsigned char __ATTRS_o_ai
2504vec_popcnt(vector signed char __a) {
2505 return (vector unsigned char)__builtin_elementwise_popcount(
2506 (vector unsigned char)__a);
2507}
2508static __inline__ vector unsigned char __ATTRS_o_ai
2509vec_popcnt(vector unsigned char __a) {
2510 return __builtin_elementwise_popcount(__a);
2511}
2512static __inline__ vector unsigned short __ATTRS_o_ai
2513vec_popcnt(vector signed short __a) {
2514 return (vector unsigned short)__builtin_elementwise_popcount(
2515 (vector unsigned short)__a);
2516}
2517static __inline__ vector unsigned short __ATTRS_o_ai
2518vec_popcnt(vector unsigned short __a) {
2519 return __builtin_elementwise_popcount(__a);
2520}
2521static __inline__ vector unsigned int __ATTRS_o_ai
2522vec_popcnt(vector signed int __a) {
2523 return __builtin_elementwise_popcount((vector unsigned int)__a);
2524}
2525static __inline__ vector unsigned int __ATTRS_o_ai
2526vec_popcnt(vector unsigned int __a) {
2527 return __builtin_elementwise_popcount(__a);
2528}
2529static __inline__ vector unsigned long long __ATTRS_o_ai
2530vec_popcnt(vector signed long long __a) {
2531 return __builtin_elementwise_popcount((vector unsigned long long)__a);
2532}
2533static __inline__ vector unsigned long long __ATTRS_o_ai
2534vec_popcnt(vector unsigned long long __a) {
2535 return __builtin_elementwise_popcount(__a);
2536}
2537
2538#define vec_vclz vec_cntlz
2539/* vec_cntlz */
2540
2541static __inline__ vector signed char __ATTRS_o_ai
2542vec_cntlz(vector signed char __a) {
2543 return (vector signed char)__builtin_altivec_vclzb((vector unsigned char)__a);
2544}
2545static __inline__ vector unsigned char __ATTRS_o_ai
2546vec_cntlz(vector unsigned char __a) {
2547 return __builtin_altivec_vclzb(__a);
2548}
2549static __inline__ vector signed short __ATTRS_o_ai
2550vec_cntlz(vector signed short __a) {
2551 return (vector signed short)__builtin_altivec_vclzh(
2552 (vector unsigned short)__a);
2553}
2554static __inline__ vector unsigned short __ATTRS_o_ai
2555vec_cntlz(vector unsigned short __a) {
2556 return __builtin_altivec_vclzh(__a);
2557}
2558static __inline__ vector signed int __ATTRS_o_ai
2559vec_cntlz(vector signed int __a) {
2560 return (vector signed int)__builtin_altivec_vclzw((vector unsigned int)__a);
2561}
2562static __inline__ vector unsigned int __ATTRS_o_ai
2563vec_cntlz(vector unsigned int __a) {
2564 return __builtin_altivec_vclzw(__a);
2565}
2566static __inline__ vector signed long long __ATTRS_o_ai
2567vec_cntlz(vector signed long long __a) {
2568 return (vector signed long long)__builtin_altivec_vclzd(
2569 (vector unsigned long long)__a);
2570}
2571static __inline__ vector unsigned long long __ATTRS_o_ai
2572vec_cntlz(vector unsigned long long __a) {
2573 return __builtin_altivec_vclzd(__a);
2574}
2575#endif
2576
2577#ifdef __POWER9_VECTOR__
2578
2579/* vec_cnttz */
2580
2581static __inline__ vector signed char __ATTRS_o_ai
2582vec_cnttz(vector signed char __a) {
2583 return (vector signed char)__builtin_altivec_vctzb((vector unsigned char)__a);
2584}
2585static __inline__ vector unsigned char __ATTRS_o_ai
2586vec_cnttz(vector unsigned char __a) {
2587 return __builtin_altivec_vctzb(__a);
2588}
2589static __inline__ vector signed short __ATTRS_o_ai
2590vec_cnttz(vector signed short __a) {
2591 return (vector signed short)__builtin_altivec_vctzh(
2592 (vector unsigned short)__a);
2593}
2594static __inline__ vector unsigned short __ATTRS_o_ai
2595vec_cnttz(vector unsigned short __a) {
2596 return __builtin_altivec_vctzh(__a);
2597}
2598static __inline__ vector signed int __ATTRS_o_ai
2599vec_cnttz(vector signed int __a) {
2600 return (vector signed int)__builtin_altivec_vctzw((vector unsigned int)__a);
2601}
2602static __inline__ vector unsigned int __ATTRS_o_ai
2603vec_cnttz(vector unsigned int __a) {
2604 return __builtin_altivec_vctzw(__a);
2605}
2606static __inline__ vector signed long long __ATTRS_o_ai
2607vec_cnttz(vector signed long long __a) {
2608 return (vector signed long long)__builtin_altivec_vctzd(
2609 (vector unsigned long long)__a);
2610}
2611static __inline__ vector unsigned long long __ATTRS_o_ai
2612vec_cnttz(vector unsigned long long __a) {
2613 return __builtin_altivec_vctzd(__a);
2614}
2615
2616/* vec_first_match_index */
2617
2618static __inline__ unsigned __ATTRS_o_ai
2619vec_first_match_index(vector signed char __a, vector signed char __b) {
2620 vector unsigned long long __res =
2621#ifdef __LITTLE_ENDIAN__
2622 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2623#else
2624 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2625#endif
2626 if (__res[0] == 64) {
2627 return (__res[1] + 64) >> 3;
2628 }
2629 return __res[0] >> 3;
2630}
2631
2632static __inline__ unsigned __ATTRS_o_ai
2633vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2634 vector unsigned long long __res =
2635#ifdef __LITTLE_ENDIAN__
2636 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2637#else
2638 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2639#endif
2640 if (__res[0] == 64) {
2641 return (__res[1] + 64) >> 3;
2642 }
2643 return __res[0] >> 3;
2644}
2645
2646static __inline__ unsigned __ATTRS_o_ai
2647vec_first_match_index(vector signed short __a, vector signed short __b) {
2648 vector unsigned long long __res =
2649#ifdef __LITTLE_ENDIAN__
2650 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2651#else
2652 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2653#endif
2654 if (__res[0] == 64) {
2655 return (__res[1] + 64) >> 4;
2656 }
2657 return __res[0] >> 4;
2658}
2659
2660static __inline__ unsigned __ATTRS_o_ai
2661vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2662 vector unsigned long long __res =
2663#ifdef __LITTLE_ENDIAN__
2664 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2665#else
2666 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2667#endif
2668 if (__res[0] == 64) {
2669 return (__res[1] + 64) >> 4;
2670 }
2671 return __res[0] >> 4;
2672}
2673
2674static __inline__ unsigned __ATTRS_o_ai
2675vec_first_match_index(vector signed int __a, vector signed int __b) {
2676 vector unsigned long long __res =
2677#ifdef __LITTLE_ENDIAN__
2678 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2679#else
2680 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2681#endif
2682 if (__res[0] == 64) {
2683 return (__res[1] + 64) >> 5;
2684 }
2685 return __res[0] >> 5;
2686}
2687
2688static __inline__ unsigned __ATTRS_o_ai
2689vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2690 vector unsigned long long __res =
2691#ifdef __LITTLE_ENDIAN__
2692 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2693#else
2694 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2695#endif
2696 if (__res[0] == 64) {
2697 return (__res[1] + 64) >> 5;
2698 }
2699 return __res[0] >> 5;
2700}
2701
2702/* vec_first_match_or_eos_index */
2703
2704static __inline__ unsigned __ATTRS_o_ai
2705vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2706 /* Compare the result of the comparison of two vectors with either and OR the
2707 result. Either the elements are equal or one will equal the comparison
2708 result if either is zero.
2709 */
2710 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2711 vector bool char __tmp2 = __tmp1 |
2712 vec_cmpeq((vector signed char)__tmp1, __a) |
2713 vec_cmpeq((vector signed char)__tmp1, __b);
2714
2715 vector unsigned long long __res =
2716#ifdef __LITTLE_ENDIAN__
2717 vec_cnttz((vector unsigned long long)__tmp2);
2718#else
2719 vec_cntlz((vector unsigned long long)__tmp2);
2720#endif
2721 if (__res[0] == 64) {
2722 return (__res[1] + 64) >> 3;
2723 }
2724 return __res[0] >> 3;
2725}
2726
2727static __inline__ unsigned __ATTRS_o_ai
2728vec_first_match_or_eos_index(vector unsigned char __a,
2729 vector unsigned char __b) {
2730 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2731 vector bool char __tmp2 = __tmp1 |
2732 vec_cmpeq((vector unsigned char)__tmp1, __a) |
2733 vec_cmpeq((vector unsigned char)__tmp1, __b);
2734
2735 vector unsigned long long __res =
2736#ifdef __LITTLE_ENDIAN__
2737 vec_cnttz((vector unsigned long long)__tmp2);
2738#else
2739 vec_cntlz((vector unsigned long long)__tmp2);
2740#endif
2741 if (__res[0] == 64) {
2742 return (__res[1] + 64) >> 3;
2743 }
2744 return __res[0] >> 3;
2745}
2746
2747static __inline__ unsigned __ATTRS_o_ai
2748vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2749 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2750 vector bool short __tmp2 = __tmp1 |
2751 vec_cmpeq((vector signed short)__tmp1, __a) |
2752 vec_cmpeq((vector signed short)__tmp1, __b);
2753
2754 vector unsigned long long __res =
2755#ifdef __LITTLE_ENDIAN__
2756 vec_cnttz((vector unsigned long long)__tmp2);
2757#else
2758 vec_cntlz((vector unsigned long long)__tmp2);
2759#endif
2760 if (__res[0] == 64) {
2761 return (__res[1] + 64) >> 4;
2762 }
2763 return __res[0] >> 4;
2764}
2765
2766static __inline__ unsigned __ATTRS_o_ai
2767vec_first_match_or_eos_index(vector unsigned short __a,
2768 vector unsigned short __b) {
2769 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2770 vector bool short __tmp2 = __tmp1 |
2771 vec_cmpeq((vector unsigned short)__tmp1, __a) |
2772 vec_cmpeq((vector unsigned short)__tmp1, __b);
2773
2774 vector unsigned long long __res =
2775#ifdef __LITTLE_ENDIAN__
2776 vec_cnttz((vector unsigned long long)__tmp2);
2777#else
2778 vec_cntlz((vector unsigned long long)__tmp2);
2779#endif
2780 if (__res[0] == 64) {
2781 return (__res[1] + 64) >> 4;
2782 }
2783 return __res[0] >> 4;
2784}
2785
2786static __inline__ unsigned __ATTRS_o_ai
2787vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2788 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2789 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2790 vec_cmpeq((vector signed int)__tmp1, __b);
2791
2792 vector unsigned long long __res =
2793#ifdef __LITTLE_ENDIAN__
2794 vec_cnttz((vector unsigned long long)__tmp2);
2795#else
2796 vec_cntlz((vector unsigned long long)__tmp2);
2797#endif
2798 if (__res[0] == 64) {
2799 return (__res[1] + 64) >> 5;
2800 }
2801 return __res[0] >> 5;
2802}
2803
2804static __inline__ unsigned __ATTRS_o_ai
2805vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2806 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2807 vector bool int __tmp2 = __tmp1 |
2808 vec_cmpeq((vector unsigned int)__tmp1, __a) |
2809 vec_cmpeq((vector unsigned int)__tmp1, __b);
2810
2811 vector unsigned long long __res =
2812#ifdef __LITTLE_ENDIAN__
2813 vec_cnttz((vector unsigned long long)__tmp2);
2814#else
2815 vec_cntlz((vector unsigned long long)__tmp2);
2816#endif
2817 if (__res[0] == 64) {
2818 return (__res[1] + 64) >> 5;
2819 }
2820 return __res[0] >> 5;
2821}
2822
2823/* vec_first_mismatch_index */
2824
2825static __inline__ unsigned __ATTRS_o_ai
2826vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2827 vector unsigned long long __res =
2828#ifdef __LITTLE_ENDIAN__
2829 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2830#else
2831 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2832#endif
2833 if (__res[0] == 64) {
2834 return (__res[1] + 64) >> 3;
2835 }
2836 return __res[0] >> 3;
2837}
2838
2839static __inline__ unsigned __ATTRS_o_ai
2840vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2841 vector unsigned long long __res =
2842#ifdef __LITTLE_ENDIAN__
2843 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2844#else
2845 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2846#endif
2847 if (__res[0] == 64) {
2848 return (__res[1] + 64) >> 3;
2849 }
2850 return __res[0] >> 3;
2851}
2852
2853static __inline__ unsigned __ATTRS_o_ai
2854vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2855 vector unsigned long long __res =
2856#ifdef __LITTLE_ENDIAN__
2857 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2858#else
2859 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2860#endif
2861 if (__res[0] == 64) {
2862 return (__res[1] + 64) >> 4;
2863 }
2864 return __res[0] >> 4;
2865}
2866
2867static __inline__ unsigned __ATTRS_o_ai
2868vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2869 vector unsigned long long __res =
2870#ifdef __LITTLE_ENDIAN__
2871 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2872#else
2873 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2874#endif
2875 if (__res[0] == 64) {
2876 return (__res[1] + 64) >> 4;
2877 }
2878 return __res[0] >> 4;
2879}
2880
2881static __inline__ unsigned __ATTRS_o_ai
2882vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2883 vector unsigned long long __res =
2884#ifdef __LITTLE_ENDIAN__
2885 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2886#else
2887 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2888#endif
2889 if (__res[0] == 64) {
2890 return (__res[1] + 64) >> 5;
2891 }
2892 return __res[0] >> 5;
2893}
2894
2895static __inline__ unsigned __ATTRS_o_ai
2896vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2897 vector unsigned long long __res =
2898#ifdef __LITTLE_ENDIAN__
2899 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2900#else
2901 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2902#endif
2903 if (__res[0] == 64) {
2904 return (__res[1] + 64) >> 5;
2905 }
2906 return __res[0] >> 5;
2907}
2908
2909/* vec_first_mismatch_or_eos_index */
2910
2911static __inline__ unsigned __ATTRS_o_ai
2912vec_first_mismatch_or_eos_index(vector signed char __a,
2913 vector signed char __b) {
2914 vector unsigned long long __res =
2915#ifdef __LITTLE_ENDIAN__
2916 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2917#else
2918 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2919#endif
2920 if (__res[0] == 64) {
2921 return (__res[1] + 64) >> 3;
2922 }
2923 return __res[0] >> 3;
2924}
2925
2926static __inline__ unsigned __ATTRS_o_ai
2927vec_first_mismatch_or_eos_index(vector unsigned char __a,
2928 vector unsigned char __b) {
2929 vector unsigned long long __res =
2930#ifdef __LITTLE_ENDIAN__
2931 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2932#else
2933 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2934#endif
2935 if (__res[0] == 64) {
2936 return (__res[1] + 64) >> 3;
2937 }
2938 return __res[0] >> 3;
2939}
2940
2941static __inline__ unsigned __ATTRS_o_ai
2942vec_first_mismatch_or_eos_index(vector signed short __a,
2943 vector signed short __b) {
2944 vector unsigned long long __res =
2945#ifdef __LITTLE_ENDIAN__
2946 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2947#else
2948 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2949#endif
2950 if (__res[0] == 64) {
2951 return (__res[1] + 64) >> 4;
2952 }
2953 return __res[0] >> 4;
2954}
2955
2956static __inline__ unsigned __ATTRS_o_ai
2957vec_first_mismatch_or_eos_index(vector unsigned short __a,
2958 vector unsigned short __b) {
2959 vector unsigned long long __res =
2960#ifdef __LITTLE_ENDIAN__
2961 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2962#else
2963 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2964#endif
2965 if (__res[0] == 64) {
2966 return (__res[1] + 64) >> 4;
2967 }
2968 return __res[0] >> 4;
2969}
2970
2971static __inline__ unsigned __ATTRS_o_ai
2972vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2973 vector unsigned long long __res =
2974#ifdef __LITTLE_ENDIAN__
2975 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2976#else
2977 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2978#endif
2979 if (__res[0] == 64) {
2980 return (__res[1] + 64) >> 5;
2981 }
2982 return __res[0] >> 5;
2983}
2984
2985static __inline__ unsigned __ATTRS_o_ai
2986vec_first_mismatch_or_eos_index(vector unsigned int __a,
2987 vector unsigned int __b) {
2988 vector unsigned long long __res =
2989#ifdef __LITTLE_ENDIAN__
2990 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2991#else
2992 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2993#endif
2994 if (__res[0] == 64) {
2995 return (__res[1] + 64) >> 5;
2996 }
2997 return __res[0] >> 5;
2998}
2999
3000static __inline__ vector double __ATTRS_o_ai
3001vec_insert_exp(vector double __a, vector unsigned long long __b) {
3002 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
3003}
3004
3005static __inline__ vector double __ATTRS_o_ai
3006vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
3007 return __builtin_vsx_xviexpdp(__a,__b);
3008}
3009
3010static __inline__ vector float __ATTRS_o_ai
3011vec_insert_exp(vector float __a, vector unsigned int __b) {
3012 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
3013}
3014
3015static __inline__ vector float __ATTRS_o_ai
3016vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
3017 return __builtin_vsx_xviexpsp(__a,__b);
3018}
3019
3020#if defined(__powerpc64__)
3021static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a,
3022 size_t __b) {
3023 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
3024}
3025
3026static __inline__ vector unsigned char __ATTRS_o_ai
3027vec_xl_len(const unsigned char *__a, size_t __b) {
3028 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
3029}
3030
3031static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a,
3032 size_t __b) {
3033 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
3034}
3035
3036static __inline__ vector unsigned short __ATTRS_o_ai
3037vec_xl_len(const unsigned short *__a, size_t __b) {
3038 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
3039}
3040
3041static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a,
3042 size_t __b) {
3043 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
3044}
3045
3046static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a,
3047 size_t __b) {
3048 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
3049}
3050
3051static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) {
3052 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
3053}
3054
3055#ifdef __SIZEOF_INT128__
3056static __inline__ vector signed __int128 __ATTRS_o_ai
3057vec_xl_len(const signed __int128 *__a, size_t __b) {
3058 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3059}
3060
3061static __inline__ vector unsigned __int128 __ATTRS_o_ai
3062vec_xl_len(const unsigned __int128 *__a, size_t __b) {
3063 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3064}
3065#endif
3066
3067static __inline__ vector signed long long __ATTRS_o_ai
3068vec_xl_len(const signed long long *__a, size_t __b) {
3069 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
3070}
3071
3072static __inline__ vector unsigned long long __ATTRS_o_ai
3073vec_xl_len(const unsigned long long *__a, size_t __b) {
3074 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
3075}
3076
3077static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a,
3078 size_t __b) {
3079 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
3080}
3081
3082static __inline__ vector unsigned char __ATTRS_o_ai
3083vec_xl_len_r(const unsigned char *__a, size_t __b) {
3084 vector unsigned char __res =
3085 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
3086 vector unsigned char __mask =
3087 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
3088 return (vector unsigned char)__builtin_altivec_vperm_4si(
3089 (vector int)__res, (vector int)__res, __mask);
3090}
3091
3092// vec_xst_len
3093static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
3094 unsigned char *__b,
3095 size_t __c) {
3096 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3097}
3098
3099static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
3100 signed char *__b, size_t __c) {
3101 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3102}
3103
3104static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
3105 signed short *__b, size_t __c) {
3106 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3107}
3108
3109static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
3110 unsigned short *__b,
3111 size_t __c) {
3112 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3113}
3114
3115static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
3116 signed int *__b, size_t __c) {
3117 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3118}
3119
3120static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
3121 unsigned int *__b, size_t __c) {
3122 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3123}
3124
3125static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
3126 size_t __c) {
3127 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3128}
3129
3130#ifdef __SIZEOF_INT128__
3131static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
3132 signed __int128 *__b,
3133 size_t __c) {
3134 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3135}
3136
3137static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
3138 unsigned __int128 *__b,
3139 size_t __c) {
3140 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3141}
3142#endif
3143
3144static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
3145 signed long long *__b,
3146 size_t __c) {
3147 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3148}
3149
3150static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
3151 unsigned long long *__b,
3152 size_t __c) {
3153 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3154}
3155
3156static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
3157 size_t __c) {
3158 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3159}
3160
3161static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
3162 unsigned char *__b,
3163 size_t __c) {
3164 vector unsigned char __mask =
3165 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
3166 vector unsigned char __res =
3167 (vector unsigned char)__builtin_altivec_vperm_4si(
3168 (vector int)__a, (vector int)__a, __mask);
3169 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
3170}
3171#endif
3172#endif
3173
3174#if defined(__POWER9_VECTOR__) && defined(__powerpc64__)
3175#define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT))
3176#define __vec_strmb(PTR, CNT, VAL) \
3177 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT))
3178#else
3179#define __vec_ldrmb __builtin_vsx_ldrmb
3180#define __vec_strmb __builtin_vsx_strmb
3181#endif
3182
3183/* vec_cpsgn */
3184
3185#ifdef __VSX__
3186static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
3187 vector float __b) {
3188 return __builtin_vsx_xvcpsgnsp(__b, __a);
3189}
3190
3191static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
3192 vector double __b) {
3193 return __builtin_vsx_xvcpsgndp(__b, __a);
3194}
3195#endif
3196
3197/* vec_ctf */
3198
3199#ifdef __VSX__
3200// There are some functions that have different signatures with the XL compiler
3201// from those in Clang/GCC and documented in the PVIPR. This macro ensures that
3202// the XL-compatible signatures are used for those functions.
3203#ifdef __XL_COMPAT_ALTIVEC__
3204#define vec_ctf(__a, __b) \
3205 _Generic((__a), \
3206 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3207 ((__b)&0x1F)), \
3208 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3209 (vector unsigned int)(__a), ((__b)&0x1F)), \
3210 vector unsigned long long: ( \
3211 vector float)(__builtin_vsx_xvcvuxdsp( \
3212 (vector unsigned long long)(__a)) * \
3213 (vector float)(vector unsigned)((0x7f - \
3214 ((__b)&0x1F)) \
3215 << 23)), \
3216 vector signed long long: ( \
3217 vector float)(__builtin_vsx_xvcvsxdsp( \
3218 (vector signed long long)(__a)) * \
3219 (vector float)(vector unsigned)((0x7f - \
3220 ((__b)&0x1F)) \
3221 << 23)))
3222#else // __XL_COMPAT_ALTIVEC__
3223#define vec_ctf(__a, __b) \
3224 _Generic( \
3225 (__a), \
3226 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3227 ((__b)&0x1F)), \
3228 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3229 (vector unsigned int)(__a), ((__b)&0x1F)), \
3230 vector unsigned long long: ( \
3231 vector float)(__builtin_convertvector( \
3232 (vector unsigned long long)(__a), vector double) * \
3233 (vector double)(vector unsigned long long)((0x3ffULL - \
3234 ((__b)&0x1F)) \
3235 << 52)), \
3236 vector signed long long: ( \
3237 vector float)(__builtin_convertvector( \
3238 (vector signed long long)(__a), vector double) * \
3239 (vector double)(vector unsigned long long)((0x3ffULL - \
3240 ((__b)&0x1F)) \
3241 << 52)))
3242#endif // __XL_COMPAT_ALTIVEC__
3243#else
3244#define vec_ctf(__a, __b) \
3245 _Generic((__a), \
3246 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3247 ((__b)&0x1F)), \
3248 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3249 (vector unsigned int)(__a), ((__b)&0x1F)))
3250#endif
3251
3252/* vec_ctd */
3253#ifdef __VSX__
3254#define vec_ctd(__a, __b) \
3255 _Generic((__a), \
3256 vector signed int: ( \
3257 vec_doublee((vector signed int)(__a)) * \
3258 (vector double)(vector unsigned long long)((0x3ffULL - \
3259 ((__b)&0x1F)) \
3260 << 52)), \
3261 vector unsigned int: ( \
3262 vec_doublee((vector unsigned int)(__a)) * \
3263 (vector double)(vector unsigned long long)((0x3ffULL - \
3264 ((__b)&0x1F)) \
3265 << 52)), \
3266 vector unsigned long long: ( \
3267 __builtin_convertvector((vector unsigned long long)(__a), \
3268 vector double) * \
3269 (vector double)(vector unsigned long long)((0x3ffULL - \
3270 ((__b)&0x1F)) \
3271 << 52)), \
3272 vector signed long long: ( \
3273 __builtin_convertvector((vector signed long long)(__a), \
3274 vector double) * \
3275 (vector double)(vector unsigned long long)((0x3ffULL - \
3276 ((__b)&0x1F)) \
3277 << 52)))
3278#endif // __VSX__
3279
3280/* vec_vcfsx */
3281
3282#define vec_vcfux __builtin_altivec_vcfux
3283/* vec_vcfux */
3284
3285#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
3286
3287/* vec_cts */
3288
3289#ifdef __VSX__
3290#ifdef __XL_COMPAT_ALTIVEC__
3291#define vec_cts(__a, __b) \
3292 _Generic((__a), \
3293 vector float: (vector signed int)__builtin_altivec_vctsxs( \
3294 (vector float)(__a), ((__b)&0x1F)), \
3295 vector double: __extension__({ \
3296 vector double __ret = \
3297 (vector double)(__a) * \
3298 (vector double)(vector unsigned long long)((0x3ffULL + \
3299 ((__b)&0x1F)) \
3300 << 52); \
3301 (vector signed long long)__builtin_vsx_xvcvdpsxws(__ret); \
3302 }))
3303#else // __XL_COMPAT_ALTIVEC__
3304#define vec_cts(__a, __b) \
3305 _Generic((__a), \
3306 vector float: (vector signed int)__builtin_altivec_vctsxs( \
3307 (vector float)(__a), ((__b)&0x1F)), \
3308 vector double: __extension__({ \
3309 vector double __ret = \
3310 (vector double)(__a) * \
3311 (vector double)(vector unsigned long long)((0x3ffULL + \
3312 ((__b)&0x1F)) \
3313 << 52); \
3314 (vector signed long long)__builtin_convertvector( \
3315 __ret, vector signed long long); \
3316 }))
3317#endif // __XL_COMPAT_ALTIVEC__
3318#else
3319#define vec_cts __builtin_altivec_vctsxs
3320#endif
3321
3322/* vec_vctsxs */
3323
3324#define vec_vctsxs __builtin_altivec_vctsxs
3325
3326/* vec_ctu */
3327
3328#ifdef __VSX__
3329#ifdef __XL_COMPAT_ALTIVEC__
3330#define vec_ctu(__a, __b) \
3331 _Generic((__a), \
3332 vector float: (vector unsigned int)__builtin_altivec_vctuxs( \
3333 (vector float)(__a), ((__b)&0x1F)), \
3334 vector double: __extension__({ \
3335 vector double __ret = \
3336 (vector double)(__a) * \
3337 (vector double)(vector unsigned long long)((0x3ffULL + \
3338 ((__b)&0x1F)) \
3339 << 52); \
3340 (vector unsigned long long)__builtin_vsx_xvcvdpuxws(__ret); \
3341 }))
3342#else // __XL_COMPAT_ALTIVEC__
3343#define vec_ctu(__a, __b) \
3344 _Generic((__a), \
3345 vector float: (vector unsigned int)__builtin_altivec_vctuxs( \
3346 (vector float)(__a), ((__b)&0x1F)), \
3347 vector double: __extension__({ \
3348 vector double __ret = \
3349 (vector double)(__a) * \
3350 (vector double)(vector unsigned long long)((0x3ffULL + \
3351 ((__b)&0x1F)) \
3352 << 52); \
3353 (vector unsigned long long)__builtin_convertvector( \
3354 __ret, vector unsigned long long); \
3355 }))
3356#endif // __XL_COMPAT_ALTIVEC__
3357#else
3358#define vec_ctu __builtin_altivec_vctuxs
3359#endif
3360
3361#ifdef __LITTLE_ENDIAN__
3362/* vec_ctsl */
3363
3364#ifdef __VSX__
3365#define vec_ctsl(__a, __b) \
3366 _Generic( \
3367 (__a), vector float \
3368 : __extension__({ \
3369 vector float __ret = \
3370 (vector float)(__a) * \
3371 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3372 __builtin_vsx_xvcvspsxds(__builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3373 }), \
3374 vector double \
3375 : __extension__({ \
3376 vector double __ret = \
3377 (vector double)(__a) * \
3378 (vector double)(vector unsigned long long)((0x3ffULL + \
3379 ((__b)&0x1F)) \
3380 << 52); \
3381 __builtin_convertvector(__ret, vector signed long long); \
3382 }))
3383
3384/* vec_ctul */
3385
3386#define vec_ctul(__a, __b) \
3387 _Generic( \
3388 (__a), vector float \
3389 : __extension__({ \
3390 vector float __ret = \
3391 (vector float)(__a) * \
3392 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3393 __builtin_vsx_xvcvspuxds(__builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3394 }), \
3395 vector double \
3396 : __extension__({ \
3397 vector double __ret = \
3398 (vector double)(__a) * \
3399 (vector double)(vector unsigned long long)((0x3ffULL + \
3400 ((__b)&0x1F)) \
3401 << 52); \
3402 __builtin_convertvector(__ret, vector unsigned long long); \
3403 }))
3404#endif
3405#else // __LITTLE_ENDIAN__
3406/* vec_ctsl */
3407
3408#ifdef __VSX__
3409#define vec_ctsl(__a, __b) \
3410 _Generic((__a), \
3411 vector float: __extension__({ \
3412 vector float __ret = \
3413 (vector float)(__a) * \
3414 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3415 __builtin_vsx_xvcvspsxds(__ret); \
3416 }), \
3417 vector double: __extension__({ \
3418 vector double __ret = \
3419 (vector double)(__a) * \
3420 (vector double)(vector unsigned long long)((0x3ffULL + \
3421 ((__b)&0x1F)) \
3422 << 52); \
3423 __builtin_convertvector(__ret, vector signed long long); \
3424 }))
3425
3426/* vec_ctul */
3427
3428#define vec_ctul(__a, __b) \
3429 _Generic((__a), vector float \
3430 : __extension__({ \
3431 vector float __ret = \
3432 (vector float)(__a) * \
3433 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) \
3434 << 23); \
3435 __builtin_vsx_xvcvspuxds(__ret); \
3436 }), \
3437 vector double \
3438 : __extension__({ \
3439 vector double __ret = \
3440 (vector double)(__a) * \
3441 (vector double)(vector unsigned long long)((0x3ffULL + \
3442 ((__b)&0x1F)) \
3443 << 52); \
3444 __builtin_convertvector(__ret, vector unsigned long long); \
3445 }))
3446#endif
3447#endif // __LITTLE_ENDIAN__
3448
3449/* vec_vctuxs */
3450
3451#define vec_vctuxs __builtin_altivec_vctuxs
3452
3453/* vec_signext */
3454
3455#ifdef __POWER9_VECTOR__
3456static __inline__ vector signed int __ATTRS_o_ai
3457vec_signexti(vector signed char __a) {
3458 return __builtin_altivec_vextsb2w(__a);
3459}
3460
3461static __inline__ vector signed int __ATTRS_o_ai
3462vec_signexti(vector signed short __a) {
3463 return __builtin_altivec_vextsh2w(__a);
3464}
3465
3466static __inline__ vector signed long long __ATTRS_o_ai
3467vec_signextll(vector signed char __a) {
3468 return __builtin_altivec_vextsb2d(__a);
3469}
3470
3471static __inline__ vector signed long long __ATTRS_o_ai
3472vec_signextll(vector signed short __a) {
3473 return __builtin_altivec_vextsh2d(__a);
3474}
3475
3476static __inline__ vector signed long long __ATTRS_o_ai
3477vec_signextll(vector signed int __a) {
3478 return __builtin_altivec_vextsw2d(__a);
3479}
3480#endif
3481
3482#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3483static __inline__ vector signed __int128 __ATTRS_o_ai
3484vec_signextq(vector signed long long __a) {
3485 return __builtin_altivec_vextsd2q(__a);
3486}
3487#endif
3488
3489/* vec_signed */
3490
3491static __inline__ vector signed int __ATTRS_o_ai
3492vec_sld(vector signed int, vector signed int, unsigned const int __c);
3493
3494static __inline__ vector signed int __ATTRS_o_ai
3495vec_signed(vector float __a) {
3496 return __builtin_convertvector(__a, vector signed int);
3497}
3498
3499#ifdef __VSX__
3500static __inline__ vector signed long long __ATTRS_o_ai
3501vec_signed(vector double __a) {
3502 return __builtin_convertvector(__a, vector signed long long);
3503}
3504
3505static __inline__ vector signed int __attribute__((__always_inline__))
3506vec_signed2(vector double __a, vector double __b) {
3507 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
3508}
3509
3510static __inline__ vector signed int __ATTRS_o_ai
3511vec_signede(vector double __a) {
3512#ifdef __LITTLE_ENDIAN__
3513 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3514 return vec_sld(__ret, __ret, 12);
3515#else
3516 return __builtin_vsx_xvcvdpsxws(__a);
3517#endif
3518}
3519
3520static __inline__ vector signed int __ATTRS_o_ai
3521vec_signedo(vector double __a) {
3522#ifdef __LITTLE_ENDIAN__
3523 return __builtin_vsx_xvcvdpsxws(__a);
3524#else
3525 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3526 return vec_sld(__ret, __ret, 12);
3527#endif
3528}
3529#endif
3530
3531/* vec_unsigned */
3532
3533static __inline__ vector unsigned int __ATTRS_o_ai
3534vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3535
3536static __inline__ vector unsigned int __ATTRS_o_ai
3537vec_unsigned(vector float __a) {
3538 return __builtin_convertvector(__a, vector unsigned int);
3539}
3540
3541#ifdef __VSX__
3542static __inline__ vector unsigned long long __ATTRS_o_ai
3543vec_unsigned(vector double __a) {
3544 return __builtin_convertvector(__a, vector unsigned long long);
3545}
3546
3547static __inline__ vector unsigned int __attribute__((__always_inline__))
3548vec_unsigned2(vector double __a, vector double __b) {
3549 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3550}
3551
3552static __inline__ vector unsigned int __ATTRS_o_ai
3553vec_unsignede(vector double __a) {
3554#ifdef __LITTLE_ENDIAN__
3555 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3556 return vec_sld(__ret, __ret, 12);
3557#else
3558 return __builtin_vsx_xvcvdpuxws(__a);
3559#endif
3560}
3561
3562static __inline__ vector unsigned int __ATTRS_o_ai
3563vec_unsignedo(vector double __a) {
3564#ifdef __LITTLE_ENDIAN__
3565 return __builtin_vsx_xvcvdpuxws(__a);
3566#else
3567 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3568 return vec_sld(__ret, __ret, 12);
3569#endif
3570}
3571#endif
3572
3573/* vec_float */
3574
3575static __inline__ vector float __ATTRS_o_ai
3576vec_sld(vector float, vector float, unsigned const int __c);
3577
3578static __inline__ vector float __ATTRS_o_ai
3579vec_float(vector signed int __a) {
3580 return __builtin_convertvector(__a, vector float);
3581}
3582
3583static __inline__ vector float __ATTRS_o_ai
3584vec_float(vector unsigned int __a) {
3585 return __builtin_convertvector(__a, vector float);
3586}
3587
3588#ifdef __VSX__
3589static __inline__ vector float __ATTRS_o_ai
3590vec_float2(vector signed long long __a, vector signed long long __b) {
3591 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3592}
3593
3594static __inline__ vector float __ATTRS_o_ai
3595vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3596 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3597}
3598
3599static __inline__ vector float __ATTRS_o_ai
3600vec_float2(vector double __a, vector double __b) {
3601 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3602}
3603
3604static __inline__ vector float __ATTRS_o_ai
3605vec_floate(vector signed long long __a) {
3606#ifdef __LITTLE_ENDIAN__
3607 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3608 return vec_sld(__ret, __ret, 12);
3609#else
3610 return __builtin_vsx_xvcvsxdsp(__a);
3611#endif
3612}
3613
3614static __inline__ vector float __ATTRS_o_ai
3615vec_floate(vector unsigned long long __a) {
3616#ifdef __LITTLE_ENDIAN__
3617 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3618 return vec_sld(__ret, __ret, 12);
3619#else
3620 return __builtin_vsx_xvcvuxdsp(__a);
3621#endif
3622}
3623
3624static __inline__ vector float __ATTRS_o_ai
3625vec_floate(vector double __a) {
3626#ifdef __LITTLE_ENDIAN__
3627 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3628 return vec_sld(__ret, __ret, 12);
3629#else
3630 return __builtin_vsx_xvcvdpsp(__a);
3631#endif
3632}
3633
3634static __inline__ vector float __ATTRS_o_ai
3635vec_floato(vector signed long long __a) {
3636#ifdef __LITTLE_ENDIAN__
3637 return __builtin_vsx_xvcvsxdsp(__a);
3638#else
3639 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3640 return vec_sld(__ret, __ret, 12);
3641#endif
3642}
3643
3644static __inline__ vector float __ATTRS_o_ai
3645vec_floato(vector unsigned long long __a) {
3646#ifdef __LITTLE_ENDIAN__
3647 return __builtin_vsx_xvcvuxdsp(__a);
3648#else
3649 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3650 return vec_sld(__ret, __ret, 12);
3651#endif
3652}
3653
3654static __inline__ vector float __ATTRS_o_ai
3655vec_floato(vector double __a) {
3656#ifdef __LITTLE_ENDIAN__
3657 return __builtin_vsx_xvcvdpsp(__a);
3658#else
3659 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3660 return vec_sld(__ret, __ret, 12);
3661#endif
3662}
3663#endif
3664
3665/* vec_double */
3666
3667#ifdef __VSX__
3668static __inline__ vector double __ATTRS_o_ai
3669vec_double(vector signed long long __a) {
3670 return __builtin_convertvector(__a, vector double);
3671}
3672
3673static __inline__ vector double __ATTRS_o_ai
3674vec_double(vector unsigned long long __a) {
3675 return __builtin_convertvector(__a, vector double);
3676}
3677
3678static __inline__ vector double __ATTRS_o_ai
3679vec_doublee(vector signed int __a) {
3680#ifdef __LITTLE_ENDIAN__
3681 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3682#else
3683 return __builtin_vsx_xvcvsxwdp(__a);
3684#endif
3685}
3686
3687static __inline__ vector double __ATTRS_o_ai
3688vec_doublee(vector unsigned int __a) {
3689#ifdef __LITTLE_ENDIAN__
3690 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3691#else
3692 return __builtin_vsx_xvcvuxwdp(__a);
3693#endif
3694}
3695
3696static __inline__ vector double __ATTRS_o_ai
3697vec_doublee(vector float __a) {
3698#ifdef __LITTLE_ENDIAN__
3699 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3700#else
3701 return __builtin_vsx_xvcvspdp(__a);
3702#endif
3703}
3704
3705static __inline__ vector double __ATTRS_o_ai
3706vec_doubleh(vector signed int __a) {
3707 vector double __ret = {__a[0], __a[1]};
3708 return __ret;
3709}
3710
3711static __inline__ vector double __ATTRS_o_ai
3712vec_doubleh(vector unsigned int __a) {
3713 vector double __ret = {__a[0], __a[1]};
3714 return __ret;
3715}
3716
3717static __inline__ vector double __ATTRS_o_ai
3718vec_doubleh(vector float __a) {
3719 vector double __ret = {__a[0], __a[1]};
3720 return __ret;
3721}
3722
3723static __inline__ vector double __ATTRS_o_ai
3724vec_doublel(vector signed int __a) {
3725 vector double __ret = {__a[2], __a[3]};
3726 return __ret;
3727}
3728
3729static __inline__ vector double __ATTRS_o_ai
3730vec_doublel(vector unsigned int __a) {
3731 vector double __ret = {__a[2], __a[3]};
3732 return __ret;
3733}
3734
3735static __inline__ vector double __ATTRS_o_ai
3736vec_doublel(vector float __a) {
3737 vector double __ret = {__a[2], __a[3]};
3738 return __ret;
3739}
3740
3741static __inline__ vector double __ATTRS_o_ai
3742vec_doubleo(vector signed int __a) {
3743#ifdef __LITTLE_ENDIAN__
3744 return __builtin_vsx_xvcvsxwdp(__a);
3745#else
3746 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3747#endif
3748}
3749
3750static __inline__ vector double __ATTRS_o_ai
3751vec_doubleo(vector unsigned int __a) {
3752#ifdef __LITTLE_ENDIAN__
3753 return __builtin_vsx_xvcvuxwdp(__a);
3754#else
3755 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3756#endif
3757}
3758
3759static __inline__ vector double __ATTRS_o_ai
3760vec_doubleo(vector float __a) {
3761#ifdef __LITTLE_ENDIAN__
3762 return __builtin_vsx_xvcvspdp(__a);
3763#else
3764 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3765#endif
3766}
3767
3768/* vec_cvf */
3769static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) {
3770 return vec_doublee(__a);
3771}
3772
3773static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) {
3774 return vec_floate(__a);
3775}
3776#endif
3777
3778/* vec_div */
3779
3780/* Integer vector divides (vectors are scalarized, elements divided
3781 and the vectors reassembled).
3782*/
3783static __inline__ vector signed char __ATTRS_o_ai
3784vec_div(vector signed char __a, vector signed char __b) {
3785 return __a / __b;
3786}
3787
3788static __inline__ vector unsigned char __ATTRS_o_ai
3789vec_div(vector unsigned char __a, vector unsigned char __b) {
3790 return __a / __b;
3791}
3792
3793static __inline__ vector signed short __ATTRS_o_ai
3794vec_div(vector signed short __a, vector signed short __b) {
3795 return __a / __b;
3796}
3797
3798static __inline__ vector unsigned short __ATTRS_o_ai
3799vec_div(vector unsigned short __a, vector unsigned short __b) {
3800 return __a / __b;
3801}
3802
3803static __inline__ vector signed int __ATTRS_o_ai
3804vec_div(vector signed int __a, vector signed int __b) {
3805 return __a / __b;
3806}
3807
3808static __inline__ vector unsigned int __ATTRS_o_ai
3809vec_div(vector unsigned int __a, vector unsigned int __b) {
3810 return __a / __b;
3811}
3812
3813#ifdef __VSX__
3814static __inline__ vector signed long long __ATTRS_o_ai
3815vec_div(vector signed long long __a, vector signed long long __b) {
3816 return __a / __b;
3817}
3818
3819static __inline__ vector unsigned long long __ATTRS_o_ai
3820vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3821 return __a / __b;
3822}
3823
3824static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3825 vector float __b) {
3826 return __a / __b;
3827}
3828
3829static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3830 vector double __b) {
3831 return __a / __b;
3832}
3833#endif
3834
3835/* vec_dive */
3836
3837#ifdef __POWER10_VECTOR__
3838static __inline__ vector signed int __ATTRS_o_ai
3839vec_dive(vector signed int __a, vector signed int __b) {
3840 return __builtin_altivec_vdivesw(__a, __b);
3841}
3842
3843static __inline__ vector unsigned int __ATTRS_o_ai
3844vec_dive(vector unsigned int __a, vector unsigned int __b) {
3845 return __builtin_altivec_vdiveuw(__a, __b);
3846}
3847
3848static __inline__ vector signed long long __ATTRS_o_ai
3849vec_dive(vector signed long long __a, vector signed long long __b) {
3850 return __builtin_altivec_vdivesd(__a, __b);
3851}
3852
3853static __inline__ vector unsigned long long __ATTRS_o_ai
3854vec_dive(vector unsigned long long __a, vector unsigned long long __b) {
3855 return __builtin_altivec_vdiveud(__a, __b);
3856}
3857
3858#ifdef __SIZEOF_INT128__
3859static __inline__ vector unsigned __int128 __ATTRS_o_ai
3860vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3861 return __builtin_altivec_vdiveuq(__a, __b);
3862}
3863
3864static __inline__ vector signed __int128 __ATTRS_o_ai
3865vec_dive(vector signed __int128 __a, vector signed __int128 __b) {
3866 return __builtin_altivec_vdivesq(__a, __b);
3867}
3868#endif
3869#endif
3870
3871#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3872static __inline__ vector unsigned __int128 __ATTRS_o_ai
3873vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3874 return __a / __b;
3875}
3876
3877static __inline__ vector signed __int128 __ATTRS_o_ai
3878vec_div(vector signed __int128 __a, vector signed __int128 __b) {
3879 return __a / __b;
3880}
3881#endif /* __POWER10_VECTOR__ */
3882
3883/* vec_xvtdiv */
3884
3885#ifdef __VSX__
3886static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a,
3887 vector double __b) {
3888 return __builtin_vsx_xvtdivdp(__a, __b);
3889}
3890
3891static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a,
3892 vector float __b) {
3893 return __builtin_vsx_xvtdivsp(__a, __b);
3894}
3895#endif
3896
3897/* vec_dss */
3898
3899#define vec_dss __builtin_altivec_dss
3900
3901/* vec_dssall */
3902
3903static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3904 __builtin_altivec_dssall();
3905}
3906
3907/* vec_dst */
3908#define vec_dst(__PTR, __CW, __STR) \
3909 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3910
3911/* vec_dstst */
3912#define vec_dstst(__PTR, __CW, __STR) \
3913 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3914
3915/* vec_dststt */
3916#define vec_dststt(__PTR, __CW, __STR) \
3917 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3918
3919/* vec_dstt */
3920#define vec_dstt(__PTR, __CW, __STR) \
3921 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3922
3923/* vec_eqv */
3924
3925#ifdef __POWER8_VECTOR__
3926static __inline__ vector signed char __ATTRS_o_ai
3927vec_eqv(vector signed char __a, vector signed char __b) {
3928 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3929 (vector unsigned int)__b);
3930}
3931
3932static __inline__ vector unsigned char __ATTRS_o_ai
3933vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3934 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3935 (vector unsigned int)__b);
3936}
3937
3938static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3939 vector bool char __b) {
3940 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3941 (vector unsigned int)__b);
3942}
3943
3944static __inline__ vector signed short __ATTRS_o_ai
3945vec_eqv(vector signed short __a, vector signed short __b) {
3946 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3947 (vector unsigned int)__b);
3948}
3949
3950static __inline__ vector unsigned short __ATTRS_o_ai
3951vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3952 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3953 (vector unsigned int)__b);
3954}
3955
3956static __inline__ vector bool short __ATTRS_o_ai
3957vec_eqv(vector bool short __a, vector bool short __b) {
3958 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3959 (vector unsigned int)__b);
3960}
3961
3962static __inline__ vector signed int __ATTRS_o_ai
3963vec_eqv(vector signed int __a, vector signed int __b) {
3964 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3965 (vector unsigned int)__b);
3966}
3967
3968static __inline__ vector unsigned int __ATTRS_o_ai
3969vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3970 return __builtin_vsx_xxleqv(__a, __b);
3971}
3972
3973static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3974 vector bool int __b) {
3975 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3976 (vector unsigned int)__b);
3977}
3978
3979static __inline__ vector signed long long __ATTRS_o_ai
3980vec_eqv(vector signed long long __a, vector signed long long __b) {
3981 return (vector signed long long)__builtin_vsx_xxleqv(
3982 (vector unsigned int)__a, (vector unsigned int)__b);
3983}
3984
3985static __inline__ vector unsigned long long __ATTRS_o_ai
3986vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3987 return (vector unsigned long long)__builtin_vsx_xxleqv(
3988 (vector unsigned int)__a, (vector unsigned int)__b);
3989}
3990
3991static __inline__ vector bool long long __ATTRS_o_ai
3992vec_eqv(vector bool long long __a, vector bool long long __b) {
3993 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3994 (vector unsigned int)__b);
3995}
3996
3997static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3998 vector float __b) {
3999 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
4000 (vector unsigned int)__b);
4001}
4002
4003static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
4004 vector double __b) {
4005 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
4006 (vector unsigned int)__b);
4007}
4008#endif
4009
4010/* vec_expte */
4011
4012static __inline__ vector float __attribute__((__always_inline__))
4013vec_expte(vector float __a) {
4014 return __builtin_altivec_vexptefp(__a);
4015}
4016
4017/* vec_vexptefp */
4018
4019static __inline__ vector float __attribute__((__always_inline__))
4020vec_vexptefp(vector float __a) {
4021 return __builtin_altivec_vexptefp(__a);
4022}
4023
4024/* vec_floor */
4025
4026static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
4027#ifdef __VSX__
4028 return __builtin_vsx_xvrspim(__a);
4029#else
4030 return __builtin_altivec_vrfim(__a);
4031#endif
4032}
4033
4034#ifdef __VSX__
4035static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
4036 return __builtin_vsx_xvrdpim(__a);
4037}
4038#endif
4039
4040/* vec_roundm */
4041static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) {
4042 return vec_floor(__a);
4043}
4044
4045#ifdef __VSX__
4046static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) {
4047 return vec_floor(__a);
4048}
4049#endif
4050
4051/* vec_vrfim */
4052
4053static __inline__ vector float __attribute__((__always_inline__))
4054vec_vrfim(vector float __a) {
4055 return __builtin_altivec_vrfim(__a);
4056}
4057
4058/* vec_ld */
4059
4060static __inline__ vector signed char __ATTRS_o_ai
4061vec_ld(long __a, const vector signed char *__b) {
4062 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4063}
4064
4065static __inline__ vector signed char __ATTRS_o_ai
4066vec_ld(long __a, const signed char *__b) {
4067 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4068}
4069
4070static __inline__ vector unsigned char __ATTRS_o_ai
4071vec_ld(long __a, const vector unsigned char *__b) {
4072 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4073}
4074
4075static __inline__ vector unsigned char __ATTRS_o_ai
4076vec_ld(long __a, const unsigned char *__b) {
4077 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4078}
4079
4080static __inline__ vector bool char __ATTRS_o_ai
4081vec_ld(long __a, const vector bool char *__b) {
4082 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4083}
4084
4085static __inline__ vector short __ATTRS_o_ai vec_ld(long __a,
4086 const vector short *__b) {
4087 return (vector short)__builtin_altivec_lvx(__a, __b);
4088}
4089
4090static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) {
4091 return (vector short)__builtin_altivec_lvx(__a, __b);
4092}
4093
4094static __inline__ vector unsigned short __ATTRS_o_ai
4095vec_ld(long __a, const vector unsigned short *__b) {
4096 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4097}
4098
4099static __inline__ vector unsigned short __ATTRS_o_ai
4100vec_ld(long __a, const unsigned short *__b) {
4101 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4102}
4103
4104static __inline__ vector bool short __ATTRS_o_ai
4105vec_ld(long __a, const vector bool short *__b) {
4106 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4107}
4108
4109static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a,
4110 const vector pixel *__b) {
4111 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4112}
4113
4114static __inline__ vector int __ATTRS_o_ai vec_ld(long __a,
4115 const vector int *__b) {
4116 return (vector int)__builtin_altivec_lvx(__a, __b);
4117}
4118
4119static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) {
4120 return (vector int)__builtin_altivec_lvx(__a, __b);
4121}
4122
4123static __inline__ vector unsigned int __ATTRS_o_ai
4124vec_ld(long __a, const vector unsigned int *__b) {
4125 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4126}
4127
4128static __inline__ vector unsigned int __ATTRS_o_ai
4129vec_ld(long __a, const unsigned int *__b) {
4130 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4131}
4132
4133static __inline__ vector bool int __ATTRS_o_ai
4134vec_ld(long __a, const vector bool int *__b) {
4135 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4136}
4137
4138static __inline__ vector float __ATTRS_o_ai vec_ld(long __a,
4139 const vector float *__b) {
4140 return (vector float)__builtin_altivec_lvx(__a, __b);
4141}
4142
4143static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) {
4144 return (vector float)__builtin_altivec_lvx(__a, __b);
4145}
4146
4147/* vec_lvx */
4148
4149static __inline__ vector signed char __ATTRS_o_ai
4150vec_lvx(long __a, const vector signed char *__b) {
4151 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4152}
4153
4154static __inline__ vector signed char __ATTRS_o_ai
4155vec_lvx(long __a, const signed char *__b) {
4156 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4157}
4158
4159static __inline__ vector unsigned char __ATTRS_o_ai
4160vec_lvx(long __a, const vector unsigned char *__b) {
4161 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4162}
4163
4164static __inline__ vector unsigned char __ATTRS_o_ai
4165vec_lvx(long __a, const unsigned char *__b) {
4166 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4167}
4168
4169static __inline__ vector bool char __ATTRS_o_ai
4170vec_lvx(long __a, const vector bool char *__b) {
4171 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4172}
4173
4174static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a,
4175 const vector short *__b) {
4176 return (vector short)__builtin_altivec_lvx(__a, __b);
4177}
4178
4179static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) {
4180 return (vector short)__builtin_altivec_lvx(__a, __b);
4181}
4182
4183static __inline__ vector unsigned short __ATTRS_o_ai
4184vec_lvx(long __a, const vector unsigned short *__b) {
4185 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4186}
4187
4188static __inline__ vector unsigned short __ATTRS_o_ai
4189vec_lvx(long __a, const unsigned short *__b) {
4190 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4191}
4192
4193static __inline__ vector bool short __ATTRS_o_ai
4194vec_lvx(long __a, const vector bool short *__b) {
4195 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4196}
4197
4198static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a,
4199 const vector pixel *__b) {
4200 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4201}
4202
4203static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a,
4204 const vector int *__b) {
4205 return (vector int)__builtin_altivec_lvx(__a, __b);
4206}
4207
4208static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) {
4209 return (vector int)__builtin_altivec_lvx(__a, __b);
4210}
4211
4212static __inline__ vector unsigned int __ATTRS_o_ai
4213vec_lvx(long __a, const vector unsigned int *__b) {
4214 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4215}
4216
4217static __inline__ vector unsigned int __ATTRS_o_ai
4218vec_lvx(long __a, const unsigned int *__b) {
4219 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4220}
4221
4222static __inline__ vector bool int __ATTRS_o_ai
4223vec_lvx(long __a, const vector bool int *__b) {
4224 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4225}
4226
4227static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a,
4228 const vector float *__b) {
4229 return (vector float)__builtin_altivec_lvx(__a, __b);
4230}
4231
4232static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) {
4233 return (vector float)__builtin_altivec_lvx(__a, __b);
4234}
4235
4236/* vec_lde */
4237
4238static __inline__ vector signed char __ATTRS_o_ai
4239vec_lde(long __a, const signed char *__b) {
4240 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4241}
4242
4243static __inline__ vector unsigned char __ATTRS_o_ai
4244vec_lde(long __a, const unsigned char *__b) {
4245 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4246}
4247
4248static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) {
4249 return (vector short)__builtin_altivec_lvehx(__a, __b);
4250}
4251
4252static __inline__ vector unsigned short __ATTRS_o_ai
4253vec_lde(long __a, const unsigned short *__b) {
4254 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4255}
4256
4257static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) {
4258 return (vector int)__builtin_altivec_lvewx(__a, __b);
4259}
4260
4261static __inline__ vector unsigned int __ATTRS_o_ai
4262vec_lde(long __a, const unsigned int *__b) {
4263 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4264}
4265
4266static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) {
4267 return (vector float)__builtin_altivec_lvewx(__a, __b);
4268}
4269
4270/* vec_lvebx */
4271
4272static __inline__ vector signed char __ATTRS_o_ai
4273vec_lvebx(long __a, const signed char *__b) {
4274 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4275}
4276
4277static __inline__ vector unsigned char __ATTRS_o_ai
4278vec_lvebx(long __a, const unsigned char *__b) {
4279 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4280}
4281
4282/* vec_lvehx */
4283
4284static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a,
4285 const short *__b) {
4286 return (vector short)__builtin_altivec_lvehx(__a, __b);
4287}
4288
4289static __inline__ vector unsigned short __ATTRS_o_ai
4290vec_lvehx(long __a, const unsigned short *__b) {
4291 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4292}
4293
4294/* vec_lvewx */
4295
4296static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) {
4297 return (vector int)__builtin_altivec_lvewx(__a, __b);
4298}
4299
4300static __inline__ vector unsigned int __ATTRS_o_ai
4301vec_lvewx(long __a, const unsigned int *__b) {
4302 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4303}
4304
4305static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a,
4306 const float *__b) {
4307 return (vector float)__builtin_altivec_lvewx(__a, __b);
4308}
4309
4310/* vec_ldl */
4311
4312static __inline__ vector signed char __ATTRS_o_ai
4313vec_ldl(long __a, const vector signed char *__b) {
4314 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4315}
4316
4317static __inline__ vector signed char __ATTRS_o_ai
4318vec_ldl(long __a, const signed char *__b) {
4319 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4320}
4321
4322static __inline__ vector unsigned char __ATTRS_o_ai
4323vec_ldl(long __a, const vector unsigned char *__b) {
4324 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4325}
4326
4327static __inline__ vector unsigned char __ATTRS_o_ai
4328vec_ldl(long __a, const unsigned char *__b) {
4329 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4330}
4331
4332static __inline__ vector bool char __ATTRS_o_ai
4333vec_ldl(long __a, const vector bool char *__b) {
4334 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4335}
4336
4337static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a,
4338 const vector short *__b) {
4339 return (vector short)__builtin_altivec_lvxl(__a, __b);
4340}
4341
4342static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) {
4343 return (vector short)__builtin_altivec_lvxl(__a, __b);
4344}
4345
4346static __inline__ vector unsigned short __ATTRS_o_ai
4347vec_ldl(long __a, const vector unsigned short *__b) {
4348 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4349}
4350
4351static __inline__ vector unsigned short __ATTRS_o_ai
4352vec_ldl(long __a, const unsigned short *__b) {
4353 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4354}
4355
4356static __inline__ vector bool short __ATTRS_o_ai
4357vec_ldl(long __a, const vector bool short *__b) {
4358 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4359}
4360
4361static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a,
4362 const vector pixel *__b) {
4363 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
4364}
4365
4366static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a,
4367 const vector int *__b) {
4368 return (vector int)__builtin_altivec_lvxl(__a, __b);
4369}
4370
4371static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) {
4372 return (vector int)__builtin_altivec_lvxl(__a, __b);
4373}
4374
4375static __inline__ vector unsigned int __ATTRS_o_ai
4376vec_ldl(long __a, const vector unsigned int *__b) {
4377 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4378}
4379
4380static __inline__ vector unsigned int __ATTRS_o_ai
4381vec_ldl(long __a, const unsigned int *__b) {
4382 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4383}
4384
4385static __inline__ vector bool int __ATTRS_o_ai
4386vec_ldl(long __a, const vector bool int *__b) {
4387 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4388}
4389
4390static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a,
4391 const vector float *__b) {
4392 return (vector float)__builtin_altivec_lvxl(__a, __b);
4393}
4394
4395static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) {
4396 return (vector float)__builtin_altivec_lvxl(__a, __b);
4397}
4398
4399/* vec_lvxl */
4400
4401static __inline__ vector signed char __ATTRS_o_ai
4402vec_lvxl(long __a, const vector signed char *__b) {
4403 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4404}
4405
4406static __inline__ vector signed char __ATTRS_o_ai
4407vec_lvxl(long __a, const signed char *__b) {
4408 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4409}
4410
4411static __inline__ vector unsigned char __ATTRS_o_ai
4412vec_lvxl(long __a, const vector unsigned char *__b) {
4413 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4414}
4415
4416static __inline__ vector unsigned char __ATTRS_o_ai
4417vec_lvxl(long __a, const unsigned char *__b) {
4418 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4419}
4420
4421static __inline__ vector bool char __ATTRS_o_ai
4422vec_lvxl(long __a, const vector bool char *__b) {
4423 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4424}
4425
4426static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4427 const vector short *__b) {
4428 return (vector short)__builtin_altivec_lvxl(__a, __b);
4429}
4430
4431static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4432 const short *__b) {
4433 return (vector short)__builtin_altivec_lvxl(__a, __b);
4434}
4435
4436static __inline__ vector unsigned short __ATTRS_o_ai
4437vec_lvxl(long __a, const vector unsigned short *__b) {
4438 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4439}
4440
4441static __inline__ vector unsigned short __ATTRS_o_ai
4442vec_lvxl(long __a, const unsigned short *__b) {
4443 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4444}
4445
4446static __inline__ vector bool short __ATTRS_o_ai
4447vec_lvxl(long __a, const vector bool short *__b) {
4448 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4449}
4450
4451static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a,
4452 const vector pixel *__b) {
4453 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
4454}
4455
4456static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a,
4457 const vector int *__b) {
4458 return (vector int)__builtin_altivec_lvxl(__a, __b);
4459}
4460
4461static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) {
4462 return (vector int)__builtin_altivec_lvxl(__a, __b);
4463}
4464
4465static __inline__ vector unsigned int __ATTRS_o_ai
4466vec_lvxl(long __a, const vector unsigned int *__b) {
4467 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4468}
4469
4470static __inline__ vector unsigned int __ATTRS_o_ai
4471vec_lvxl(long __a, const unsigned int *__b) {
4472 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4473}
4474
4475static __inline__ vector bool int __ATTRS_o_ai
4476vec_lvxl(long __a, const vector bool int *__b) {
4477 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4478}
4479
4480static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4481 const vector float *__b) {
4482 return (vector float)__builtin_altivec_lvxl(__a, __b);
4483}
4484
4485static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4486 const float *__b) {
4487 return (vector float)__builtin_altivec_lvxl(__a, __b);
4488}
4489
4490/* vec_loge */
4491
4492static __inline__ vector float __attribute__((__always_inline__))
4493vec_loge(vector float __a) {
4494 return __builtin_altivec_vlogefp(__a);
4495}
4496
4497/* vec_vlogefp */
4498
4499static __inline__ vector float __attribute__((__always_inline__))
4500vec_vlogefp(vector float __a) {
4501 return __builtin_altivec_vlogefp(__a);
4502}
4503
4504/* vec_lvsl */
4505
4506#ifdef __LITTLE_ENDIAN__
4507static __inline__ vector unsigned char __ATTRS_o_ai
4508 __attribute__((__deprecated__("use assignment for unaligned little endian \
4509loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
4510 vector unsigned char mask =
4511 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4512 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4513 7, 6, 5, 4, 3, 2, 1, 0};
4514 return vec_perm(mask, mask, reverse);
4515}
4516#else
4517static __inline__ vector unsigned char __ATTRS_o_ai
4518vec_lvsl(int __a, const signed char *__b) {
4519 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4520}
4521#endif
4522
4523#ifdef __LITTLE_ENDIAN__
4524static __inline__ vector unsigned char __ATTRS_o_ai
4525 __attribute__((__deprecated__("use assignment for unaligned little endian \
4526loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
4527 vector unsigned char mask =
4528 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4529 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4530 7, 6, 5, 4, 3, 2, 1, 0};
4531 return vec_perm(mask, mask, reverse);
4532}
4533#else
4534static __inline__ vector unsigned char __ATTRS_o_ai
4535vec_lvsl(int __a, const unsigned char *__b) {
4536 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4537}
4538#endif
4539
4540#ifdef __LITTLE_ENDIAN__
4541static __inline__ vector unsigned char __ATTRS_o_ai
4542 __attribute__((__deprecated__("use assignment for unaligned little endian \
4543loads/stores"))) vec_lvsl(int __a, const short *__b) {
4544 vector unsigned char mask =
4545 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4546 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4547 7, 6, 5, 4, 3, 2, 1, 0};
4548 return vec_perm(mask, mask, reverse);
4549}
4550#else
4551static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4552 const short *__b) {
4553 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4554}
4555#endif
4556
4557#ifdef __LITTLE_ENDIAN__
4558static __inline__ vector unsigned char __ATTRS_o_ai
4559 __attribute__((__deprecated__("use assignment for unaligned little endian \
4560loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
4561 vector unsigned char mask =
4562 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4563 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4564 7, 6, 5, 4, 3, 2, 1, 0};
4565 return vec_perm(mask, mask, reverse);
4566}
4567#else
4568static __inline__ vector unsigned char __ATTRS_o_ai
4569vec_lvsl(int __a, const unsigned short *__b) {
4570 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4571}
4572#endif
4573
4574#ifdef __LITTLE_ENDIAN__
4575static __inline__ vector unsigned char __ATTRS_o_ai
4576 __attribute__((__deprecated__("use assignment for unaligned little endian \
4577loads/stores"))) vec_lvsl(int __a, const int *__b) {
4578 vector unsigned char mask =
4579 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4580 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4581 7, 6, 5, 4, 3, 2, 1, 0};
4582 return vec_perm(mask, mask, reverse);
4583}
4584#else
4585static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4586 const int *__b) {
4587 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4588}
4589#endif
4590
4591#ifdef __LITTLE_ENDIAN__
4592static __inline__ vector unsigned char __ATTRS_o_ai
4593 __attribute__((__deprecated__("use assignment for unaligned little endian \
4594loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
4595 vector unsigned char mask =
4596 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4597 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4598 7, 6, 5, 4, 3, 2, 1, 0};
4599 return vec_perm(mask, mask, reverse);
4600}
4601#else
4602static __inline__ vector unsigned char __ATTRS_o_ai
4603vec_lvsl(int __a, const unsigned int *__b) {
4604 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4605}
4606#endif
4607
4608#ifdef __LITTLE_ENDIAN__
4609static __inline__ vector unsigned char __ATTRS_o_ai
4610 __attribute__((__deprecated__("use assignment for unaligned little endian \
4611loads/stores"))) vec_lvsl(int __a, const float *__b) {
4612 vector unsigned char mask =
4613 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4614 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4615 7, 6, 5, 4, 3, 2, 1, 0};
4616 return vec_perm(mask, mask, reverse);
4617}
4618#else
4619static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4620 const float *__b) {
4621 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4622}
4623#endif
4624
4625/* vec_lvsr */
4626
4627#ifdef __LITTLE_ENDIAN__
4628static __inline__ vector unsigned char __ATTRS_o_ai
4629 __attribute__((__deprecated__("use assignment for unaligned little endian \
4630loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4631 vector unsigned char mask =
4632 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4633 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4634 7, 6, 5, 4, 3, 2, 1, 0};
4635 return vec_perm(mask, mask, reverse);
4636}
4637#else
4638static __inline__ vector unsigned char __ATTRS_o_ai
4639vec_lvsr(int __a, const signed char *__b) {
4640 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4641}
4642#endif
4643
4644#ifdef __LITTLE_ENDIAN__
4645static __inline__ vector unsigned char __ATTRS_o_ai
4646 __attribute__((__deprecated__("use assignment for unaligned little endian \
4647loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4648 vector unsigned char mask =
4649 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4650 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4651 7, 6, 5, 4, 3, 2, 1, 0};
4652 return vec_perm(mask, mask, reverse);
4653}
4654#else
4655static __inline__ vector unsigned char __ATTRS_o_ai
4656vec_lvsr(int __a, const unsigned char *__b) {
4657 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4658}
4659#endif
4660
4661#ifdef __LITTLE_ENDIAN__
4662static __inline__ vector unsigned char __ATTRS_o_ai
4663 __attribute__((__deprecated__("use assignment for unaligned little endian \
4664loads/stores"))) vec_lvsr(int __a, const short *__b) {
4665 vector unsigned char mask =
4666 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4667 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4668 7, 6, 5, 4, 3, 2, 1, 0};
4669 return vec_perm(mask, mask, reverse);
4670}
4671#else
4672static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4673 const short *__b) {
4674 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4675}
4676#endif
4677
4678#ifdef __LITTLE_ENDIAN__
4679static __inline__ vector unsigned char __ATTRS_o_ai
4680 __attribute__((__deprecated__("use assignment for unaligned little endian \
4681loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4682 vector unsigned char mask =
4683 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4684 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4685 7, 6, 5, 4, 3, 2, 1, 0};
4686 return vec_perm(mask, mask, reverse);
4687}
4688#else
4689static __inline__ vector unsigned char __ATTRS_o_ai
4690vec_lvsr(int __a, const unsigned short *__b) {
4691 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4692}
4693#endif
4694
4695#ifdef __LITTLE_ENDIAN__
4696static __inline__ vector unsigned char __ATTRS_o_ai
4697 __attribute__((__deprecated__("use assignment for unaligned little endian \
4698loads/stores"))) vec_lvsr(int __a, const int *__b) {
4699 vector unsigned char mask =
4700 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4701 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4702 7, 6, 5, 4, 3, 2, 1, 0};
4703 return vec_perm(mask, mask, reverse);
4704}
4705#else
4706static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4707 const int *__b) {
4708 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4709}
4710#endif
4711
4712#ifdef __LITTLE_ENDIAN__
4713static __inline__ vector unsigned char __ATTRS_o_ai
4714 __attribute__((__deprecated__("use assignment for unaligned little endian \
4715loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4716 vector unsigned char mask =
4717 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4718 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4719 7, 6, 5, 4, 3, 2, 1, 0};
4720 return vec_perm(mask, mask, reverse);
4721}
4722#else
4723static __inline__ vector unsigned char __ATTRS_o_ai
4724vec_lvsr(int __a, const unsigned int *__b) {
4725 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4726}
4727#endif
4728
4729#ifdef __LITTLE_ENDIAN__
4730static __inline__ vector unsigned char __ATTRS_o_ai
4731 __attribute__((__deprecated__("use assignment for unaligned little endian \
4732loads/stores"))) vec_lvsr(int __a, const float *__b) {
4733 vector unsigned char mask =
4734 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4735 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4736 7, 6, 5, 4, 3, 2, 1, 0};
4737 return vec_perm(mask, mask, reverse);
4738}
4739#else
4740static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4741 const float *__b) {
4742 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4743}
4744#endif
4745
4746/* vec_madd */
4747static __inline__ vector signed short __ATTRS_o_ai
4748vec_mladd(vector signed short, vector signed short, vector signed short);
4749static __inline__ vector signed short __ATTRS_o_ai
4750vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4751static __inline__ vector signed short __ATTRS_o_ai
4752vec_mladd(vector unsigned short, vector signed short, vector signed short);
4753static __inline__ vector unsigned short __ATTRS_o_ai
4754vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4755
4756static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4757 vector signed short __a, vector signed short __b, vector signed short __c) {
4758 return vec_mladd(__a, __b, __c);
4759}
4760
4761static __inline__ vector signed short __ATTRS_o_ai
4762vec_madd(vector signed short __a, vector unsigned short __b,
4763 vector unsigned short __c) {
4764 return vec_mladd(__a, __b, __c);
4765}
4766
4767static __inline__ vector signed short __ATTRS_o_ai
4768vec_madd(vector unsigned short __a, vector signed short __b,
4769 vector signed short __c) {
4770 return vec_mladd(__a, __b, __c);
4771}
4772
4773static __inline__ vector unsigned short __ATTRS_o_ai
4774vec_madd(vector unsigned short __a, vector unsigned short __b,
4775 vector unsigned short __c) {
4776 return vec_mladd(__a, __b, __c);
4777}
4778
4779static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4780 vector float __b,
4781 vector float __c) {
4782#ifdef __VSX__
4783 return __builtin_vsx_xvmaddasp(__a, __b, __c);
4784#else
4785 return __builtin_altivec_vmaddfp(__a, __b, __c);
4786#endif
4787}
4788
4789#ifdef __VSX__
4790static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4791 vector double __b,
4792 vector double __c) {
4793 return __builtin_vsx_xvmaddadp(__a, __b, __c);
4794}
4795#endif
4796
4797/* vec_vmaddfp */
4798
4799static __inline__ vector float __attribute__((__always_inline__))
4800vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4801 return __builtin_altivec_vmaddfp(__a, __b, __c);
4802}
4803
4804/* vec_madds */
4805
4806static __inline__ vector signed short __attribute__((__always_inline__))
4807vec_madds(vector signed short __a, vector signed short __b,
4808 vector signed short __c) {
4809 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4810}
4811
4812/* vec_vmhaddshs */
4813static __inline__ vector signed short __attribute__((__always_inline__))
4814vec_vmhaddshs(vector signed short __a, vector signed short __b,
4815 vector signed short __c) {
4816 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4817}
4818
4819/* vec_msub */
4820
4821#ifdef __VSX__
4822static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4823 vector float __b,
4824 vector float __c) {
4825 return __builtin_vsx_xvmsubasp(__a, __b, __c);
4826}
4827
4828static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4829 vector double __b,
4830 vector double __c) {
4831 return __builtin_vsx_xvmsubadp(__a, __b, __c);
4832}
4833#endif
4834
4835/* vec_max */
4836
4837static __inline__ vector signed char __ATTRS_o_ai
4838vec_max(vector signed char __a, vector signed char __b) {
4839 return __builtin_altivec_vmaxsb(__a, __b);
4840}
4841
4842static __inline__ vector signed char __ATTRS_o_ai
4843vec_max(vector bool char __a, vector signed char __b) {
4844 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4845}
4846
4847static __inline__ vector signed char __ATTRS_o_ai
4848vec_max(vector signed char __a, vector bool char __b) {
4849 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4850}
4851
4852static __inline__ vector unsigned char __ATTRS_o_ai
4853vec_max(vector unsigned char __a, vector unsigned char __b) {
4854 return __builtin_altivec_vmaxub(__a, __b);
4855}
4856
4857static __inline__ vector unsigned char __ATTRS_o_ai
4858vec_max(vector bool char __a, vector unsigned char __b) {
4859 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4860}
4861
4862static __inline__ vector unsigned char __ATTRS_o_ai
4863vec_max(vector unsigned char __a, vector bool char __b) {
4864 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4865}
4866
4867static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4868 vector short __b) {
4869 return __builtin_altivec_vmaxsh(__a, __b);
4870}
4871
4872static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4873 vector short __b) {
4874 return __builtin_altivec_vmaxsh((vector short)__a, __b);
4875}
4876
4877static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4878 vector bool short __b) {
4879 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4880}
4881
4882static __inline__ vector unsigned short __ATTRS_o_ai
4883vec_max(vector unsigned short __a, vector unsigned short __b) {
4884 return __builtin_altivec_vmaxuh(__a, __b);
4885}
4886
4887static __inline__ vector unsigned short __ATTRS_o_ai
4888vec_max(vector bool short __a, vector unsigned short __b) {
4889 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4890}
4891
4892static __inline__ vector unsigned short __ATTRS_o_ai
4893vec_max(vector unsigned short __a, vector bool short __b) {
4894 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4895}
4896
4897static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4898 vector int __b) {
4899 return __builtin_altivec_vmaxsw(__a, __b);
4900}
4901
4902static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4903 vector int __b) {
4904 return __builtin_altivec_vmaxsw((vector int)__a, __b);
4905}
4906
4907static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4908 vector bool int __b) {
4909 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4910}
4911
4912static __inline__ vector unsigned int __ATTRS_o_ai
4913vec_max(vector unsigned int __a, vector unsigned int __b) {
4914 return __builtin_altivec_vmaxuw(__a, __b);
4915}
4916
4917static __inline__ vector unsigned int __ATTRS_o_ai
4918vec_max(vector bool int __a, vector unsigned int __b) {
4919 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4920}
4921
4922static __inline__ vector unsigned int __ATTRS_o_ai
4923vec_max(vector unsigned int __a, vector bool int __b) {
4924 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4925}
4926
4927#ifdef __POWER8_VECTOR__
4928static __inline__ vector signed long long __ATTRS_o_ai
4929vec_max(vector signed long long __a, vector signed long long __b) {
4930 return __builtin_altivec_vmaxsd(__a, __b);
4931}
4932
4933static __inline__ vector signed long long __ATTRS_o_ai
4934vec_max(vector bool long long __a, vector signed long long __b) {
4935 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4936}
4937
4938static __inline__ vector signed long long __ATTRS_o_ai
4939vec_max(vector signed long long __a, vector bool long long __b) {
4940 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4941}
4942
4943static __inline__ vector unsigned long long __ATTRS_o_ai
4944vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4945 return __builtin_altivec_vmaxud(__a, __b);
4946}
4947
4948static __inline__ vector unsigned long long __ATTRS_o_ai
4949vec_max(vector bool long long __a, vector unsigned long long __b) {
4950 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4951}
4952
4953static __inline__ vector unsigned long long __ATTRS_o_ai
4954vec_max(vector unsigned long long __a, vector bool long long __b) {
4955 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4956}
4957#endif
4958
4959static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4960 vector float __b) {
4961#ifdef __VSX__
4962 return __builtin_vsx_xvmaxsp(__a, __b);
4963#else
4964 return __builtin_altivec_vmaxfp(__a, __b);
4965#endif
4966}
4967
4968#ifdef __VSX__
4969static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4970 vector double __b) {
4971 return __builtin_vsx_xvmaxdp(__a, __b);
4972}
4973#endif
4974
4975/* vec_vmaxsb */
4976
4977static __inline__ vector signed char __ATTRS_o_ai
4978vec_vmaxsb(vector signed char __a, vector signed char __b) {
4979 return __builtin_altivec_vmaxsb(__a, __b);
4980}
4981
4982static __inline__ vector signed char __ATTRS_o_ai
4983vec_vmaxsb(vector bool char __a, vector signed char __b) {
4984 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4985}
4986
4987static __inline__ vector signed char __ATTRS_o_ai
4988vec_vmaxsb(vector signed char __a, vector bool char __b) {
4989 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4990}
4991
4992/* vec_vmaxub */
4993
4994static __inline__ vector unsigned char __ATTRS_o_ai
4995vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4996 return __builtin_altivec_vmaxub(__a, __b);
4997}
4998
4999static __inline__ vector unsigned char __ATTRS_o_ai
5000vec_vmaxub(vector bool char __a, vector unsigned char __b) {
5001 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
5002}
5003
5004static __inline__ vector unsigned char __ATTRS_o_ai
5005vec_vmaxub(vector unsigned char __a, vector bool char __b) {
5006 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
5007}
5008
5009/* vec_vmaxsh */
5010
5011static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5012 vector short __b) {
5013 return __builtin_altivec_vmaxsh(__a, __b);
5014}
5015
5016static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
5017 vector short __b) {
5018 return __builtin_altivec_vmaxsh((vector short)__a, __b);
5019}
5020
5021static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5022 vector bool short __b) {
5023 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
5024}
5025
5026/* vec_vmaxuh */
5027
5028static __inline__ vector unsigned short __ATTRS_o_ai
5029vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
5030 return __builtin_altivec_vmaxuh(__a, __b);
5031}
5032
5033static __inline__ vector unsigned short __ATTRS_o_ai
5034vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
5035 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
5036}
5037
5038static __inline__ vector unsigned short __ATTRS_o_ai
5039vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
5040 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
5041}
5042
5043/* vec_vmaxsw */
5044
5045static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5046 vector int __b) {
5047 return __builtin_altivec_vmaxsw(__a, __b);
5048}
5049
5050static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
5051 vector int __b) {
5052 return __builtin_altivec_vmaxsw((vector int)__a, __b);
5053}
5054
5055static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5056 vector bool int __b) {
5057 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
5058}
5059
5060/* vec_vmaxuw */
5061
5062static __inline__ vector unsigned int __ATTRS_o_ai
5063vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
5064 return __builtin_altivec_vmaxuw(__a, __b);
5065}
5066
5067static __inline__ vector unsigned int __ATTRS_o_ai
5068vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
5069 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
5070}
5071
5072static __inline__ vector unsigned int __ATTRS_o_ai
5073vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
5074 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
5075}
5076
5077/* vec_vmaxfp */
5078
5079static __inline__ vector float __attribute__((__always_inline__))
5080vec_vmaxfp(vector float __a, vector float __b) {
5081#ifdef __VSX__
5082 return __builtin_vsx_xvmaxsp(__a, __b);
5083#else
5084 return __builtin_altivec_vmaxfp(__a, __b);
5085#endif
5086}
5087
5088/* vec_mergeh */
5089
5090static __inline__ vector signed char __ATTRS_o_ai
5091vec_mergeh(vector signed char __a, vector signed char __b) {
5092 return vec_perm(__a, __b,
5093 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5094 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5095 0x06, 0x16, 0x07, 0x17));
5096}
5097
5098static __inline__ vector unsigned char __ATTRS_o_ai
5099vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
5100 return vec_perm(__a, __b,
5101 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5102 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5103 0x06, 0x16, 0x07, 0x17));
5104}
5105
5106static __inline__ vector bool char __ATTRS_o_ai
5107vec_mergeh(vector bool char __a, vector bool char __b) {
5108 return vec_perm(__a, __b,
5109 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5110 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5111 0x06, 0x16, 0x07, 0x17));
5112}
5113
5114static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
5115 vector short __b) {
5116 return vec_perm(__a, __b,
5117 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5118 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5119 0x06, 0x07, 0x16, 0x17));
5120}
5121
5122static __inline__ vector unsigned short __ATTRS_o_ai
5123vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
5124 return vec_perm(__a, __b,
5125 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5126 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5127 0x06, 0x07, 0x16, 0x17));
5128}
5129
5130static __inline__ vector bool short __ATTRS_o_ai
5131vec_mergeh(vector bool short __a, vector bool short __b) {
5132 return vec_perm(__a, __b,
5133 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5134 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5135 0x06, 0x07, 0x16, 0x17));
5136}
5137
5138static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
5139 vector pixel __b) {
5140 return vec_perm(__a, __b,
5141 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5142 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5143 0x06, 0x07, 0x16, 0x17));
5144}
5145
5146static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
5147 vector int __b) {
5148 return vec_perm(__a, __b,
5149 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5150 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5151 0x14, 0x15, 0x16, 0x17));
5152}
5153
5154static __inline__ vector unsigned int __ATTRS_o_ai
5155vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
5156 return vec_perm(__a, __b,
5157 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5158 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5159 0x14, 0x15, 0x16, 0x17));
5160}
5161
5162static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
5163 vector bool int __b) {
5164 return vec_perm(__a, __b,
5165 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5166 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5167 0x14, 0x15, 0x16, 0x17));
5168}
5169
5170static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
5171 vector float __b) {
5172 return vec_perm(__a, __b,
5173 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5174 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5175 0x14, 0x15, 0x16, 0x17));
5176}
5177
5178#ifdef __VSX__
5179static __inline__ vector signed long long __ATTRS_o_ai
5180vec_mergeh(vector signed long long __a, vector signed long long __b) {
5181 return vec_perm(__a, __b,
5182 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5183 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5184 0x14, 0x15, 0x16, 0x17));
5185}
5186
5187static __inline__ vector signed long long __ATTRS_o_ai
5188vec_mergeh(vector signed long long __a, vector bool long long __b) {
5189 return vec_perm(__a, (vector signed long long)__b,
5190 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5191 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5192 0x14, 0x15, 0x16, 0x17));
5193}
5194
5195static __inline__ vector signed long long __ATTRS_o_ai
5196vec_mergeh(vector bool long long __a, vector signed long long __b) {
5197 return vec_perm((vector signed long long)__a, __b,
5198 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5199 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5200 0x14, 0x15, 0x16, 0x17));
5201}
5202
5203static __inline__ vector unsigned long long __ATTRS_o_ai
5204vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
5205 return vec_perm(__a, __b,
5206 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5207 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5208 0x14, 0x15, 0x16, 0x17));
5209}
5210
5211static __inline__ vector unsigned long long __ATTRS_o_ai
5212vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
5213 return vec_perm(__a, (vector unsigned long long)__b,
5214 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5215 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5216 0x14, 0x15, 0x16, 0x17));
5217}
5218
5219static __inline__ vector unsigned long long __ATTRS_o_ai
5220vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
5221 return vec_perm((vector unsigned long long)__a, __b,
5222 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5223 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5224 0x14, 0x15, 0x16, 0x17));
5225}
5226
5227static __inline__ vector bool long long __ATTRS_o_ai
5228vec_mergeh(vector bool long long __a, vector bool long long __b) {
5229 return vec_perm(__a, __b,
5230 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5231 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5232 0x14, 0x15, 0x16, 0x17));
5233}
5234
5235static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
5236 vector double __b) {
5237 return vec_perm(__a, __b,
5238 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5239 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5240 0x14, 0x15, 0x16, 0x17));
5241}
5242static __inline__ vector double __ATTRS_o_ai
5243vec_mergeh(vector double __a, vector bool long long __b) {
5244 return vec_perm(__a, (vector double)__b,
5245 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5246 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5247 0x14, 0x15, 0x16, 0x17));
5248}
5249static __inline__ vector double __ATTRS_o_ai
5250vec_mergeh(vector bool long long __a, vector double __b) {
5251 return vec_perm((vector double)__a, __b,
5252 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5253 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5254 0x14, 0x15, 0x16, 0x17));
5255}
5256#endif
5257
5258/* vec_vmrghb */
5259
5260#define __builtin_altivec_vmrghb vec_vmrghb
5261
5262static __inline__ vector signed char __ATTRS_o_ai
5263vec_vmrghb(vector signed char __a, vector signed char __b) {
5264 return vec_perm(__a, __b,
5265 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5266 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5267 0x06, 0x16, 0x07, 0x17));
5268}
5269
5270static __inline__ vector unsigned char __ATTRS_o_ai
5271vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
5272 return vec_perm(__a, __b,
5273 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5274 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5275 0x06, 0x16, 0x07, 0x17));
5276}
5277
5278static __inline__ vector bool char __ATTRS_o_ai
5279vec_vmrghb(vector bool char __a, vector bool char __b) {
5280 return vec_perm(__a, __b,
5281 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5282 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5283 0x06, 0x16, 0x07, 0x17));
5284}
5285
5286/* vec_vmrghh */
5287
5288#define __builtin_altivec_vmrghh vec_vmrghh
5289
5290static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
5291 vector short __b) {
5292 return vec_perm(__a, __b,
5293 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5294 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5295 0x06, 0x07, 0x16, 0x17));
5296}
5297
5298static __inline__ vector unsigned short __ATTRS_o_ai
5299vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
5300 return vec_perm(__a, __b,
5301 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5302 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5303 0x06, 0x07, 0x16, 0x17));
5304}
5305
5306static __inline__ vector bool short __ATTRS_o_ai
5307vec_vmrghh(vector bool short __a, vector bool short __b) {
5308 return vec_perm(__a, __b,
5309 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5310 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5311 0x06, 0x07, 0x16, 0x17));
5312}
5313
5314static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
5315 vector pixel __b) {
5316 return vec_perm(__a, __b,
5317 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5318 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5319 0x06, 0x07, 0x16, 0x17));
5320}
5321
5322/* vec_vmrghw */
5323
5324#define __builtin_altivec_vmrghw vec_vmrghw
5325
5326static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
5327 vector int __b) {
5328 return vec_perm(__a, __b,
5329 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5330 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5331 0x14, 0x15, 0x16, 0x17));
5332}
5333
5334static __inline__ vector unsigned int __ATTRS_o_ai
5335vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
5336 return vec_perm(__a, __b,
5337 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5338 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5339 0x14, 0x15, 0x16, 0x17));
5340}
5341
5342static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
5343 vector bool int __b) {
5344 return vec_perm(__a, __b,
5345 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5346 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5347 0x14, 0x15, 0x16, 0x17));
5348}
5349
5350static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
5351 vector float __b) {
5352 return vec_perm(__a, __b,
5353 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5354 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5355 0x14, 0x15, 0x16, 0x17));
5356}
5357
5358/* vec_mergel */
5359
5360static __inline__ vector signed char __ATTRS_o_ai
5361vec_mergel(vector signed char __a, vector signed char __b) {
5362 return vec_perm(__a, __b,
5363 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5364 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5365 0x0E, 0x1E, 0x0F, 0x1F));
5366}
5367
5368static __inline__ vector unsigned char __ATTRS_o_ai
5369vec_mergel(vector unsigned char __a, vector unsigned char __b) {
5370 return vec_perm(__a, __b,
5371 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5372 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5373 0x0E, 0x1E, 0x0F, 0x1F));
5374}
5375
5376static __inline__ vector bool char __ATTRS_o_ai
5377vec_mergel(vector bool char __a, vector bool char __b) {
5378 return vec_perm(__a, __b,
5379 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5380 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5381 0x0E, 0x1E, 0x0F, 0x1F));
5382}
5383
5384static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
5385 vector short __b) {
5386 return vec_perm(__a, __b,
5387 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5388 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5389 0x0E, 0x0F, 0x1E, 0x1F));
5390}
5391
5392static __inline__ vector unsigned short __ATTRS_o_ai
5393vec_mergel(vector unsigned short __a, vector unsigned short __b) {
5394 return vec_perm(__a, __b,
5395 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5396 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5397 0x0E, 0x0F, 0x1E, 0x1F));
5398}
5399
5400static __inline__ vector bool short __ATTRS_o_ai
5401vec_mergel(vector bool short __a, vector bool short __b) {
5402 return vec_perm(__a, __b,
5403 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5404 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5405 0x0E, 0x0F, 0x1E, 0x1F));
5406}
5407
5408static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
5409 vector pixel __b) {
5410 return vec_perm(__a, __b,
5411 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5412 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5413 0x0E, 0x0F, 0x1E, 0x1F));
5414}
5415
5416static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
5417 vector int __b) {
5418 return vec_perm(__a, __b,
5419 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5420 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5421 0x1C, 0x1D, 0x1E, 0x1F));
5422}
5423
5424static __inline__ vector unsigned int __ATTRS_o_ai
5425vec_mergel(vector unsigned int __a, vector unsigned int __b) {
5426 return vec_perm(__a, __b,
5427 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5428 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5429 0x1C, 0x1D, 0x1E, 0x1F));
5430}
5431
5432static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
5433 vector bool int __b) {
5434 return vec_perm(__a, __b,
5435 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5436 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5437 0x1C, 0x1D, 0x1E, 0x1F));
5438}
5439
5440static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
5441 vector float __b) {
5442 return vec_perm(__a, __b,
5443 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5444 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5445 0x1C, 0x1D, 0x1E, 0x1F));
5446}
5447
5448#ifdef __VSX__
5449static __inline__ vector signed long long __ATTRS_o_ai
5450vec_mergel(vector signed long long __a, vector signed long long __b) {
5451 return vec_perm(__a, __b,
5452 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5453 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5454 0x1C, 0x1D, 0x1E, 0x1F));
5455}
5456static __inline__ vector signed long long __ATTRS_o_ai
5457vec_mergel(vector signed long long __a, vector bool long long __b) {
5458 return vec_perm(__a, (vector signed long long)__b,
5459 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5460 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5461 0x1C, 0x1D, 0x1E, 0x1F));
5462}
5463static __inline__ vector signed long long __ATTRS_o_ai
5464vec_mergel(vector bool long long __a, vector signed long long __b) {
5465 return vec_perm((vector signed long long)__a, __b,
5466 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5467 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5468 0x1C, 0x1D, 0x1E, 0x1F));
5469}
5470static __inline__ vector unsigned long long __ATTRS_o_ai
5471vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
5472 return vec_perm(__a, __b,
5473 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5474 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5475 0x1C, 0x1D, 0x1E, 0x1F));
5476}
5477static __inline__ vector unsigned long long __ATTRS_o_ai
5478vec_mergel(vector unsigned long long __a, vector bool long long __b) {
5479 return vec_perm(__a, (vector unsigned long long)__b,
5480 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5481 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5482 0x1C, 0x1D, 0x1E, 0x1F));
5483}
5484static __inline__ vector unsigned long long __ATTRS_o_ai
5485vec_mergel(vector bool long long __a, vector unsigned long long __b) {
5486 return vec_perm((vector unsigned long long)__a, __b,
5487 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5488 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5489 0x1C, 0x1D, 0x1E, 0x1F));
5490}
5491static __inline__ vector bool long long __ATTRS_o_ai
5492vec_mergel(vector bool long long __a, vector bool long long __b) {
5493 return vec_perm(__a, __b,
5494 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5495 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5496 0x1C, 0x1D, 0x1E, 0x1F));
5497}
5498static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
5499 vector double __b) {
5500 return vec_perm(__a, __b,
5501 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5502 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5503 0x1C, 0x1D, 0x1E, 0x1F));
5504}
5505static __inline__ vector double __ATTRS_o_ai
5506vec_mergel(vector double __a, vector bool long long __b) {
5507 return vec_perm(__a, (vector double)__b,
5508 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5509 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5510 0x1C, 0x1D, 0x1E, 0x1F));
5511}
5512static __inline__ vector double __ATTRS_o_ai
5513vec_mergel(vector bool long long __a, vector double __b) {
5514 return vec_perm((vector double)__a, __b,
5515 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5516 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5517 0x1C, 0x1D, 0x1E, 0x1F));
5518}
5519#endif
5520
5521/* vec_vmrglb */
5522
5523#define __builtin_altivec_vmrglb vec_vmrglb
5524
5525static __inline__ vector signed char __ATTRS_o_ai
5526vec_vmrglb(vector signed char __a, vector signed char __b) {
5527 return vec_perm(__a, __b,
5528 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5529 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5530 0x0E, 0x1E, 0x0F, 0x1F));
5531}
5532
5533static __inline__ vector unsigned char __ATTRS_o_ai
5534vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
5535 return vec_perm(__a, __b,
5536 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5537 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5538 0x0E, 0x1E, 0x0F, 0x1F));
5539}
5540
5541static __inline__ vector bool char __ATTRS_o_ai
5542vec_vmrglb(vector bool char __a, vector bool char __b) {
5543 return vec_perm(__a, __b,
5544 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5545 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5546 0x0E, 0x1E, 0x0F, 0x1F));
5547}
5548
5549/* vec_vmrglh */
5550
5551#define __builtin_altivec_vmrglh vec_vmrglh
5552
5553static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
5554 vector short __b) {
5555 return vec_perm(__a, __b,
5556 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5557 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5558 0x0E, 0x0F, 0x1E, 0x1F));
5559}
5560
5561static __inline__ vector unsigned short __ATTRS_o_ai
5562vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
5563 return vec_perm(__a, __b,
5564 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5565 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5566 0x0E, 0x0F, 0x1E, 0x1F));
5567}
5568
5569static __inline__ vector bool short __ATTRS_o_ai
5570vec_vmrglh(vector bool short __a, vector bool short __b) {
5571 return vec_perm(__a, __b,
5572 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5573 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5574 0x0E, 0x0F, 0x1E, 0x1F));
5575}
5576
5577static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
5578 vector pixel __b) {
5579 return vec_perm(__a, __b,
5580 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5581 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5582 0x0E, 0x0F, 0x1E, 0x1F));
5583}
5584
5585/* vec_vmrglw */
5586
5587#define __builtin_altivec_vmrglw vec_vmrglw
5588
5589static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
5590 vector int __b) {
5591 return vec_perm(__a, __b,
5592 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5593 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5594 0x1C, 0x1D, 0x1E, 0x1F));
5595}
5596
5597static __inline__ vector unsigned int __ATTRS_o_ai
5598vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
5599 return vec_perm(__a, __b,
5600 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5601 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5602 0x1C, 0x1D, 0x1E, 0x1F));
5603}
5604
5605static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5606 vector bool int __b) {
5607 return vec_perm(__a, __b,
5608 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5609 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5610 0x1C, 0x1D, 0x1E, 0x1F));
5611}
5612
5613static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5614 vector float __b) {
5615 return vec_perm(__a, __b,
5616 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5617 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5618 0x1C, 0x1D, 0x1E, 0x1F));
5619}
5620
5621#ifdef __POWER8_VECTOR__
5622/* vec_mergee */
5623
5624static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5625 vector bool int __b) {
5626 return vec_perm(__a, __b,
5627 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5628 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5629 0x18, 0x19, 0x1A, 0x1B));
5630}
5631
5632static __inline__ vector signed int __ATTRS_o_ai
5633vec_mergee(vector signed int __a, vector signed int __b) {
5634 return vec_perm(__a, __b,
5635 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5636 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5637 0x18, 0x19, 0x1A, 0x1B));
5638}
5639
5640static __inline__ vector unsigned int __ATTRS_o_ai
5641vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5642 return vec_perm(__a, __b,
5643 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5644 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5645 0x18, 0x19, 0x1A, 0x1B));
5646}
5647
5648static __inline__ vector bool long long __ATTRS_o_ai
5649vec_mergee(vector bool long long __a, vector bool long long __b) {
5650 return vec_mergeh(__a, __b);
5651}
5652
5653static __inline__ vector signed long long __ATTRS_o_ai
5654vec_mergee(vector signed long long __a, vector signed long long __b) {
5655 return vec_mergeh(__a, __b);
5656}
5657
5658static __inline__ vector unsigned long long __ATTRS_o_ai
5659vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5660 return vec_mergeh(__a, __b);
5661}
5662
5663static __inline__ vector float __ATTRS_o_ai
5664vec_mergee(vector float __a, vector float __b) {
5665 return vec_perm(__a, __b,
5666 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5667 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5668 0x18, 0x19, 0x1A, 0x1B));
5669}
5670
5671static __inline__ vector double __ATTRS_o_ai
5672vec_mergee(vector double __a, vector double __b) {
5673 return vec_mergeh(__a, __b);
5674}
5675
5676/* vec_mergeo */
5677
5678static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5679 vector bool int __b) {
5680 return vec_perm(__a, __b,
5681 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5682 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5683 0x1C, 0x1D, 0x1E, 0x1F));
5684}
5685
5686static __inline__ vector signed int __ATTRS_o_ai
5687vec_mergeo(vector signed int __a, vector signed int __b) {
5688 return vec_perm(__a, __b,
5689 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5690 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5691 0x1C, 0x1D, 0x1E, 0x1F));
5692}
5693
5694static __inline__ vector unsigned int __ATTRS_o_ai
5695vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5696 return vec_perm(__a, __b,
5697 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5698 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5699 0x1C, 0x1D, 0x1E, 0x1F));
5700}
5701
5702static __inline__ vector bool long long __ATTRS_o_ai
5703vec_mergeo(vector bool long long __a, vector bool long long __b) {
5704 return vec_mergel(__a, __b);
5705}
5706
5707static __inline__ vector signed long long __ATTRS_o_ai
5708vec_mergeo(vector signed long long __a, vector signed long long __b) {
5709 return vec_mergel(__a, __b);
5710}
5711
5712static __inline__ vector unsigned long long __ATTRS_o_ai
5713vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5714 return vec_mergel(__a, __b);
5715}
5716
5717static __inline__ vector float __ATTRS_o_ai
5718vec_mergeo(vector float __a, vector float __b) {
5719 return vec_perm(__a, __b,
5720 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5721 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5722 0x1C, 0x1D, 0x1E, 0x1F));
5723}
5724
5725static __inline__ vector double __ATTRS_o_ai
5726vec_mergeo(vector double __a, vector double __b) {
5727 return vec_mergel(__a, __b);
5728}
5729
5730#endif
5731
5732/* vec_mfvscr */
5733
5734static __inline__ vector unsigned short __attribute__((__always_inline__))
5735vec_mfvscr(void) {
5736 return __builtin_altivec_mfvscr();
5737}
5738
5739/* vec_min */
5740
5741static __inline__ vector signed char __ATTRS_o_ai
5742vec_min(vector signed char __a, vector signed char __b) {
5743 return __builtin_altivec_vminsb(__a, __b);
5744}
5745
5746static __inline__ vector signed char __ATTRS_o_ai
5747vec_min(vector bool char __a, vector signed char __b) {
5748 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5749}
5750
5751static __inline__ vector signed char __ATTRS_o_ai
5752vec_min(vector signed char __a, vector bool char __b) {
5753 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5754}
5755
5756static __inline__ vector unsigned char __ATTRS_o_ai
5757vec_min(vector unsigned char __a, vector unsigned char __b) {
5758 return __builtin_altivec_vminub(__a, __b);
5759}
5760
5761static __inline__ vector unsigned char __ATTRS_o_ai
5762vec_min(vector bool char __a, vector unsigned char __b) {
5763 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5764}
5765
5766static __inline__ vector unsigned char __ATTRS_o_ai
5767vec_min(vector unsigned char __a, vector bool char __b) {
5768 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5769}
5770
5771static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5772 vector short __b) {
5773 return __builtin_altivec_vminsh(__a, __b);
5774}
5775
5776static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5777 vector short __b) {
5778 return __builtin_altivec_vminsh((vector short)__a, __b);
5779}
5780
5781static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5782 vector bool short __b) {
5783 return __builtin_altivec_vminsh(__a, (vector short)__b);
5784}
5785
5786static __inline__ vector unsigned short __ATTRS_o_ai
5787vec_min(vector unsigned short __a, vector unsigned short __b) {
5788 return __builtin_altivec_vminuh(__a, __b);
5789}
5790
5791static __inline__ vector unsigned short __ATTRS_o_ai
5792vec_min(vector bool short __a, vector unsigned short __b) {
5793 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5794}
5795
5796static __inline__ vector unsigned short __ATTRS_o_ai
5797vec_min(vector unsigned short __a, vector bool short __b) {
5798 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5799}
5800
5801static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5802 vector int __b) {
5803 return __builtin_altivec_vminsw(__a, __b);
5804}
5805
5806static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5807 vector int __b) {
5808 return __builtin_altivec_vminsw((vector int)__a, __b);
5809}
5810
5811static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5812 vector bool int __b) {
5813 return __builtin_altivec_vminsw(__a, (vector int)__b);
5814}
5815
5816static __inline__ vector unsigned int __ATTRS_o_ai
5817vec_min(vector unsigned int __a, vector unsigned int __b) {
5818 return __builtin_altivec_vminuw(__a, __b);
5819}
5820
5821static __inline__ vector unsigned int __ATTRS_o_ai
5822vec_min(vector bool int __a, vector unsigned int __b) {
5823 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5824}
5825
5826static __inline__ vector unsigned int __ATTRS_o_ai
5827vec_min(vector unsigned int __a, vector bool int __b) {
5828 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5829}
5830
5831#ifdef __POWER8_VECTOR__
5832static __inline__ vector signed long long __ATTRS_o_ai
5833vec_min(vector signed long long __a, vector signed long long __b) {
5834 return __builtin_altivec_vminsd(__a, __b);
5835}
5836
5837static __inline__ vector signed long long __ATTRS_o_ai
5838vec_min(vector bool long long __a, vector signed long long __b) {
5839 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5840}
5841
5842static __inline__ vector signed long long __ATTRS_o_ai
5843vec_min(vector signed long long __a, vector bool long long __b) {
5844 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5845}
5846
5847static __inline__ vector unsigned long long __ATTRS_o_ai
5848vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5849 return __builtin_altivec_vminud(__a, __b);
5850}
5851
5852static __inline__ vector unsigned long long __ATTRS_o_ai
5853vec_min(vector bool long long __a, vector unsigned long long __b) {
5854 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5855}
5856
5857static __inline__ vector unsigned long long __ATTRS_o_ai
5858vec_min(vector unsigned long long __a, vector bool long long __b) {
5859 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5860}
5861#endif
5862
5863static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5864 vector float __b) {
5865#ifdef __VSX__
5866 return __builtin_vsx_xvminsp(__a, __b);
5867#else
5868 return __builtin_altivec_vminfp(__a, __b);
5869#endif
5870}
5871
5872#ifdef __VSX__
5873static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5874 vector double __b) {
5875 return __builtin_vsx_xvmindp(__a, __b);
5876}
5877#endif
5878
5879/* vec_vminsb */
5880
5881static __inline__ vector signed char __ATTRS_o_ai
5882vec_vminsb(vector signed char __a, vector signed char __b) {
5883 return __builtin_altivec_vminsb(__a, __b);
5884}
5885
5886static __inline__ vector signed char __ATTRS_o_ai
5887vec_vminsb(vector bool char __a, vector signed char __b) {
5888 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5889}
5890
5891static __inline__ vector signed char __ATTRS_o_ai
5892vec_vminsb(vector signed char __a, vector bool char __b) {
5893 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5894}
5895
5896/* vec_vminub */
5897
5898static __inline__ vector unsigned char __ATTRS_o_ai
5899vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5900 return __builtin_altivec_vminub(__a, __b);
5901}
5902
5903static __inline__ vector unsigned char __ATTRS_o_ai
5904vec_vminub(vector bool char __a, vector unsigned char __b) {
5905 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5906}
5907
5908static __inline__ vector unsigned char __ATTRS_o_ai
5909vec_vminub(vector unsigned char __a, vector bool char __b) {
5910 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5911}
5912
5913/* vec_vminsh */
5914
5915static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5916 vector short __b) {
5917 return __builtin_altivec_vminsh(__a, __b);
5918}
5919
5920static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5921 vector short __b) {
5922 return __builtin_altivec_vminsh((vector short)__a, __b);
5923}
5924
5925static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5926 vector bool short __b) {
5927 return __builtin_altivec_vminsh(__a, (vector short)__b);
5928}
5929
5930/* vec_vminuh */
5931
5932static __inline__ vector unsigned short __ATTRS_o_ai
5933vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5934 return __builtin_altivec_vminuh(__a, __b);
5935}
5936
5937static __inline__ vector unsigned short __ATTRS_o_ai
5938vec_vminuh(vector bool short __a, vector unsigned short __b) {
5939 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5940}
5941
5942static __inline__ vector unsigned short __ATTRS_o_ai
5943vec_vminuh(vector unsigned short __a, vector bool short __b) {
5944 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5945}
5946
5947/* vec_vminsw */
5948
5949static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5950 vector int __b) {
5951 return __builtin_altivec_vminsw(__a, __b);
5952}
5953
5954static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5955 vector int __b) {
5956 return __builtin_altivec_vminsw((vector int)__a, __b);
5957}
5958
5959static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5960 vector bool int __b) {
5961 return __builtin_altivec_vminsw(__a, (vector int)__b);
5962}
5963
5964/* vec_vminuw */
5965
5966static __inline__ vector unsigned int __ATTRS_o_ai
5967vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5968 return __builtin_altivec_vminuw(__a, __b);
5969}
5970
5971static __inline__ vector unsigned int __ATTRS_o_ai
5972vec_vminuw(vector bool int __a, vector unsigned int __b) {
5973 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5974}
5975
5976static __inline__ vector unsigned int __ATTRS_o_ai
5977vec_vminuw(vector unsigned int __a, vector bool int __b) {
5978 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5979}
5980
5981/* vec_vminfp */
5982
5983static __inline__ vector float __attribute__((__always_inline__))
5984vec_vminfp(vector float __a, vector float __b) {
5985#ifdef __VSX__
5986 return __builtin_vsx_xvminsp(__a, __b);
5987#else
5988 return __builtin_altivec_vminfp(__a, __b);
5989#endif
5990}
5991
5992/* vec_mladd */
5993
5994#define __builtin_altivec_vmladduhm vec_mladd
5995
5996static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5997 vector short __b,
5998 vector short __c) {
5999 return __a * __b + __c;
6000}
6001
6002static __inline__ vector short __ATTRS_o_ai vec_mladd(
6003 vector short __a, vector unsigned short __b, vector unsigned short __c) {
6004 return __a * (vector short)__b + (vector short)__c;
6005}
6006
6007static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
6008 vector short __b,
6009 vector short __c) {
6010 return (vector short)__a * __b + __c;
6011}
6012
6013static __inline__ vector unsigned short __ATTRS_o_ai
6014vec_mladd(vector unsigned short __a, vector unsigned short __b,
6015 vector unsigned short __c) {
6016 return __a * __b + __c;
6017}
6018
6019/* vec_vmladduhm */
6020
6021static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
6022 vector short __b,
6023 vector short __c) {
6024 return __a * __b + __c;
6025}
6026
6027static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
6028 vector short __a, vector unsigned short __b, vector unsigned short __c) {
6029 return __a * (vector short)__b + (vector short)__c;
6030}
6031
6032static __inline__ vector short __ATTRS_o_ai
6033vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
6034 return (vector short)__a * __b + __c;
6035}
6036
6037static __inline__ vector unsigned short __ATTRS_o_ai
6038vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
6039 vector unsigned short __c) {
6040 return __a * __b + __c;
6041}
6042
6043/* vec_mradds */
6044
6045static __inline__ vector short __attribute__((__always_inline__))
6046vec_mradds(vector short __a, vector short __b, vector short __c) {
6047 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6048}
6049
6050/* vec_vmhraddshs */
6051
6052static __inline__ vector short __attribute__((__always_inline__))
6053vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
6054 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6055}
6056
6057/* vec_msum */
6058
6059static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
6060 vector unsigned char __b,
6061 vector int __c) {
6062 return __builtin_altivec_vmsummbm(__a, __b, __c);
6063}
6064
6065static __inline__ vector unsigned int __ATTRS_o_ai
6066vec_msum(vector unsigned char __a, vector unsigned char __b,
6067 vector unsigned int __c) {
6068 return __builtin_altivec_vmsumubm(__a, __b, __c);
6069}
6070
6071static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
6072 vector short __b,
6073 vector int __c) {
6074 return __builtin_altivec_vmsumshm(__a, __b, __c);
6075}
6076
6077static __inline__ vector unsigned int __ATTRS_o_ai
6078vec_msum(vector unsigned short __a, vector unsigned short __b,
6079 vector unsigned int __c) {
6080 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6081}
6082
6083/* vec_msumc */
6084
6085#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6086static __inline__ vector unsigned __int128 __ATTRS_o_ai
6087vec_msumc(vector unsigned long long __a, vector unsigned long long __b,
6088 vector unsigned __int128 __c) {
6089 return __builtin_altivec_vmsumcud(__a, __b, __c);
6090}
6091#endif
6092
6093/* vec_vmsummbm */
6094
6095static __inline__ vector int __attribute__((__always_inline__))
6096vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
6097 return __builtin_altivec_vmsummbm(__a, __b, __c);
6098}
6099
6100/* vec_vmsumubm */
6101
6102static __inline__ vector unsigned int __attribute__((__always_inline__))
6103vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
6104 vector unsigned int __c) {
6105 return __builtin_altivec_vmsumubm(__a, __b, __c);
6106}
6107
6108/* vec_vmsumshm */
6109
6110static __inline__ vector int __attribute__((__always_inline__))
6111vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
6112 return __builtin_altivec_vmsumshm(__a, __b, __c);
6113}
6114
6115/* vec_vmsumuhm */
6116
6117static __inline__ vector unsigned int __attribute__((__always_inline__))
6118vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
6119 vector unsigned int __c) {
6120 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6121}
6122
6123/* vec_msums */
6124
6125static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
6126 vector short __b,
6127 vector int __c) {
6128 return __builtin_altivec_vmsumshs(__a, __b, __c);
6129}
6130
6131static __inline__ vector unsigned int __ATTRS_o_ai
6132vec_msums(vector unsigned short __a, vector unsigned short __b,
6133 vector unsigned int __c) {
6134 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6135}
6136
6137/* vec_vmsumshs */
6138
6139static __inline__ vector int __attribute__((__always_inline__))
6140vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
6141 return __builtin_altivec_vmsumshs(__a, __b, __c);
6142}
6143
6144/* vec_vmsumuhs */
6145
6146static __inline__ vector unsigned int __attribute__((__always_inline__))
6147vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
6148 vector unsigned int __c) {
6149 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6150}
6151
6152/* vec_mtvscr */
6153
6154static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
6155 __builtin_altivec_mtvscr((vector int)__a);
6156}
6157
6158static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
6159 __builtin_altivec_mtvscr((vector int)__a);
6160}
6161
6162static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
6163 __builtin_altivec_mtvscr((vector int)__a);
6164}
6165
6166static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
6167 __builtin_altivec_mtvscr((vector int)__a);
6168}
6169
6170static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
6171 __builtin_altivec_mtvscr((vector int)__a);
6172}
6173
6174static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
6175 __builtin_altivec_mtvscr((vector int)__a);
6176}
6177
6178static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
6179 __builtin_altivec_mtvscr((vector int)__a);
6180}
6181
6182static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
6183 __builtin_altivec_mtvscr((vector int)__a);
6184}
6185
6186static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
6187 __builtin_altivec_mtvscr((vector int)__a);
6188}
6189
6190static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
6191 __builtin_altivec_mtvscr((vector int)__a);
6192}
6193
6194static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
6195 __builtin_altivec_mtvscr((vector int)__a);
6196}
6197
6198/* vec_mul */
6199
6200/* Integer vector multiplication will involve multiplication of the odd/even
6201 elements separately, then truncating the results and moving to the
6202 result vector.
6203*/
6204static __inline__ vector signed char __ATTRS_o_ai
6205vec_mul(vector signed char __a, vector signed char __b) {
6206 return __a * __b;
6207}
6208
6209static __inline__ vector unsigned char __ATTRS_o_ai
6210vec_mul(vector unsigned char __a, vector unsigned char __b) {
6211 return __a * __b;
6212}
6213
6214static __inline__ vector signed short __ATTRS_o_ai
6215vec_mul(vector signed short __a, vector signed short __b) {
6216 return __a * __b;
6217}
6218
6219static __inline__ vector unsigned short __ATTRS_o_ai
6220vec_mul(vector unsigned short __a, vector unsigned short __b) {
6221 return __a * __b;
6222}
6223
6224static __inline__ vector signed int __ATTRS_o_ai
6225vec_mul(vector signed int __a, vector signed int __b) {
6226 return __a * __b;
6227}
6228
6229static __inline__ vector unsigned int __ATTRS_o_ai
6230vec_mul(vector unsigned int __a, vector unsigned int __b) {
6231 return __a * __b;
6232}
6233
6234#ifdef __VSX__
6235static __inline__ vector signed long long __ATTRS_o_ai
6236vec_mul(vector signed long long __a, vector signed long long __b) {
6237 return __a * __b;
6238}
6239
6240static __inline__ vector unsigned long long __ATTRS_o_ai
6241vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
6242 return __a * __b;
6243}
6244#endif
6245
6246static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
6247 vector float __b) {
6248 return __a * __b;
6249}
6250
6251#ifdef __VSX__
6252static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
6253 vector double __b) {
6254 return __a * __b;
6255}
6256#endif
6257
6258/* The vmulos* and vmules* instructions have a big endian bias, so
6259 we must reverse the meaning of "even" and "odd" for little endian. */
6260
6261/* vec_mule */
6262
6263static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
6264 vector signed char __b) {
6265#ifdef __LITTLE_ENDIAN__
6266 return __builtin_altivec_vmulosb(__a, __b);
6267#else
6268 return __builtin_altivec_vmulesb(__a, __b);
6269#endif
6270}
6271
6272static __inline__ vector unsigned short __ATTRS_o_ai
6273vec_mule(vector unsigned char __a, vector unsigned char __b) {
6274#ifdef __LITTLE_ENDIAN__
6275 return __builtin_altivec_vmuloub(__a, __b);
6276#else
6277 return __builtin_altivec_vmuleub(__a, __b);
6278#endif
6279}
6280
6281static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
6282 vector short __b) {
6283#ifdef __LITTLE_ENDIAN__
6284 return __builtin_altivec_vmulosh(__a, __b);
6285#else
6286 return __builtin_altivec_vmulesh(__a, __b);
6287#endif
6288}
6289
6290static __inline__ vector unsigned int __ATTRS_o_ai
6291vec_mule(vector unsigned short __a, vector unsigned short __b) {
6292#ifdef __LITTLE_ENDIAN__
6293 return __builtin_altivec_vmulouh(__a, __b);
6294#else
6295 return __builtin_altivec_vmuleuh(__a, __b);
6296#endif
6297}
6298
6299#ifdef __POWER8_VECTOR__
6300static __inline__ vector signed long long __ATTRS_o_ai
6301vec_mule(vector signed int __a, vector signed int __b) {
6302#ifdef __LITTLE_ENDIAN__
6303 return __builtin_altivec_vmulosw(__a, __b);
6304#else
6305 return __builtin_altivec_vmulesw(__a, __b);
6306#endif
6307}
6308
6309static __inline__ vector unsigned long long __ATTRS_o_ai
6310vec_mule(vector unsigned int __a, vector unsigned int __b) {
6311#ifdef __LITTLE_ENDIAN__
6312 return __builtin_altivec_vmulouw(__a, __b);
6313#else
6314 return __builtin_altivec_vmuleuw(__a, __b);
6315#endif
6316}
6317#endif
6318
6319#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6320static __inline__ vector signed __int128 __ATTRS_o_ai
6321vec_mule(vector signed long long __a, vector signed long long __b) {
6322#ifdef __LITTLE_ENDIAN__
6323 return __builtin_altivec_vmulosd(__a, __b);
6324#else
6325 return __builtin_altivec_vmulesd(__a, __b);
6326#endif
6327}
6328
6329static __inline__ vector unsigned __int128 __ATTRS_o_ai
6330vec_mule(vector unsigned long long __a, vector unsigned long long __b) {
6331#ifdef __LITTLE_ENDIAN__
6332 return __builtin_altivec_vmuloud(__a, __b);
6333#else
6334 return __builtin_altivec_vmuleud(__a, __b);
6335#endif
6336}
6337#endif
6338
6339/* vec_vmulesb */
6340
6341static __inline__ vector short __attribute__((__always_inline__))
6342vec_vmulesb(vector signed char __a, vector signed char __b) {
6343#ifdef __LITTLE_ENDIAN__
6344 return __builtin_altivec_vmulosb(__a, __b);
6345#else
6346 return __builtin_altivec_vmulesb(__a, __b);
6347#endif
6348}
6349
6350/* vec_vmuleub */
6351
6352static __inline__ vector unsigned short __attribute__((__always_inline__))
6353vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
6354#ifdef __LITTLE_ENDIAN__
6355 return __builtin_altivec_vmuloub(__a, __b);
6356#else
6357 return __builtin_altivec_vmuleub(__a, __b);
6358#endif
6359}
6360
6361/* vec_vmulesh */
6362
6363static __inline__ vector int __attribute__((__always_inline__))
6364vec_vmulesh(vector short __a, vector short __b) {
6365#ifdef __LITTLE_ENDIAN__
6366 return __builtin_altivec_vmulosh(__a, __b);
6367#else
6368 return __builtin_altivec_vmulesh(__a, __b);
6369#endif
6370}
6371
6372/* vec_vmuleuh */
6373
6374static __inline__ vector unsigned int __attribute__((__always_inline__))
6375vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
6376#ifdef __LITTLE_ENDIAN__
6377 return __builtin_altivec_vmulouh(__a, __b);
6378#else
6379 return __builtin_altivec_vmuleuh(__a, __b);
6380#endif
6381}
6382
6383/* vec_mulh */
6384
6385#ifdef __POWER10_VECTOR__
6386static __inline__ vector signed int __ATTRS_o_ai
6387vec_mulh(vector signed int __a, vector signed int __b) {
6388 return __builtin_altivec_vmulhsw(__a, __b);
6389}
6390
6391static __inline__ vector unsigned int __ATTRS_o_ai
6392vec_mulh(vector unsigned int __a, vector unsigned int __b) {
6393 return __builtin_altivec_vmulhuw(__a, __b);
6394}
6395
6396static __inline__ vector signed long long __ATTRS_o_ai
6397vec_mulh(vector signed long long __a, vector signed long long __b) {
6398 return __builtin_altivec_vmulhsd(__a, __b);
6399}
6400
6401static __inline__ vector unsigned long long __ATTRS_o_ai
6402vec_mulh(vector unsigned long long __a, vector unsigned long long __b) {
6403 return __builtin_altivec_vmulhud(__a, __b);
6404}
6405#endif
6406
6407#ifdef __FUTURE_VECTOR__
6408static __inline__ vector signed short
6409 __ATTRS_o_ai vec_mulh(vector signed short __a, vector signed short __b) {
6410 return __builtin_altivec_vmulhsh(__a, __b);
6411}
6412
6413static __inline__ vector unsigned short __ATTRS_o_ai
6414vec_mulh(vector unsigned short __a, vector unsigned short __b) {
6415 return __builtin_altivec_vmulhuh(__a, __b);
6416}
6417#endif
6418
6419/* vec_mulo */
6420
6421static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
6422 vector signed char __b) {
6423#ifdef __LITTLE_ENDIAN__
6424 return __builtin_altivec_vmulesb(__a, __b);
6425#else
6426 return __builtin_altivec_vmulosb(__a, __b);
6427#endif
6428}
6429
6430static __inline__ vector unsigned short __ATTRS_o_ai
6431vec_mulo(vector unsigned char __a, vector unsigned char __b) {
6432#ifdef __LITTLE_ENDIAN__
6433 return __builtin_altivec_vmuleub(__a, __b);
6434#else
6435 return __builtin_altivec_vmuloub(__a, __b);
6436#endif
6437}
6438
6439static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
6440 vector short __b) {
6441#ifdef __LITTLE_ENDIAN__
6442 return __builtin_altivec_vmulesh(__a, __b);
6443#else
6444 return __builtin_altivec_vmulosh(__a, __b);
6445#endif
6446}
6447
6448static __inline__ vector unsigned int __ATTRS_o_ai
6449vec_mulo(vector unsigned short __a, vector unsigned short __b) {
6450#ifdef __LITTLE_ENDIAN__
6451 return __builtin_altivec_vmuleuh(__a, __b);
6452#else
6453 return __builtin_altivec_vmulouh(__a, __b);
6454#endif
6455}
6456
6457#ifdef __POWER8_VECTOR__
6458static __inline__ vector signed long long __ATTRS_o_ai
6459vec_mulo(vector signed int __a, vector signed int __b) {
6460#ifdef __LITTLE_ENDIAN__
6461 return __builtin_altivec_vmulesw(__a, __b);
6462#else
6463 return __builtin_altivec_vmulosw(__a, __b);
6464#endif
6465}
6466
6467static __inline__ vector unsigned long long __ATTRS_o_ai
6468vec_mulo(vector unsigned int __a, vector unsigned int __b) {
6469#ifdef __LITTLE_ENDIAN__
6470 return __builtin_altivec_vmuleuw(__a, __b);
6471#else
6472 return __builtin_altivec_vmulouw(__a, __b);
6473#endif
6474}
6475#endif
6476
6477#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6478static __inline__ vector signed __int128 __ATTRS_o_ai
6479vec_mulo(vector signed long long __a, vector signed long long __b) {
6480#ifdef __LITTLE_ENDIAN__
6481 return __builtin_altivec_vmulesd(__a, __b);
6482#else
6483 return __builtin_altivec_vmulosd(__a, __b);
6484#endif
6485}
6486
6487static __inline__ vector unsigned __int128 __ATTRS_o_ai
6488vec_mulo(vector unsigned long long __a, vector unsigned long long __b) {
6489#ifdef __LITTLE_ENDIAN__
6490 return __builtin_altivec_vmuleud(__a, __b);
6491#else
6492 return __builtin_altivec_vmuloud(__a, __b);
6493#endif
6494}
6495#endif
6496
6497/* vec_vmulosb */
6498
6499static __inline__ vector short __attribute__((__always_inline__))
6500vec_vmulosb(vector signed char __a, vector signed char __b) {
6501#ifdef __LITTLE_ENDIAN__
6502 return __builtin_altivec_vmulesb(__a, __b);
6503#else
6504 return __builtin_altivec_vmulosb(__a, __b);
6505#endif
6506}
6507
6508/* vec_vmuloub */
6509
6510static __inline__ vector unsigned short __attribute__((__always_inline__))
6511vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
6512#ifdef __LITTLE_ENDIAN__
6513 return __builtin_altivec_vmuleub(__a, __b);
6514#else
6515 return __builtin_altivec_vmuloub(__a, __b);
6516#endif
6517}
6518
6519/* vec_vmulosh */
6520
6521static __inline__ vector int __attribute__((__always_inline__))
6522vec_vmulosh(vector short __a, vector short __b) {
6523#ifdef __LITTLE_ENDIAN__
6524 return __builtin_altivec_vmulesh(__a, __b);
6525#else
6526 return __builtin_altivec_vmulosh(__a, __b);
6527#endif
6528}
6529
6530/* vec_vmulouh */
6531
6532static __inline__ vector unsigned int __attribute__((__always_inline__))
6533vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
6534#ifdef __LITTLE_ENDIAN__
6535 return __builtin_altivec_vmuleuh(__a, __b);
6536#else
6537 return __builtin_altivec_vmulouh(__a, __b);
6538#endif
6539}
6540
6541/* vec_nand */
6542
6543#ifdef __POWER8_VECTOR__
6544static __inline__ vector signed char __ATTRS_o_ai
6545vec_nand(vector signed char __a, vector signed char __b) {
6546 return ~(__a & __b);
6547}
6548
6549static __inline__ vector signed char __ATTRS_o_ai
6550vec_nand(vector signed char __a, vector bool char __b) {
6551 return ~(__a & (vector signed char)__b);
6552}
6553
6554static __inline__ vector signed char __ATTRS_o_ai
6555vec_nand(vector bool char __a, vector signed char __b) {
6556 return (vector signed char)~(__a & (vector bool char)__b);
6557}
6558
6559static __inline__ vector unsigned char __ATTRS_o_ai
6560vec_nand(vector unsigned char __a, vector unsigned char __b) {
6561 return ~(__a & __b);
6562}
6563
6564static __inline__ vector unsigned char __ATTRS_o_ai
6565vec_nand(vector unsigned char __a, vector bool char __b) {
6566 return ~(__a & (vector unsigned char)__b);
6567}
6568
6569static __inline__ vector unsigned char __ATTRS_o_ai
6570vec_nand(vector bool char __a, vector unsigned char __b) {
6571 return (vector unsigned char)~(__a & (vector bool char)__b);
6572}
6573
6574static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
6575 vector bool char __b) {
6576 return ~(__a & __b);
6577}
6578
6579static __inline__ vector signed short __ATTRS_o_ai
6580vec_nand(vector signed short __a, vector signed short __b) {
6581 return ~(__a & __b);
6582}
6583
6584static __inline__ vector signed short __ATTRS_o_ai
6585vec_nand(vector signed short __a, vector bool short __b) {
6586 return ~(__a & (vector signed short)__b);
6587}
6588
6589static __inline__ vector signed short __ATTRS_o_ai
6590vec_nand(vector bool short __a, vector signed short __b) {
6591 return (vector signed short)~(__a & (vector bool short)__b);
6592}
6593
6594static __inline__ vector unsigned short __ATTRS_o_ai
6595vec_nand(vector unsigned short __a, vector unsigned short __b) {
6596 return ~(__a & __b);
6597}
6598
6599static __inline__ vector unsigned short __ATTRS_o_ai
6600vec_nand(vector unsigned short __a, vector bool short __b) {
6601 return ~(__a & (vector unsigned short)__b);
6602}
6603
6604static __inline__ vector bool short __ATTRS_o_ai
6605vec_nand(vector bool short __a, vector bool short __b) {
6606 return ~(__a & __b);
6607}
6608
6609static __inline__ vector signed int __ATTRS_o_ai
6610vec_nand(vector signed int __a, vector signed int __b) {
6611 return ~(__a & __b);
6612}
6613
6614static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
6615 vector bool int __b) {
6616 return ~(__a & (vector signed int)__b);
6617}
6618
6619static __inline__ vector signed int __ATTRS_o_ai
6620vec_nand(vector bool int __a, vector signed int __b) {
6621 return (vector signed int)~(__a & (vector bool int)__b);
6622}
6623
6624static __inline__ vector unsigned int __ATTRS_o_ai
6625vec_nand(vector unsigned int __a, vector unsigned int __b) {
6626 return ~(__a & __b);
6627}
6628
6629static __inline__ vector unsigned int __ATTRS_o_ai
6630vec_nand(vector unsigned int __a, vector bool int __b) {
6631 return ~(__a & (vector unsigned int)__b);
6632}
6633
6634static __inline__ vector unsigned int __ATTRS_o_ai
6635vec_nand(vector bool int __a, vector unsigned int __b) {
6636 return (vector unsigned int)~(__a & (vector bool int)__b);
6637}
6638
6639static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
6640 vector bool int __b) {
6641 return ~(__a & __b);
6642}
6643
6644static __inline__ vector float __ATTRS_o_ai
6645vec_nand(vector float __a, vector float __b) {
6646 return (vector float)(~((vector unsigned int)__a &
6647 (vector unsigned int)__b));
6648}
6649
6650static __inline__ vector signed long long __ATTRS_o_ai
6651vec_nand(vector signed long long __a, vector signed long long __b) {
6652 return ~(__a & __b);
6653}
6654
6655static __inline__ vector signed long long __ATTRS_o_ai
6656vec_nand(vector signed long long __a, vector bool long long __b) {
6657 return ~(__a & (vector signed long long)__b);
6658}
6659
6660static __inline__ vector signed long long __ATTRS_o_ai
6661vec_nand(vector bool long long __a, vector signed long long __b) {
6662 return (vector signed long long)~(__a & (vector bool long long)__b);
6663}
6664
6665static __inline__ vector unsigned long long __ATTRS_o_ai
6666vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
6667 return ~(__a & __b);
6668}
6669
6670static __inline__ vector unsigned long long __ATTRS_o_ai
6671vec_nand(vector unsigned long long __a, vector bool long long __b) {
6672 return ~(__a & (vector unsigned long long)__b);
6673}
6674
6675static __inline__ vector unsigned long long __ATTRS_o_ai
6676vec_nand(vector bool long long __a, vector unsigned long long __b) {
6677 return (vector unsigned long long)~(__a & (vector bool long long)__b);
6678}
6679
6680static __inline__ vector bool long long __ATTRS_o_ai
6681vec_nand(vector bool long long __a, vector bool long long __b) {
6682 return ~(__a & __b);
6683}
6684
6685static __inline__ vector double __ATTRS_o_ai
6686vec_nand(vector double __a, vector double __b) {
6687 return (vector double)(~((vector unsigned long long)__a &
6688 (vector unsigned long long)__b));
6689}
6690
6691#endif
6692
6693/* vec_nmadd */
6694
6695#ifdef __VSX__
6696static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6697 vector float __b,
6698 vector float __c) {
6699 return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6700}
6701
6702static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6703 vector double __b,
6704 vector double __c) {
6705 return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6706}
6707#endif
6708
6709/* vec_nmsub */
6710
6711static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6712 vector float __b,
6713 vector float __c) {
6714#ifdef __VSX__
6715 return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6716#else
6717 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6718#endif
6719}
6720
6721#ifdef __VSX__
6722static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6723 vector double __b,
6724 vector double __c) {
6725 return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6726}
6727#endif
6728
6729/* vec_vnmsubfp */
6730
6731static __inline__ vector float __attribute__((__always_inline__))
6732vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6733 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6734}
6735
6736/* vec_nor */
6737
6738#define __builtin_altivec_vnor vec_nor
6739
6740static __inline__ vector signed char __ATTRS_o_ai
6741vec_nor(vector signed char __a, vector signed char __b) {
6742 return ~(__a | __b);
6743}
6744
6745static __inline__ vector unsigned char __ATTRS_o_ai
6746vec_nor(vector unsigned char __a, vector unsigned char __b) {
6747 return ~(__a | __b);
6748}
6749
6750static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6751 vector bool char __b) {
6752 return ~(__a | __b);
6753}
6754
6755static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6756 vector short __b) {
6757 return ~(__a | __b);
6758}
6759
6760static __inline__ vector unsigned short __ATTRS_o_ai
6761vec_nor(vector unsigned short __a, vector unsigned short __b) {
6762 return ~(__a | __b);
6763}
6764
6765static __inline__ vector bool short __ATTRS_o_ai
6766vec_nor(vector bool short __a, vector bool short __b) {
6767 return ~(__a | __b);
6768}
6769
6770static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6771 vector int __b) {
6772 return ~(__a | __b);
6773}
6774
6775static __inline__ vector unsigned int __ATTRS_o_ai
6776vec_nor(vector unsigned int __a, vector unsigned int __b) {
6777 return ~(__a | __b);
6778}
6779
6780static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6781 vector bool int __b) {
6782 return ~(__a | __b);
6783}
6784
6785static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6786 vector float __b) {
6787 vector unsigned int __res =
6788 ~((vector unsigned int)__a | (vector unsigned int)__b);
6789 return (vector float)__res;
6790}
6791
6792#ifdef __VSX__
6793static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6794 vector double __b) {
6795 vector unsigned long long __res =
6796 ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6797 return (vector double)__res;
6798}
6799#endif
6800
6801/* vec_vnor */
6802
6803static __inline__ vector signed char __ATTRS_o_ai
6804vec_vnor(vector signed char __a, vector signed char __b) {
6805 return ~(__a | __b);
6806}
6807
6808static __inline__ vector unsigned char __ATTRS_o_ai
6809vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6810 return ~(__a | __b);
6811}
6812
6813static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6814 vector bool char __b) {
6815 return ~(__a | __b);
6816}
6817
6818static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6819 vector short __b) {
6820 return ~(__a | __b);
6821}
6822
6823static __inline__ vector unsigned short __ATTRS_o_ai
6824vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6825 return ~(__a | __b);
6826}
6827
6828static __inline__ vector bool short __ATTRS_o_ai
6829vec_vnor(vector bool short __a, vector bool short __b) {
6830 return ~(__a | __b);
6831}
6832
6833static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6834 vector int __b) {
6835 return ~(__a | __b);
6836}
6837
6838static __inline__ vector unsigned int __ATTRS_o_ai
6839vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6840 return ~(__a | __b);
6841}
6842
6843static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6844 vector bool int __b) {
6845 return ~(__a | __b);
6846}
6847
6848static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6849 vector float __b) {
6850 vector unsigned int __res =
6851 ~((vector unsigned int)__a | (vector unsigned int)__b);
6852 return (vector float)__res;
6853}
6854
6855#ifdef __VSX__
6856static __inline__ vector signed long long __ATTRS_o_ai
6857vec_nor(vector signed long long __a, vector signed long long __b) {
6858 return ~(__a | __b);
6859}
6860
6861static __inline__ vector unsigned long long __ATTRS_o_ai
6862vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6863 return ~(__a | __b);
6864}
6865
6866static __inline__ vector bool long long __ATTRS_o_ai
6867vec_nor(vector bool long long __a, vector bool long long __b) {
6868 return ~(__a | __b);
6869}
6870#endif
6871
6872/* vec_or */
6873
6874#define __builtin_altivec_vor vec_or
6875
6876static __inline__ vector signed char __ATTRS_o_ai
6877vec_or(vector signed char __a, vector signed char __b) {
6878 return __a | __b;
6879}
6880
6881static __inline__ vector signed char __ATTRS_o_ai
6882vec_or(vector bool char __a, vector signed char __b) {
6883 return (vector signed char)__a | __b;
6884}
6885
6886static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6887 vector bool char __b) {
6888 return __a | (vector signed char)__b;
6889}
6890
6891static __inline__ vector unsigned char __ATTRS_o_ai
6892vec_or(vector unsigned char __a, vector unsigned char __b) {
6893 return __a | __b;
6894}
6895
6896static __inline__ vector unsigned char __ATTRS_o_ai
6897vec_or(vector bool char __a, vector unsigned char __b) {
6898 return (vector unsigned char)__a | __b;
6899}
6900
6901static __inline__ vector unsigned char __ATTRS_o_ai
6902vec_or(vector unsigned char __a, vector bool char __b) {
6903 return __a | (vector unsigned char)__b;
6904}
6905
6906static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6907 vector bool char __b) {
6908 return __a | __b;
6909}
6910
6911static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6912 vector short __b) {
6913 return __a | __b;
6914}
6915
6916static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6917 vector short __b) {
6918 return (vector short)__a | __b;
6919}
6920
6921static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6922 vector bool short __b) {
6923 return __a | (vector short)__b;
6924}
6925
6926static __inline__ vector unsigned short __ATTRS_o_ai
6927vec_or(vector unsigned short __a, vector unsigned short __b) {
6928 return __a | __b;
6929}
6930
6931static __inline__ vector unsigned short __ATTRS_o_ai
6932vec_or(vector bool short __a, vector unsigned short __b) {
6933 return (vector unsigned short)__a | __b;
6934}
6935
6936static __inline__ vector unsigned short __ATTRS_o_ai
6937vec_or(vector unsigned short __a, vector bool short __b) {
6938 return __a | (vector unsigned short)__b;
6939}
6940
6941static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6942 vector bool short __b) {
6943 return __a | __b;
6944}
6945
6946static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6947 vector int __b) {
6948 return __a | __b;
6949}
6950
6951static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6952 vector int __b) {
6953 return (vector int)__a | __b;
6954}
6955
6956static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6957 vector bool int __b) {
6958 return __a | (vector int)__b;
6959}
6960
6961static __inline__ vector unsigned int __ATTRS_o_ai
6962vec_or(vector unsigned int __a, vector unsigned int __b) {
6963 return __a | __b;
6964}
6965
6966static __inline__ vector unsigned int __ATTRS_o_ai
6967vec_or(vector bool int __a, vector unsigned int __b) {
6968 return (vector unsigned int)__a | __b;
6969}
6970
6971static __inline__ vector unsigned int __ATTRS_o_ai
6972vec_or(vector unsigned int __a, vector bool int __b) {
6973 return __a | (vector unsigned int)__b;
6974}
6975
6976static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6977 vector bool int __b) {
6978 return __a | __b;
6979}
6980
6981static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6982 vector float __b) {
6983 vector unsigned int __res =
6984 (vector unsigned int)__a | (vector unsigned int)__b;
6985 return (vector float)__res;
6986}
6987
6988static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6989 vector float __b) {
6990 vector unsigned int __res =
6991 (vector unsigned int)__a | (vector unsigned int)__b;
6992 return (vector float)__res;
6993}
6994
6995static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6996 vector bool int __b) {
6997 vector unsigned int __res =
6998 (vector unsigned int)__a | (vector unsigned int)__b;
6999 return (vector float)__res;
7000}
7001
7002#ifdef __VSX__
7003static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
7004 vector double __b) {
7005 return (vector double)((vector unsigned long long)__a |
7006 (vector unsigned long long)__b);
7007}
7008
7009static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
7010 vector bool long long __b) {
7011 return (vector double)((vector unsigned long long)__a |
7012 (vector unsigned long long)__b);
7013}
7014
7015static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
7016 vector double __b) {
7017 return (vector double)((vector unsigned long long)__a |
7018 (vector unsigned long long)__b);
7019}
7020
7021static __inline__ vector signed long long __ATTRS_o_ai
7022vec_or(vector signed long long __a, vector signed long long __b) {
7023 return __a | __b;
7024}
7025
7026static __inline__ vector signed long long __ATTRS_o_ai
7027vec_or(vector bool long long __a, vector signed long long __b) {
7028 return (vector signed long long)__a | __b;
7029}
7030
7031static __inline__ vector signed long long __ATTRS_o_ai
7032vec_or(vector signed long long __a, vector bool long long __b) {
7033 return __a | (vector signed long long)__b;
7034}
7035
7036static __inline__ vector unsigned long long __ATTRS_o_ai
7037vec_or(vector unsigned long long __a, vector unsigned long long __b) {
7038 return __a | __b;
7039}
7040
7041static __inline__ vector unsigned long long __ATTRS_o_ai
7042vec_or(vector bool long long __a, vector unsigned long long __b) {
7043 return (vector unsigned long long)__a | __b;
7044}
7045
7046static __inline__ vector unsigned long long __ATTRS_o_ai
7047vec_or(vector unsigned long long __a, vector bool long long __b) {
7048 return __a | (vector unsigned long long)__b;
7049}
7050
7051static __inline__ vector bool long long __ATTRS_o_ai
7052vec_or(vector bool long long __a, vector bool long long __b) {
7053 return __a | __b;
7054}
7055#endif
7056
7057#ifdef __POWER8_VECTOR__
7058static __inline__ vector signed char __ATTRS_o_ai
7059vec_orc(vector signed char __a, vector signed char __b) {
7060 return __a | ~__b;
7061}
7062
7063static __inline__ vector signed char __ATTRS_o_ai
7064vec_orc(vector signed char __a, vector bool char __b) {
7065 return __a | (vector signed char)~__b;
7066}
7067
7068static __inline__ vector signed char __ATTRS_o_ai
7069vec_orc(vector bool char __a, vector signed char __b) {
7070 return (vector signed char)(__a | (vector bool char)~__b);
7071}
7072
7073static __inline__ vector unsigned char __ATTRS_o_ai
7074vec_orc(vector unsigned char __a, vector unsigned char __b) {
7075 return __a | ~__b;
7076}
7077
7078static __inline__ vector unsigned char __ATTRS_o_ai
7079vec_orc(vector unsigned char __a, vector bool char __b) {
7080 return __a | (vector unsigned char)~__b;
7081}
7082
7083static __inline__ vector unsigned char __ATTRS_o_ai
7084vec_orc(vector bool char __a, vector unsigned char __b) {
7085 return (vector unsigned char)(__a | (vector bool char)~__b);
7086}
7087
7088static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
7089 vector bool char __b) {
7090 return __a | ~__b;
7091}
7092
7093static __inline__ vector signed short __ATTRS_o_ai
7094vec_orc(vector signed short __a, vector signed short __b) {
7095 return __a | ~__b;
7096}
7097
7098static __inline__ vector signed short __ATTRS_o_ai
7099vec_orc(vector signed short __a, vector bool short __b) {
7100 return __a | (vector signed short)~__b;
7101}
7102
7103static __inline__ vector signed short __ATTRS_o_ai
7104vec_orc(vector bool short __a, vector signed short __b) {
7105 return (vector signed short)(__a | (vector bool short)~__b);
7106}
7107
7108static __inline__ vector unsigned short __ATTRS_o_ai
7109vec_orc(vector unsigned short __a, vector unsigned short __b) {
7110 return __a | ~__b;
7111}
7112
7113static __inline__ vector unsigned short __ATTRS_o_ai
7114vec_orc(vector unsigned short __a, vector bool short __b) {
7115 return __a | (vector unsigned short)~__b;
7116}
7117
7118static __inline__ vector unsigned short __ATTRS_o_ai
7119vec_orc(vector bool short __a, vector unsigned short __b) {
7120 return (vector unsigned short)(__a | (vector bool short)~__b);
7121}
7122
7123static __inline__ vector bool short __ATTRS_o_ai
7124vec_orc(vector bool short __a, vector bool short __b) {
7125 return __a | ~__b;
7126}
7127
7128static __inline__ vector signed int __ATTRS_o_ai
7129vec_orc(vector signed int __a, vector signed int __b) {
7130 return __a | ~__b;
7131}
7132
7133static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
7134 vector bool int __b) {
7135 return __a | (vector signed int)~__b;
7136}
7137
7138static __inline__ vector signed int __ATTRS_o_ai
7139vec_orc(vector bool int __a, vector signed int __b) {
7140 return (vector signed int)(__a | (vector bool int)~__b);
7141}
7142
7143static __inline__ vector unsigned int __ATTRS_o_ai
7144vec_orc(vector unsigned int __a, vector unsigned int __b) {
7145 return __a | ~__b;
7146}
7147
7148static __inline__ vector unsigned int __ATTRS_o_ai
7149vec_orc(vector unsigned int __a, vector bool int __b) {
7150 return __a | (vector unsigned int)~__b;
7151}
7152
7153static __inline__ vector unsigned int __ATTRS_o_ai
7154vec_orc(vector bool int __a, vector unsigned int __b) {
7155 return (vector unsigned int)(__a | (vector bool int)~__b);
7156}
7157
7158static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
7159 vector bool int __b) {
7160 return __a | ~__b;
7161}
7162
7163static __inline__ vector float __ATTRS_o_ai
7164vec_orc(vector bool int __a, vector float __b) {
7165 return (vector float)(__a | ~(vector bool int)__b);
7166}
7167
7168static __inline__ vector float __ATTRS_o_ai
7169vec_orc(vector float __a, vector bool int __b) {
7170 return (vector float)((vector bool int)__a | ~__b);
7171}
7172
7173static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a,
7174 vector float __b) {
7175 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b);
7176}
7177
7178static __inline__ vector signed long long __ATTRS_o_ai
7179vec_orc(vector signed long long __a, vector signed long long __b) {
7180 return __a | ~__b;
7181}
7182
7183static __inline__ vector signed long long __ATTRS_o_ai
7184vec_orc(vector signed long long __a, vector bool long long __b) {
7185 return __a | (vector signed long long)~__b;
7186}
7187
7188static __inline__ vector signed long long __ATTRS_o_ai
7189vec_orc(vector bool long long __a, vector signed long long __b) {
7190 return (vector signed long long)(__a | (vector bool long long)~__b);
7191}
7192
7193static __inline__ vector unsigned long long __ATTRS_o_ai
7194vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
7195 return __a | ~__b;
7196}
7197
7198static __inline__ vector unsigned long long __ATTRS_o_ai
7199vec_orc(vector unsigned long long __a, vector bool long long __b) {
7200 return __a | (vector unsigned long long)~__b;
7201}
7202
7203static __inline__ vector unsigned long long __ATTRS_o_ai
7204vec_orc(vector bool long long __a, vector unsigned long long __b) {
7205 return (vector unsigned long long)(__a | (vector bool long long)~__b);
7206}
7207
7208static __inline__ vector bool long long __ATTRS_o_ai
7209vec_orc(vector bool long long __a, vector bool long long __b) {
7210 return __a | ~__b;
7211}
7212
7213static __inline__ vector double __ATTRS_o_ai
7214vec_orc(vector double __a, vector bool long long __b) {
7215 return (vector double)((vector bool long long)__a | ~__b);
7216}
7217
7218static __inline__ vector double __ATTRS_o_ai
7219vec_orc(vector bool long long __a, vector double __b) {
7220 return (vector double)(__a | ~(vector bool long long)__b);
7221}
7222
7223static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a,
7224 vector double __b) {
7225 return (vector double)((vector unsigned long long)__a |
7226 ~(vector unsigned long long)__b);
7227}
7228#endif
7229
7230/* vec_vor */
7231
7232static __inline__ vector signed char __ATTRS_o_ai
7233vec_vor(vector signed char __a, vector signed char __b) {
7234 return __a | __b;
7235}
7236
7237static __inline__ vector signed char __ATTRS_o_ai
7238vec_vor(vector bool char __a, vector signed char __b) {
7239 return (vector signed char)__a | __b;
7240}
7241
7242static __inline__ vector signed char __ATTRS_o_ai
7243vec_vor(vector signed char __a, vector bool char __b) {
7244 return __a | (vector signed char)__b;
7245}
7246
7247static __inline__ vector unsigned char __ATTRS_o_ai
7248vec_vor(vector unsigned char __a, vector unsigned char __b) {
7249 return __a | __b;
7250}
7251
7252static __inline__ vector unsigned char __ATTRS_o_ai
7253vec_vor(vector bool char __a, vector unsigned char __b) {
7254 return (vector unsigned char)__a | __b;
7255}
7256
7257static __inline__ vector unsigned char __ATTRS_o_ai
7258vec_vor(vector unsigned char __a, vector bool char __b) {
7259 return __a | (vector unsigned char)__b;
7260}
7261
7262static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
7263 vector bool char __b) {
7264 return __a | __b;
7265}
7266
7267static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7268 vector short __b) {
7269 return __a | __b;
7270}
7271
7272static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
7273 vector short __b) {
7274 return (vector short)__a | __b;
7275}
7276
7277static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7278 vector bool short __b) {
7279 return __a | (vector short)__b;
7280}
7281
7282static __inline__ vector unsigned short __ATTRS_o_ai
7283vec_vor(vector unsigned short __a, vector unsigned short __b) {
7284 return __a | __b;
7285}
7286
7287static __inline__ vector unsigned short __ATTRS_o_ai
7288vec_vor(vector bool short __a, vector unsigned short __b) {
7289 return (vector unsigned short)__a | __b;
7290}
7291
7292static __inline__ vector unsigned short __ATTRS_o_ai
7293vec_vor(vector unsigned short __a, vector bool short __b) {
7294 return __a | (vector unsigned short)__b;
7295}
7296
7297static __inline__ vector bool short __ATTRS_o_ai
7298vec_vor(vector bool short __a, vector bool short __b) {
7299 return __a | __b;
7300}
7301
7302static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7303 vector int __b) {
7304 return __a | __b;
7305}
7306
7307static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
7308 vector int __b) {
7309 return (vector int)__a | __b;
7310}
7311
7312static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7313 vector bool int __b) {
7314 return __a | (vector int)__b;
7315}
7316
7317static __inline__ vector unsigned int __ATTRS_o_ai
7318vec_vor(vector unsigned int __a, vector unsigned int __b) {
7319 return __a | __b;
7320}
7321
7322static __inline__ vector unsigned int __ATTRS_o_ai
7323vec_vor(vector bool int __a, vector unsigned int __b) {
7324 return (vector unsigned int)__a | __b;
7325}
7326
7327static __inline__ vector unsigned int __ATTRS_o_ai
7328vec_vor(vector unsigned int __a, vector bool int __b) {
7329 return __a | (vector unsigned int)__b;
7330}
7331
7332static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
7333 vector bool int __b) {
7334 return __a | __b;
7335}
7336
7337static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7338 vector float __b) {
7339 vector unsigned int __res =
7340 (vector unsigned int)__a | (vector unsigned int)__b;
7341 return (vector float)__res;
7342}
7343
7344static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
7345 vector float __b) {
7346 vector unsigned int __res =
7347 (vector unsigned int)__a | (vector unsigned int)__b;
7348 return (vector float)__res;
7349}
7350
7351static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7352 vector bool int __b) {
7353 vector unsigned int __res =
7354 (vector unsigned int)__a | (vector unsigned int)__b;
7355 return (vector float)__res;
7356}
7357
7358#ifdef __VSX__
7359static __inline__ vector signed long long __ATTRS_o_ai
7360vec_vor(vector signed long long __a, vector signed long long __b) {
7361 return __a | __b;
7362}
7363
7364static __inline__ vector signed long long __ATTRS_o_ai
7365vec_vor(vector bool long long __a, vector signed long long __b) {
7366 return (vector signed long long)__a | __b;
7367}
7368
7369static __inline__ vector signed long long __ATTRS_o_ai
7370vec_vor(vector signed long long __a, vector bool long long __b) {
7371 return __a | (vector signed long long)__b;
7372}
7373
7374static __inline__ vector unsigned long long __ATTRS_o_ai
7375vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
7376 return __a | __b;
7377}
7378
7379static __inline__ vector unsigned long long __ATTRS_o_ai
7380vec_vor(vector bool long long __a, vector unsigned long long __b) {
7381 return (vector unsigned long long)__a | __b;
7382}
7383
7384static __inline__ vector unsigned long long __ATTRS_o_ai
7385vec_vor(vector unsigned long long __a, vector bool long long __b) {
7386 return __a | (vector unsigned long long)__b;
7387}
7388
7389static __inline__ vector bool long long __ATTRS_o_ai
7390vec_vor(vector bool long long __a, vector bool long long __b) {
7391 return __a | __b;
7392}
7393#endif
7394
7395/* vec_pack */
7396
7397/* The various vector pack instructions have a big-endian bias, so for
7398 little endian we must handle reversed element numbering. */
7399
7400static __inline__ vector signed char __ATTRS_o_ai
7401vec_pack(vector signed short __a, vector signed short __b) {
7402#ifdef __LITTLE_ENDIAN__
7403 return (vector signed char)vec_perm(
7404 __a, __b,
7405 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7406 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7407#else
7408 return (vector signed char)vec_perm(
7409 __a, __b,
7410 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7411 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7412#endif
7413}
7414
7415static __inline__ vector unsigned char __ATTRS_o_ai
7416vec_pack(vector unsigned short __a, vector unsigned short __b) {
7417#ifdef __LITTLE_ENDIAN__
7418 return (vector unsigned char)vec_perm(
7419 __a, __b,
7420 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7421 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7422#else
7423 return (vector unsigned char)vec_perm(
7424 __a, __b,
7425 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7426 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7427#endif
7428}
7429
7430static __inline__ vector bool char __ATTRS_o_ai
7431vec_pack(vector bool short __a, vector bool short __b) {
7432#ifdef __LITTLE_ENDIAN__
7433 return (vector bool char)vec_perm(
7434 __a, __b,
7435 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7436 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7437#else
7438 return (vector bool char)vec_perm(
7439 __a, __b,
7440 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7441 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7442#endif
7443}
7444
7445static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
7446 vector int __b) {
7447#ifdef __LITTLE_ENDIAN__
7448 return (vector short)vec_perm(
7449 __a, __b,
7450 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7451 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7452#else
7453 return (vector short)vec_perm(
7454 __a, __b,
7455 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7456 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7457#endif
7458}
7459
7460static __inline__ vector unsigned short __ATTRS_o_ai
7461vec_pack(vector unsigned int __a, vector unsigned int __b) {
7462#ifdef __LITTLE_ENDIAN__
7463 return (vector unsigned short)vec_perm(
7464 __a, __b,
7465 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7466 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7467#else
7468 return (vector unsigned short)vec_perm(
7469 __a, __b,
7470 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7471 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7472#endif
7473}
7474
7475static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
7476 vector bool int __b) {
7477#ifdef __LITTLE_ENDIAN__
7478 return (vector bool short)vec_perm(
7479 __a, __b,
7480 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7481 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7482#else
7483 return (vector bool short)vec_perm(
7484 __a, __b,
7485 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7486 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7487#endif
7488}
7489
7490#ifdef __VSX__
7491static __inline__ vector signed int __ATTRS_o_ai
7492vec_pack(vector signed long long __a, vector signed long long __b) {
7493#ifdef __LITTLE_ENDIAN__
7494 return (vector signed int)vec_perm(
7495 __a, __b,
7496 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7497 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7498#else
7499 return (vector signed int)vec_perm(
7500 __a, __b,
7501 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7502 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7503#endif
7504}
7505static __inline__ vector unsigned int __ATTRS_o_ai
7506vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
7507#ifdef __LITTLE_ENDIAN__
7508 return (vector unsigned int)vec_perm(
7509 __a, __b,
7510 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7511 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7512#else
7513 return (vector unsigned int)vec_perm(
7514 __a, __b,
7515 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7516 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7517#endif
7518}
7519
7520static __inline__ vector bool int __ATTRS_o_ai
7521vec_pack(vector bool long long __a, vector bool long long __b) {
7522#ifdef __LITTLE_ENDIAN__
7523 return (vector bool int)vec_perm(
7524 __a, __b,
7525 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7526 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7527#else
7528 return (vector bool int)vec_perm(
7529 __a, __b,
7530 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7531 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7532#endif
7533}
7534
7535static __inline__ vector float __ATTRS_o_ai
7536vec_pack(vector double __a, vector double __b) {
7537 return (vector float) (__a[0], __a[1], __b[0], __b[1]);
7538}
7539#endif
7540
7541#ifdef __POWER9_VECTOR__
7542static __inline__ vector unsigned short __ATTRS_o_ai
7543vec_pack_to_short_fp32(vector float __a, vector float __b) {
7544 vector float __resa = __builtin_vsx_xvcvsphp(__a);
7545 vector float __resb = __builtin_vsx_xvcvsphp(__b);
7546#ifdef __LITTLE_ENDIAN__
7547 return (vector unsigned short)vec_mergee(__resa, __resb);
7548#else
7549 return (vector unsigned short)vec_mergeo(__resa, __resb);
7550#endif
7551}
7552
7553#endif
7554/* vec_vpkuhum */
7555
7556#define __builtin_altivec_vpkuhum vec_vpkuhum
7557
7558static __inline__ vector signed char __ATTRS_o_ai
7559vec_vpkuhum(vector signed short __a, vector signed short __b) {
7560#ifdef __LITTLE_ENDIAN__
7561 return (vector signed char)vec_perm(
7562 __a, __b,
7563 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7564 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7565#else
7566 return (vector signed char)vec_perm(
7567 __a, __b,
7568 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7569 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7570#endif
7571}
7572
7573static __inline__ vector unsigned char __ATTRS_o_ai
7574vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
7575#ifdef __LITTLE_ENDIAN__
7576 return (vector unsigned char)vec_perm(
7577 __a, __b,
7578 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7579 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7580#else
7581 return (vector unsigned char)vec_perm(
7582 __a, __b,
7583 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7584 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7585#endif
7586}
7587
7588static __inline__ vector bool char __ATTRS_o_ai
7589vec_vpkuhum(vector bool short __a, vector bool short __b) {
7590#ifdef __LITTLE_ENDIAN__
7591 return (vector bool char)vec_perm(
7592 __a, __b,
7593 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7594 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7595#else
7596 return (vector bool char)vec_perm(
7597 __a, __b,
7598 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7599 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7600#endif
7601}
7602
7603/* vec_vpkuwum */
7604
7605#define __builtin_altivec_vpkuwum vec_vpkuwum
7606
7607static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
7608 vector int __b) {
7609#ifdef __LITTLE_ENDIAN__
7610 return (vector short)vec_perm(
7611 __a, __b,
7612 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7613 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7614#else
7615 return (vector short)vec_perm(
7616 __a, __b,
7617 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7618 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7619#endif
7620}
7621
7622static __inline__ vector unsigned short __ATTRS_o_ai
7623vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
7624#ifdef __LITTLE_ENDIAN__
7625 return (vector unsigned short)vec_perm(
7626 __a, __b,
7627 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7628 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7629#else
7630 return (vector unsigned short)vec_perm(
7631 __a, __b,
7632 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7633 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7634#endif
7635}
7636
7637static __inline__ vector bool short __ATTRS_o_ai
7638vec_vpkuwum(vector bool int __a, vector bool int __b) {
7639#ifdef __LITTLE_ENDIAN__
7640 return (vector bool short)vec_perm(
7641 __a, __b,
7642 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7643 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7644#else
7645 return (vector bool short)vec_perm(
7646 __a, __b,
7647 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7648 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7649#endif
7650}
7651
7652/* vec_vpkudum */
7653
7654#ifdef __POWER8_VECTOR__
7655#define __builtin_altivec_vpkudum vec_vpkudum
7656
7657static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
7658 vector long long __b) {
7659#ifdef __LITTLE_ENDIAN__
7660 return (vector int)vec_perm(
7661 __a, __b,
7662 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7663 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7664#else
7665 return (vector int)vec_perm(
7666 __a, __b,
7667 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7668 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7669#endif
7670}
7671
7672static __inline__ vector unsigned int __ATTRS_o_ai
7673vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
7674#ifdef __LITTLE_ENDIAN__
7675 return (vector unsigned int)vec_perm(
7676 __a, __b,
7677 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7678 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7679#else
7680 return (vector unsigned int)vec_perm(
7681 __a, __b,
7682 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7683 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7684#endif
7685}
7686
7687static __inline__ vector bool int __ATTRS_o_ai
7688vec_vpkudum(vector bool long long __a, vector bool long long __b) {
7689#ifdef __LITTLE_ENDIAN__
7690 return (vector bool int)vec_perm(
7691 (vector long long)__a, (vector long long)__b,
7692 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7693 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7694#else
7695 return (vector bool int)vec_perm(
7696 (vector long long)__a, (vector long long)__b,
7697 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7698 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7699#endif
7700}
7701#endif
7702
7703/* vec_packpx */
7704
7705static __inline__ vector pixel __attribute__((__always_inline__))
7706vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7707#ifdef __LITTLE_ENDIAN__
7708 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7709#else
7710 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7711#endif
7712}
7713
7714/* vec_vpkpx */
7715
7716static __inline__ vector pixel __attribute__((__always_inline__))
7717vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7718#ifdef __LITTLE_ENDIAN__
7719 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7720#else
7721 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7722#endif
7723}
7724
7725/* vec_packs */
7726
7727static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7728 vector short __b) {
7729#ifdef __LITTLE_ENDIAN__
7730 return __builtin_altivec_vpkshss(__b, __a);
7731#else
7732 return __builtin_altivec_vpkshss(__a, __b);
7733#endif
7734}
7735
7736static __inline__ vector unsigned char __ATTRS_o_ai
7737vec_packs(vector unsigned short __a, vector unsigned short __b) {
7738#ifdef __LITTLE_ENDIAN__
7739 return __builtin_altivec_vpkuhus(__b, __a);
7740#else
7741 return __builtin_altivec_vpkuhus(__a, __b);
7742#endif
7743}
7744
7745static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7746 vector int __b) {
7747#ifdef __LITTLE_ENDIAN__
7748 return __builtin_altivec_vpkswss(__b, __a);
7749#else
7750 return __builtin_altivec_vpkswss(__a, __b);
7751#endif
7752}
7753
7754static __inline__ vector unsigned short __ATTRS_o_ai
7755vec_packs(vector unsigned int __a, vector unsigned int __b) {
7756#ifdef __LITTLE_ENDIAN__
7757 return __builtin_altivec_vpkuwus(__b, __a);
7758#else
7759 return __builtin_altivec_vpkuwus(__a, __b);
7760#endif
7761}
7762
7763#ifdef __POWER8_VECTOR__
7764static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7765 vector long long __b) {
7766#ifdef __LITTLE_ENDIAN__
7767 return __builtin_altivec_vpksdss(__b, __a);
7768#else
7769 return __builtin_altivec_vpksdss(__a, __b);
7770#endif
7771}
7772
7773static __inline__ vector unsigned int __ATTRS_o_ai
7774vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7775#ifdef __LITTLE_ENDIAN__
7776 return __builtin_altivec_vpkudus(__b, __a);
7777#else
7778 return __builtin_altivec_vpkudus(__a, __b);
7779#endif
7780}
7781#endif
7782
7783/* vec_vpkshss */
7784
7785static __inline__ vector signed char __attribute__((__always_inline__))
7786vec_vpkshss(vector short __a, vector short __b) {
7787#ifdef __LITTLE_ENDIAN__
7788 return __builtin_altivec_vpkshss(__b, __a);
7789#else
7790 return __builtin_altivec_vpkshss(__a, __b);
7791#endif
7792}
7793
7794/* vec_vpksdss */
7795
7796#ifdef __POWER8_VECTOR__
7797static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7798 vector long long __b) {
7799#ifdef __LITTLE_ENDIAN__
7800 return __builtin_altivec_vpksdss(__b, __a);
7801#else
7802 return __builtin_altivec_vpksdss(__a, __b);
7803#endif
7804}
7805#endif
7806
7807/* vec_vpkuhus */
7808
7809static __inline__ vector unsigned char __attribute__((__always_inline__))
7810vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7811#ifdef __LITTLE_ENDIAN__
7812 return __builtin_altivec_vpkuhus(__b, __a);
7813#else
7814 return __builtin_altivec_vpkuhus(__a, __b);
7815#endif
7816}
7817
7818/* vec_vpkudus */
7819
7820#ifdef __POWER8_VECTOR__
7821static __inline__ vector unsigned int __attribute__((__always_inline__))
7822vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7823#ifdef __LITTLE_ENDIAN__
7824 return __builtin_altivec_vpkudus(__b, __a);
7825#else
7826 return __builtin_altivec_vpkudus(__a, __b);
7827#endif
7828}
7829#endif
7830
7831/* vec_vpkswss */
7832
7833static __inline__ vector signed short __attribute__((__always_inline__))
7834vec_vpkswss(vector int __a, vector int __b) {
7835#ifdef __LITTLE_ENDIAN__
7836 return __builtin_altivec_vpkswss(__b, __a);
7837#else
7838 return __builtin_altivec_vpkswss(__a, __b);
7839#endif
7840}
7841
7842/* vec_vpkuwus */
7843
7844static __inline__ vector unsigned short __attribute__((__always_inline__))
7845vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7846#ifdef __LITTLE_ENDIAN__
7847 return __builtin_altivec_vpkuwus(__b, __a);
7848#else
7849 return __builtin_altivec_vpkuwus(__a, __b);
7850#endif
7851}
7852
7853/* vec_packsu */
7854
7855static __inline__ vector unsigned char __ATTRS_o_ai
7856vec_packsu(vector short __a, vector short __b) {
7857#ifdef __LITTLE_ENDIAN__
7858 return __builtin_altivec_vpkshus(__b, __a);
7859#else
7860 return __builtin_altivec_vpkshus(__a, __b);
7861#endif
7862}
7863
7864static __inline__ vector unsigned char __ATTRS_o_ai
7865vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7866#ifdef __LITTLE_ENDIAN__
7867 return __builtin_altivec_vpkuhus(__b, __a);
7868#else
7869 return __builtin_altivec_vpkuhus(__a, __b);
7870#endif
7871}
7872
7873static __inline__ vector unsigned short __ATTRS_o_ai
7874vec_packsu(vector int __a, vector int __b) {
7875#ifdef __LITTLE_ENDIAN__
7876 return __builtin_altivec_vpkswus(__b, __a);
7877#else
7878 return __builtin_altivec_vpkswus(__a, __b);
7879#endif
7880}
7881
7882static __inline__ vector unsigned short __ATTRS_o_ai
7883vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7884#ifdef __LITTLE_ENDIAN__
7885 return __builtin_altivec_vpkuwus(__b, __a);
7886#else
7887 return __builtin_altivec_vpkuwus(__a, __b);
7888#endif
7889}
7890
7891#ifdef __POWER8_VECTOR__
7892static __inline__ vector unsigned int __ATTRS_o_ai
7893vec_packsu(vector long long __a, vector long long __b) {
7894#ifdef __LITTLE_ENDIAN__
7895 return __builtin_altivec_vpksdus(__b, __a);
7896#else
7897 return __builtin_altivec_vpksdus(__a, __b);
7898#endif
7899}
7900
7901static __inline__ vector unsigned int __ATTRS_o_ai
7902vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7903#ifdef __LITTLE_ENDIAN__
7904 return __builtin_altivec_vpkudus(__b, __a);
7905#else
7906 return __builtin_altivec_vpkudus(__a, __b);
7907#endif
7908}
7909#endif
7910
7911/* vec_vpkshus */
7912
7913static __inline__ vector unsigned char __ATTRS_o_ai
7914vec_vpkshus(vector short __a, vector short __b) {
7915#ifdef __LITTLE_ENDIAN__
7916 return __builtin_altivec_vpkshus(__b, __a);
7917#else
7918 return __builtin_altivec_vpkshus(__a, __b);
7919#endif
7920}
7921
7922static __inline__ vector unsigned char __ATTRS_o_ai
7923vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7924#ifdef __LITTLE_ENDIAN__
7925 return __builtin_altivec_vpkuhus(__b, __a);
7926#else
7927 return __builtin_altivec_vpkuhus(__a, __b);
7928#endif
7929}
7930
7931/* vec_vpkswus */
7932
7933static __inline__ vector unsigned short __ATTRS_o_ai
7934vec_vpkswus(vector int __a, vector int __b) {
7935#ifdef __LITTLE_ENDIAN__
7936 return __builtin_altivec_vpkswus(__b, __a);
7937#else
7938 return __builtin_altivec_vpkswus(__a, __b);
7939#endif
7940}
7941
7942static __inline__ vector unsigned short __ATTRS_o_ai
7943vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7944#ifdef __LITTLE_ENDIAN__
7945 return __builtin_altivec_vpkuwus(__b, __a);
7946#else
7947 return __builtin_altivec_vpkuwus(__a, __b);
7948#endif
7949}
7950
7951/* vec_vpksdus */
7952
7953#ifdef __POWER8_VECTOR__
7954static __inline__ vector unsigned int __ATTRS_o_ai
7955vec_vpksdus(vector long long __a, vector long long __b) {
7956#ifdef __LITTLE_ENDIAN__
7957 return __builtin_altivec_vpksdus(__b, __a);
7958#else
7959 return __builtin_altivec_vpksdus(__a, __b);
7960#endif
7961}
7962#endif
7963
7964/* vec_perm */
7965
7966// The vperm instruction is defined architecturally with a big-endian bias.
7967// For little endian, we swap the input operands and invert the permute
7968// control vector. Only the rightmost 5 bits matter, so we could use
7969// a vector of all 31s instead of all 255s to perform the inversion.
7970// However, when the PCV is not a constant, using 255 has an advantage
7971// in that the vec_xor can be recognized as a vec_nor (and for P8 and
7972// later, possibly a vec_nand).
7973
7974static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7975 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7976#ifdef __LITTLE_ENDIAN__
7977 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7978 255, 255, 255, 255, 255, 255, 255, 255};
7979 __d = vec_xor(__c, __d);
7980 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7981 (vector int)__a, __d);
7982#else
7983 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7984 (vector int)__b, __c);
7985#endif
7986}
7987
7988static __inline__ vector unsigned char __ATTRS_o_ai
7989vec_perm(vector unsigned char __a, vector unsigned char __b,
7990 vector unsigned char __c) {
7991#ifdef __LITTLE_ENDIAN__
7992 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7993 255, 255, 255, 255, 255, 255, 255, 255};
7994 __d = vec_xor(__c, __d);
7995 return (vector unsigned char)__builtin_altivec_vperm_4si(
7996 (vector int)__b, (vector int)__a, __d);
7997#else
7998 return (vector unsigned char)__builtin_altivec_vperm_4si(
7999 (vector int)__a, (vector int)__b, __c);
8000#endif
8001}
8002
8003static __inline__ vector bool char __ATTRS_o_ai
8004vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8005#ifdef __LITTLE_ENDIAN__
8006 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8007 255, 255, 255, 255, 255, 255, 255, 255};
8008 __d = vec_xor(__c, __d);
8009 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
8010 (vector int)__a, __d);
8011#else
8012 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
8013 (vector int)__b, __c);
8014#endif
8015}
8016
8017static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
8018 vector signed short __b,
8019 vector unsigned char __c) {
8020#ifdef __LITTLE_ENDIAN__
8021 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8022 255, 255, 255, 255, 255, 255, 255, 255};
8023 __d = vec_xor(__c, __d);
8024 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
8025 (vector int)__a, __d);
8026#else
8027 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
8028 (vector int)__b, __c);
8029#endif
8030}
8031
8032static __inline__ vector unsigned short __ATTRS_o_ai
8033vec_perm(vector unsigned short __a, vector unsigned short __b,
8034 vector unsigned char __c) {
8035#ifdef __LITTLE_ENDIAN__
8036 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8037 255, 255, 255, 255, 255, 255, 255, 255};
8038 __d = vec_xor(__c, __d);
8039 return (vector unsigned short)__builtin_altivec_vperm_4si(
8040 (vector int)__b, (vector int)__a, __d);
8041#else
8042 return (vector unsigned short)__builtin_altivec_vperm_4si(
8043 (vector int)__a, (vector int)__b, __c);
8044#endif
8045}
8046
8047static __inline__ vector bool short __ATTRS_o_ai vec_perm(
8048 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8049#ifdef __LITTLE_ENDIAN__
8050 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8051 255, 255, 255, 255, 255, 255, 255, 255};
8052 __d = vec_xor(__c, __d);
8053 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
8054 (vector int)__a, __d);
8055#else
8056 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
8057 (vector int)__b, __c);
8058#endif
8059}
8060
8061static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
8062 vector pixel __b,
8063 vector unsigned char __c) {
8064#ifdef __LITTLE_ENDIAN__
8065 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8066 255, 255, 255, 255, 255, 255, 255, 255};
8067 __d = vec_xor(__c, __d);
8068 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
8069 (vector int)__a, __d);
8070#else
8071 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
8072 (vector int)__b, __c);
8073#endif
8074}
8075
8076static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
8077 vector signed int __b,
8078 vector unsigned char __c) {
8079#ifdef __LITTLE_ENDIAN__
8080 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8081 255, 255, 255, 255, 255, 255, 255, 255};
8082 __d = vec_xor(__c, __d);
8083 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
8084#else
8085 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
8086#endif
8087}
8088
8089static __inline__ vector unsigned int __ATTRS_o_ai
8090vec_perm(vector unsigned int __a, vector unsigned int __b,
8091 vector unsigned char __c) {
8092#ifdef __LITTLE_ENDIAN__
8093 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8094 255, 255, 255, 255, 255, 255, 255, 255};
8095 __d = vec_xor(__c, __d);
8096 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
8097 (vector int)__a, __d);
8098#else
8099 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
8100 (vector int)__b, __c);
8101#endif
8102}
8103
8104static __inline__ vector bool int __ATTRS_o_ai
8105vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8106#ifdef __LITTLE_ENDIAN__
8107 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8108 255, 255, 255, 255, 255, 255, 255, 255};
8109 __d = vec_xor(__c, __d);
8110 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
8111 (vector int)__a, __d);
8112#else
8113 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
8114 (vector int)__b, __c);
8115#endif
8116}
8117
8118static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
8119 vector float __b,
8120 vector unsigned char __c) {
8121#ifdef __LITTLE_ENDIAN__
8122 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8123 255, 255, 255, 255, 255, 255, 255, 255};
8124 __d = vec_xor(__c, __d);
8125 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
8126 (vector int)__a, __d);
8127#else
8128 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
8129 (vector int)__b, __c);
8130#endif
8131}
8132
8133#ifdef __VSX__
8134static __inline__ vector long long __ATTRS_o_ai
8135vec_perm(vector signed long long __a, vector signed long long __b,
8136 vector unsigned char __c) {
8137#ifdef __LITTLE_ENDIAN__
8138 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8139 255, 255, 255, 255, 255, 255, 255, 255};
8140 __d = vec_xor(__c, __d);
8141 return (vector signed long long)__builtin_altivec_vperm_4si(
8142 (vector int)__b, (vector int)__a, __d);
8143#else
8144 return (vector signed long long)__builtin_altivec_vperm_4si(
8145 (vector int)__a, (vector int)__b, __c);
8146#endif
8147}
8148
8149static __inline__ vector unsigned long long __ATTRS_o_ai
8150vec_perm(vector unsigned long long __a, vector unsigned long long __b,
8151 vector unsigned char __c) {
8152#ifdef __LITTLE_ENDIAN__
8153 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8154 255, 255, 255, 255, 255, 255, 255, 255};
8155 __d = vec_xor(__c, __d);
8156 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8157 (vector int)__b, (vector int)__a, __d);
8158#else
8159 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8160 (vector int)__a, (vector int)__b, __c);
8161#endif
8162}
8163
8164static __inline__ vector bool long long __ATTRS_o_ai
8165vec_perm(vector bool long long __a, vector bool long long __b,
8166 vector unsigned char __c) {
8167#ifdef __LITTLE_ENDIAN__
8168 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8169 255, 255, 255, 255, 255, 255, 255, 255};
8170 __d = vec_xor(__c, __d);
8171 return (vector bool long long)__builtin_altivec_vperm_4si(
8172 (vector int)__b, (vector int)__a, __d);
8173#else
8174 return (vector bool long long)__builtin_altivec_vperm_4si(
8175 (vector int)__a, (vector int)__b, __c);
8176#endif
8177}
8178
8179static __inline__ vector double __ATTRS_o_ai
8180vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
8181#ifdef __LITTLE_ENDIAN__
8182 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8183 255, 255, 255, 255, 255, 255, 255, 255};
8184 __d = vec_xor(__c, __d);
8185 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
8186 (vector int)__a, __d);
8187#else
8188 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
8189 (vector int)__b, __c);
8190#endif
8191}
8192#endif
8193
8194/* vec_vperm */
8195
8196static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
8197 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8198 return vec_perm(__a, __b, __c);
8199}
8200
8201static __inline__ vector unsigned char __ATTRS_o_ai
8202vec_vperm(vector unsigned char __a, vector unsigned char __b,
8203 vector unsigned char __c) {
8204 return vec_perm(__a, __b, __c);
8205}
8206
8207static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
8208 vector bool char __a, vector bool char __b, vector unsigned char __c) {
8209 return vec_perm(__a, __b, __c);
8210}
8211
8212static __inline__ vector short __ATTRS_o_ai
8213vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
8214 return vec_perm(__a, __b, __c);
8215}
8216
8217static __inline__ vector unsigned short __ATTRS_o_ai
8218vec_vperm(vector unsigned short __a, vector unsigned short __b,
8219 vector unsigned char __c) {
8220 return vec_perm(__a, __b, __c);
8221}
8222
8223static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
8224 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8225 return vec_perm(__a, __b, __c);
8226}
8227
8228static __inline__ vector pixel __ATTRS_o_ai
8229vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
8230 return vec_perm(__a, __b, __c);
8231}
8232
8233static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
8234 vector int __b,
8235 vector unsigned char __c) {
8236 return vec_perm(__a, __b, __c);
8237}
8238
8239static __inline__ vector unsigned int __ATTRS_o_ai
8240vec_vperm(vector unsigned int __a, vector unsigned int __b,
8241 vector unsigned char __c) {
8242 return vec_perm(__a, __b, __c);
8243}
8244
8245static __inline__ vector bool int __ATTRS_o_ai
8246vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8247 return vec_perm(__a, __b, __c);
8248}
8249
8250static __inline__ vector float __ATTRS_o_ai
8251vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
8252 return vec_perm(__a, __b, __c);
8253}
8254
8255#ifdef __VSX__
8256static __inline__ vector long long __ATTRS_o_ai vec_vperm(
8257 vector long long __a, vector long long __b, vector unsigned char __c) {
8258 return vec_perm(__a, __b, __c);
8259}
8260
8261static __inline__ vector unsigned long long __ATTRS_o_ai
8262vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
8263 vector unsigned char __c) {
8264 return vec_perm(__a, __b, __c);
8265}
8266
8267static __inline__ vector double __ATTRS_o_ai
8268vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
8269 return vec_perm(__a, __b, __c);
8270}
8271#endif
8272
8273/* vec_re */
8274
8275static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
8276#ifdef __VSX__
8277 return __builtin_vsx_xvresp(__a);
8278#else
8279 return __builtin_altivec_vrefp(__a);
8280#endif
8281}
8282
8283#ifdef __VSX__
8284static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
8285 return __builtin_vsx_xvredp(__a);
8286}
8287#endif
8288
8289/* vec_vrefp */
8290
8291static __inline__ vector float __attribute__((__always_inline__))
8292vec_vrefp(vector float __a) {
8293 return __builtin_altivec_vrefp(__a);
8294}
8295
8296/* vec_rl */
8297
8298static __inline__ vector signed char __ATTRS_o_ai
8299vec_rl(vector signed char __a, vector unsigned char __b) {
8300 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8301}
8302
8303static __inline__ vector unsigned char __ATTRS_o_ai
8304vec_rl(vector unsigned char __a, vector unsigned char __b) {
8305 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8306}
8307
8308static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
8309 vector unsigned short __b) {
8310 return __builtin_altivec_vrlh(__a, __b);
8311}
8312
8313static __inline__ vector unsigned short __ATTRS_o_ai
8314vec_rl(vector unsigned short __a, vector unsigned short __b) {
8315 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8316}
8317
8318static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
8319 vector unsigned int __b) {
8320 return __builtin_altivec_vrlw(__a, __b);
8321}
8322
8323static __inline__ vector unsigned int __ATTRS_o_ai
8324vec_rl(vector unsigned int __a, vector unsigned int __b) {
8325 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8326}
8327
8328#ifdef __POWER8_VECTOR__
8329static __inline__ vector signed long long __ATTRS_o_ai
8330vec_rl(vector signed long long __a, vector unsigned long long __b) {
8331 return __builtin_altivec_vrld(__a, __b);
8332}
8333
8334static __inline__ vector unsigned long long __ATTRS_o_ai
8335vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
8336 return (vector unsigned long long)__builtin_altivec_vrld(
8337 (vector long long)__a, __b);
8338}
8339#endif
8340
8341#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8342static __inline__ vector signed __int128 __ATTRS_o_ai
8343vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) {
8344 return (vector signed __int128)(((vector unsigned __int128)__b
8345 << (vector unsigned __int128)__a) |
8346 ((vector unsigned __int128)__b >>
8347 ((__CHAR_BIT__ *
8348 sizeof(vector unsigned __int128)) -
8349 (vector unsigned __int128)__a)));
8350}
8351
8352static __inline__ vector unsigned __int128 __ATTRS_o_ai
8353vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
8354 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a));
8355}
8356#endif
8357
8358/* vec_rlmi */
8359#ifdef __POWER9_VECTOR__
8360static __inline__ vector unsigned int __ATTRS_o_ai
8361vec_rlmi(vector unsigned int __a, vector unsigned int __b,
8362 vector unsigned int __c) {
8363 return __builtin_altivec_vrlwmi(__a, __c, __b);
8364}
8365
8366static __inline__ vector unsigned long long __ATTRS_o_ai
8367vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
8368 vector unsigned long long __c) {
8369 return __builtin_altivec_vrldmi(__a, __c, __b);
8370}
8371#endif
8372
8373#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8374static __inline__ vector unsigned __int128 __ATTRS_o_ai
8375vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b,
8376 vector unsigned __int128 __c) {
8377 return __builtin_altivec_vrlqmi(__a, __c, __b);
8378}
8379
8380static __inline__ vector signed __int128 __ATTRS_o_ai
8381vec_rlmi(vector signed __int128 __a, vector signed __int128 __b,
8382 vector signed __int128 __c) {
8383 return (vector signed __int128)__builtin_altivec_vrlqmi(
8384 (vector unsigned __int128)__a, (vector unsigned __int128)__c,
8385 (vector unsigned __int128)__b);
8386}
8387#endif
8388
8389/* vec_rlnm */
8390#ifdef __POWER9_VECTOR__
8391static __inline__ vector unsigned int __ATTRS_o_ai
8392vec_rlnm(vector unsigned int __a, vector unsigned int __b,
8393 vector unsigned int __c) {
8394 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
8395 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
8396}
8397
8398static __inline__ vector unsigned long long __ATTRS_o_ai
8399vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
8400 vector unsigned long long __c) {
8401 vector unsigned long long OneByte = { 0x8, 0x8 };
8402 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
8403}
8404#endif
8405
8406#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8407static __inline__ vector unsigned __int128 __ATTRS_o_ai
8408vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b,
8409 vector unsigned __int128 __c) {
8410 // Merge __b and __c using an appropriate shuffle.
8411 vector unsigned char TmpB = (vector unsigned char)__b;
8412 vector unsigned char TmpC = (vector unsigned char)__c;
8413 vector unsigned char MaskAndShift =
8414#ifdef __LITTLE_ENDIAN__
8415 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8416 1, -1, -1, -1, -1, -1);
8417#else
8418 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8419 -1, -1, -1, -1, -1, -1, -1);
8420#endif
8421 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8422}
8423
8424static __inline__ vector signed __int128 __ATTRS_o_ai
8425vec_rlnm(vector signed __int128 __a, vector signed __int128 __b,
8426 vector signed __int128 __c) {
8427 // Merge __b and __c using an appropriate shuffle.
8428 vector unsigned char TmpB = (vector unsigned char)__b;
8429 vector unsigned char TmpC = (vector unsigned char)__c;
8430 vector unsigned char MaskAndShift =
8431#ifdef __LITTLE_ENDIAN__
8432 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8433 1, -1, -1, -1, -1, -1);
8434#else
8435 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8436 -1, -1, -1, -1, -1, -1, -1);
8437#endif
8438 return (vector signed __int128)__builtin_altivec_vrlqnm(
8439 (vector unsigned __int128)__a, (vector unsigned __int128)MaskAndShift);
8440}
8441#endif
8442
8443/* vec_vrlb */
8444
8445static __inline__ vector signed char __ATTRS_o_ai
8446vec_vrlb(vector signed char __a, vector unsigned char __b) {
8447 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8448}
8449
8450static __inline__ vector unsigned char __ATTRS_o_ai
8451vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
8452 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8453}
8454
8455/* vec_vrlh */
8456
8457static __inline__ vector short __ATTRS_o_ai
8458vec_vrlh(vector short __a, vector unsigned short __b) {
8459 return __builtin_altivec_vrlh(__a, __b);
8460}
8461
8462static __inline__ vector unsigned short __ATTRS_o_ai
8463vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
8464 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8465}
8466
8467/* vec_vrlw */
8468
8469static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
8470 vector unsigned int __b) {
8471 return __builtin_altivec_vrlw(__a, __b);
8472}
8473
8474static __inline__ vector unsigned int __ATTRS_o_ai
8475vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
8476 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8477}
8478
8479/* vec_round */
8480
8481static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
8482 return __builtin_altivec_vrfin(__a);
8483}
8484
8485#ifdef __VSX__
8486#ifdef __XL_COMPAT_ALTIVEC__
8487static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a);
8488static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8489 double __fpscr = __builtin_readflm();
8490 __builtin_setrnd(0);
8491 vector double __rounded = vec_rint(__a);
8492 __builtin_setflm(__fpscr);
8493 return __rounded;
8494}
8495#else
8496static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8497 return __builtin_vsx_xvrdpi(__a);
8498}
8499#endif
8500
8501/* vec_rint */
8502
8503static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
8504 return __builtin_vsx_xvrspic(__a);
8505}
8506
8507static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
8508 return __builtin_vsx_xvrdpic(__a);
8509}
8510
8511/* vec_roundc */
8512
8513static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) {
8514 return __builtin_vsx_xvrspic(__a);
8515}
8516
8517static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) {
8518 return __builtin_vsx_xvrdpic(__a);
8519}
8520
8521/* vec_nearbyint */
8522
8523static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
8524 return __builtin_vsx_xvrspi(__a);
8525}
8526
8527static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
8528 return __builtin_vsx_xvrdpi(__a);
8529}
8530#endif
8531
8532/* vec_vrfin */
8533
8534static __inline__ vector float __attribute__((__always_inline__))
8535vec_vrfin(vector float __a) {
8536 return __builtin_altivec_vrfin(__a);
8537}
8538
8539/* vec_sqrt */
8540
8541#ifdef __VSX__
8542static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
8543 return __builtin_vsx_xvsqrtsp(__a);
8544}
8545
8546static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
8547 return __builtin_vsx_xvsqrtdp(__a);
8548}
8549#endif
8550
8551/* vec_rsqrte */
8552
8553static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
8554#ifdef __VSX__
8555 return __builtin_vsx_xvrsqrtesp(__a);
8556#else
8557 return __builtin_altivec_vrsqrtefp(__a);
8558#endif
8559}
8560
8561#ifdef __VSX__
8562static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
8563 return __builtin_vsx_xvrsqrtedp(__a);
8564}
8565#endif
8566
8567static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) {
8568 return __builtin_ppc_rsqrtf(__a);
8569}
8570
8571#ifdef __VSX__
8572static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) {
8573 return __builtin_ppc_rsqrtd(__a);
8574}
8575#endif
8576
8577/* vec_vrsqrtefp */
8578
8579static __inline__ __vector float __attribute__((__always_inline__))
8580vec_vrsqrtefp(vector float __a) {
8581 return __builtin_altivec_vrsqrtefp(__a);
8582}
8583
8584/* vec_xvtsqrt */
8585
8586#ifdef __VSX__
8587static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) {
8588 return __builtin_vsx_xvtsqrtdp(__a);
8589}
8590
8591static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) {
8592 return __builtin_vsx_xvtsqrtsp(__a);
8593}
8594#endif
8595
8596/* vec_sel */
8597
8598#define __builtin_altivec_vsel_4si vec_sel
8599
8600static __inline__ vector signed char __ATTRS_o_ai vec_sel(
8601 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8602 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8603}
8604
8605static __inline__ vector signed char __ATTRS_o_ai
8606vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
8607 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8608}
8609
8610static __inline__ vector unsigned char __ATTRS_o_ai
8611vec_sel(vector unsigned char __a, vector unsigned char __b,
8612 vector unsigned char __c) {
8613 return (__a & ~__c) | (__b & __c);
8614}
8615
8616static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
8617 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8618 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8619}
8620
8621static __inline__ vector bool char __ATTRS_o_ai
8622vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8623 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8624}
8625
8626static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
8627 vector bool char __b,
8628 vector bool char __c) {
8629 return (__a & ~__c) | (__b & __c);
8630}
8631
8632static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8633 vector short __b,
8634 vector unsigned short __c) {
8635 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8636}
8637
8638static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8639 vector short __b,
8640 vector bool short __c) {
8641 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8642}
8643
8644static __inline__ vector unsigned short __ATTRS_o_ai
8645vec_sel(vector unsigned short __a, vector unsigned short __b,
8646 vector unsigned short __c) {
8647 return (__a & ~__c) | (__b & __c);
8648}
8649
8650static __inline__ vector unsigned short __ATTRS_o_ai
8651vec_sel(vector unsigned short __a, vector unsigned short __b,
8652 vector bool short __c) {
8653 return (__a & ~(vector unsigned short)__c) |
8654 (__b & (vector unsigned short)__c);
8655}
8656
8657static __inline__ vector bool short __ATTRS_o_ai vec_sel(
8658 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8659 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8660}
8661
8662static __inline__ vector bool short __ATTRS_o_ai
8663vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
8664 return (__a & ~__c) | (__b & __c);
8665}
8666
8667static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8668 vector int __b,
8669 vector unsigned int __c) {
8670 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8671}
8672
8673static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8674 vector int __b,
8675 vector bool int __c) {
8676 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8677}
8678
8679static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
8680 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8681 return (__a & ~__c) | (__b & __c);
8682}
8683
8684static __inline__ vector unsigned int __ATTRS_o_ai
8685vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8686 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8687}
8688
8689static __inline__ vector bool int __ATTRS_o_ai
8690vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8691 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8692}
8693
8694static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
8695 vector bool int __b,
8696 vector bool int __c) {
8697 return (__a & ~__c) | (__b & __c);
8698}
8699
8700static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8701 vector float __b,
8702 vector unsigned int __c) {
8703 vector int __res = ((vector int)__a & ~(vector int)__c) |
8704 ((vector int)__b & (vector int)__c);
8705 return (vector float)__res;
8706}
8707
8708static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8709 vector float __b,
8710 vector bool int __c) {
8711 vector int __res = ((vector int)__a & ~(vector int)__c) |
8712 ((vector int)__b & (vector int)__c);
8713 return (vector float)__res;
8714}
8715
8716#ifdef __VSX__
8717static __inline__ vector double __ATTRS_o_ai
8718vec_sel(vector double __a, vector double __b, vector bool long long __c) {
8719 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8720 ((vector long long)__b & (vector long long)__c);
8721 return (vector double)__res;
8722}
8723
8724static __inline__ vector double __ATTRS_o_ai
8725vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
8726 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8727 ((vector long long)__b & (vector long long)__c);
8728 return (vector double)__res;
8729}
8730
8731static __inline__ vector bool long long __ATTRS_o_ai
8732vec_sel(vector bool long long __a, vector bool long long __b,
8733 vector bool long long __c) {
8734 return (__a & ~__c) | (__b & __c);
8735}
8736
8737static __inline__ vector bool long long __ATTRS_o_ai
8738vec_sel(vector bool long long __a, vector bool long long __b,
8739 vector unsigned long long __c) {
8740 return (__a & ~(vector bool long long)__c) |
8741 (__b & (vector bool long long)__c);
8742}
8743
8744static __inline__ vector signed long long __ATTRS_o_ai
8745vec_sel(vector signed long long __a, vector signed long long __b,
8746 vector bool long long __c) {
8747 return (__a & ~(vector signed long long)__c) |
8748 (__b & (vector signed long long)__c);
8749}
8750
8751static __inline__ vector signed long long __ATTRS_o_ai
8752vec_sel(vector signed long long __a, vector signed long long __b,
8753 vector unsigned long long __c) {
8754 return (__a & ~(vector signed long long)__c) |
8755 (__b & (vector signed long long)__c);
8756}
8757
8758static __inline__ vector unsigned long long __ATTRS_o_ai
8759vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8760 vector bool long long __c) {
8761 return (__a & ~(vector unsigned long long)__c) |
8762 (__b & (vector unsigned long long)__c);
8763}
8764
8765static __inline__ vector unsigned long long __ATTRS_o_ai
8766vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8767 vector unsigned long long __c) {
8768 return (__a & ~__c) | (__b & __c);
8769}
8770#endif
8771
8772/* vec_vsel */
8773
8774static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
8775 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8776 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8777}
8778
8779static __inline__ vector signed char __ATTRS_o_ai
8780vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
8781 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8782}
8783
8784static __inline__ vector unsigned char __ATTRS_o_ai
8785vec_vsel(vector unsigned char __a, vector unsigned char __b,
8786 vector unsigned char __c) {
8787 return (__a & ~__c) | (__b & __c);
8788}
8789
8790static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
8791 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8792 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8793}
8794
8795static __inline__ vector bool char __ATTRS_o_ai
8796vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8797 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8798}
8799
8800static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
8801 vector bool char __b,
8802 vector bool char __c) {
8803 return (__a & ~__c) | (__b & __c);
8804}
8805
8806static __inline__ vector short __ATTRS_o_ai
8807vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
8808 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8809}
8810
8811static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
8812 vector short __b,
8813 vector bool short __c) {
8814 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8815}
8816
8817static __inline__ vector unsigned short __ATTRS_o_ai
8818vec_vsel(vector unsigned short __a, vector unsigned short __b,
8819 vector unsigned short __c) {
8820 return (__a & ~__c) | (__b & __c);
8821}
8822
8823static __inline__ vector unsigned short __ATTRS_o_ai
8824vec_vsel(vector unsigned short __a, vector unsigned short __b,
8825 vector bool short __c) {
8826 return (__a & ~(vector unsigned short)__c) |
8827 (__b & (vector unsigned short)__c);
8828}
8829
8830static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
8831 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8832 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8833}
8834
8835static __inline__ vector bool short __ATTRS_o_ai
8836vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
8837 return (__a & ~__c) | (__b & __c);
8838}
8839
8840static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8841 vector int __b,
8842 vector unsigned int __c) {
8843 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8844}
8845
8846static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8847 vector int __b,
8848 vector bool int __c) {
8849 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8850}
8851
8852static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8853 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8854 return (__a & ~__c) | (__b & __c);
8855}
8856
8857static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8858 vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8859 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8860}
8861
8862static __inline__ vector bool int __ATTRS_o_ai
8863vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8864 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8865}
8866
8867static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8868 vector bool int __b,
8869 vector bool int __c) {
8870 return (__a & ~__c) | (__b & __c);
8871}
8872
8873static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8874 vector float __b,
8875 vector unsigned int __c) {
8876 vector int __res = ((vector int)__a & ~(vector int)__c) |
8877 ((vector int)__b & (vector int)__c);
8878 return (vector float)__res;
8879}
8880
8881static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8882 vector float __b,
8883 vector bool int __c) {
8884 vector int __res = ((vector int)__a & ~(vector int)__c) |
8885 ((vector int)__b & (vector int)__c);
8886 return (vector float)__res;
8887}
8888
8889/* vec_sl */
8890
8891// vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8892// than the length of __a.
8893static __inline__ vector unsigned char __ATTRS_o_ai
8894vec_sl(vector unsigned char __a, vector unsigned char __b) {
8895 return __a << (__b %
8896 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8897}
8898
8899static __inline__ vector signed char __ATTRS_o_ai
8900vec_sl(vector signed char __a, vector unsigned char __b) {
8901 return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8902}
8903
8904static __inline__ vector unsigned short __ATTRS_o_ai
8905vec_sl(vector unsigned short __a, vector unsigned short __b) {
8906 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8907 __CHAR_BIT__));
8908}
8909
8910static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8911 vector unsigned short __b) {
8912 return (vector short)vec_sl((vector unsigned short)__a, __b);
8913}
8914
8915static __inline__ vector unsigned int __ATTRS_o_ai
8916vec_sl(vector unsigned int __a, vector unsigned int __b) {
8917 return __a << (__b %
8918 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8919}
8920
8921static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8922 vector unsigned int __b) {
8923 return (vector int)vec_sl((vector unsigned int)__a, __b);
8924}
8925
8926#ifdef __POWER8_VECTOR__
8927static __inline__ vector unsigned long long __ATTRS_o_ai
8928vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8929 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8930 __CHAR_BIT__));
8931}
8932
8933static __inline__ vector long long __ATTRS_o_ai
8934vec_sl(vector long long __a, vector unsigned long long __b) {
8935 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8936}
8937#elif defined(__VSX__)
8938static __inline__ vector unsigned char __ATTRS_o_ai
8939vec_vspltb(vector unsigned char __a, unsigned char __b);
8940static __inline__ vector unsigned long long __ATTRS_o_ai
8941vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8942 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
8943
8944 // Big endian element one (the right doubleword) can be left shifted as-is.
8945 // The other element needs to be swapped into the right doubleword and
8946 // shifted. Then the right doublewords of the two result vectors are merged.
8947 vector signed long long __rightelt =
8948 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8949 (vector signed int)__b);
8950#ifdef __LITTLE_ENDIAN__
8951 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8952 (vector signed int)__rightelt,
8953 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8954#else
8955 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8956 (vector signed int)__rightelt,
8957 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8958#endif
8959 __a = __builtin_shufflevector(__a, __a, 1, 0);
8960 __b = __builtin_shufflevector(__b, __b, 1, 0);
8961 vector signed long long __leftelt =
8962 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8963 (vector signed int)__b);
8964#ifdef __LITTLE_ENDIAN__
8965 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8966 (vector signed int)__leftelt,
8967 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8968 return (vector unsigned long long)__builtin_shufflevector(__rightelt,
8969 __leftelt, 0, 2);
8970#else
8971 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8972 (vector signed int)__leftelt,
8973 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8974 return (vector unsigned long long)__builtin_shufflevector(__leftelt,
8975 __rightelt, 1, 3);
8976#endif
8977}
8978
8979static __inline__ vector long long __ATTRS_o_ai
8980vec_sl(vector long long __a, vector unsigned long long __b) {
8981 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8982}
8983#endif /* __VSX__ */
8984
8985/* vec_vslb */
8986
8987#define __builtin_altivec_vslb vec_vslb
8988
8989static __inline__ vector signed char __ATTRS_o_ai
8990vec_vslb(vector signed char __a, vector unsigned char __b) {
8991 return vec_sl(__a, __b);
8992}
8993
8994static __inline__ vector unsigned char __ATTRS_o_ai
8995vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8996 return vec_sl(__a, __b);
8997}
8998
8999/* vec_vslh */
9000
9001#define __builtin_altivec_vslh vec_vslh
9002
9003static __inline__ vector short __ATTRS_o_ai
9004vec_vslh(vector short __a, vector unsigned short __b) {
9005 return vec_sl(__a, __b);
9006}
9007
9008static __inline__ vector unsigned short __ATTRS_o_ai
9009vec_vslh(vector unsigned short __a, vector unsigned short __b) {
9010 return vec_sl(__a, __b);
9011}
9012
9013/* vec_vslw */
9014
9015#define __builtin_altivec_vslw vec_vslw
9016
9017static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
9018 vector unsigned int __b) {
9019 return vec_sl(__a, __b);
9020}
9021
9022static __inline__ vector unsigned int __ATTRS_o_ai
9023vec_vslw(vector unsigned int __a, vector unsigned int __b) {
9024 return vec_sl(__a, __b);
9025}
9026
9027/* vec_sld */
9028
9029#define __builtin_altivec_vsldoi_4si vec_sld
9030
9031static __inline__ vector signed char __ATTRS_o_ai vec_sld(
9032 vector signed char __a, vector signed char __b, unsigned const int __c) {
9033 unsigned char __d = __c & 0x0F;
9034#ifdef __LITTLE_ENDIAN__
9035 return vec_perm(
9036 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9037 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9038 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9039 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9040#else
9041 return vec_perm(
9042 __a, __b,
9043 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9044 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9045 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9046#endif
9047}
9048
9049static __inline__ vector unsigned char __ATTRS_o_ai
9050vec_sld(vector unsigned char __a, vector unsigned char __b,
9051 unsigned const int __c) {
9052 unsigned char __d = __c & 0x0F;
9053#ifdef __LITTLE_ENDIAN__
9054 return vec_perm(
9055 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9056 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9057 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9058 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9059#else
9060 return vec_perm(
9061 __a, __b,
9062 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9063 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9064 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9065#endif
9066}
9067
9068static __inline__ vector bool char __ATTRS_o_ai
9069vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
9070 unsigned char __d = __c & 0x0F;
9071#ifdef __LITTLE_ENDIAN__
9072 return vec_perm(
9073 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9074 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9075 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9076 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9077#else
9078 return vec_perm(
9079 __a, __b,
9080 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9081 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9082 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9083#endif
9084}
9085
9086static __inline__ vector signed short __ATTRS_o_ai vec_sld(
9087 vector signed short __a, vector signed short __b, unsigned const int __c) {
9088 unsigned char __d = __c & 0x0F;
9089#ifdef __LITTLE_ENDIAN__
9090 return vec_perm(
9091 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9092 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9093 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9094 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9095#else
9096 return vec_perm(
9097 __a, __b,
9098 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9099 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9100 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9101#endif
9102}
9103
9104static __inline__ vector unsigned short __ATTRS_o_ai
9105vec_sld(vector unsigned short __a, vector unsigned short __b,
9106 unsigned const int __c) {
9107 unsigned char __d = __c & 0x0F;
9108#ifdef __LITTLE_ENDIAN__
9109 return vec_perm(
9110 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9111 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9112 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9113 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9114#else
9115 return vec_perm(
9116 __a, __b,
9117 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9118 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9119 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9120#endif
9121}
9122
9123static __inline__ vector bool short __ATTRS_o_ai
9124vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
9125 unsigned char __d = __c & 0x0F;
9126#ifdef __LITTLE_ENDIAN__
9127 return vec_perm(
9128 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9129 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9130 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9131 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9132#else
9133 return vec_perm(
9134 __a, __b,
9135 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9136 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9137 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9138#endif
9139}
9140
9141static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
9142 vector pixel __b,
9143 unsigned const int __c) {
9144 unsigned char __d = __c & 0x0F;
9145#ifdef __LITTLE_ENDIAN__
9146 return vec_perm(
9147 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9148 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9149 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9150 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9151#else
9152 return vec_perm(
9153 __a, __b,
9154 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9155 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9156 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9157#endif
9158}
9159
9160static __inline__ vector signed int __ATTRS_o_ai
9161vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
9162 unsigned char __d = __c & 0x0F;
9163#ifdef __LITTLE_ENDIAN__
9164 return vec_perm(
9165 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9166 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9167 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9168 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9169#else
9170 return vec_perm(
9171 __a, __b,
9172 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9173 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9174 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9175#endif
9176}
9177
9178static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
9179 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9180 unsigned char __d = __c & 0x0F;
9181#ifdef __LITTLE_ENDIAN__
9182 return vec_perm(
9183 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9184 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9185 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9186 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9187#else
9188 return vec_perm(
9189 __a, __b,
9190 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9191 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9192 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9193#endif
9194}
9195
9196static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
9197 vector bool int __b,
9198 unsigned const int __c) {
9199 unsigned char __d = __c & 0x0F;
9200#ifdef __LITTLE_ENDIAN__
9201 return vec_perm(
9202 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9203 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9204 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9205 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9206#else
9207 return vec_perm(
9208 __a, __b,
9209 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9210 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9211 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9212#endif
9213}
9214
9215static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
9216 vector float __b,
9217 unsigned const int __c) {
9218 unsigned char __d = __c & 0x0F;
9219#ifdef __LITTLE_ENDIAN__
9220 return vec_perm(
9221 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9222 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9223 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9224 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9225#else
9226 return vec_perm(
9227 __a, __b,
9228 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9229 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9230 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9231#endif
9232}
9233
9234#ifdef __VSX__
9235static __inline__ vector bool long long __ATTRS_o_ai
9236vec_sld(vector bool long long __a, vector bool long long __b,
9237 unsigned const int __c) {
9238 unsigned char __d = __c & 0x0F;
9239#ifdef __LITTLE_ENDIAN__
9240 return vec_perm(
9241 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9242 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9243 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9244 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9245#else
9246 return vec_perm(
9247 __a, __b,
9248 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9249 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9250 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9251#endif
9252}
9253
9254static __inline__ vector signed long long __ATTRS_o_ai
9255vec_sld(vector signed long long __a, vector signed long long __b,
9256 unsigned const int __c) {
9257 unsigned char __d = __c & 0x0F;
9258#ifdef __LITTLE_ENDIAN__
9259 return vec_perm(
9260 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9261 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9262 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9263 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9264#else
9265 return vec_perm(
9266 __a, __b,
9267 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9268 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9269 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9270#endif
9271}
9272
9273static __inline__ vector unsigned long long __ATTRS_o_ai
9274vec_sld(vector unsigned long long __a, vector unsigned long long __b,
9275 unsigned const int __c) {
9276 unsigned char __d = __c & 0x0F;
9277#ifdef __LITTLE_ENDIAN__
9278 return vec_perm(
9279 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9280 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9281 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9282 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9283#else
9284 return vec_perm(
9285 __a, __b,
9286 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9287 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9288 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9289#endif
9290}
9291
9292static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
9293 vector double __b,
9294 unsigned const int __c) {
9295 unsigned char __d = __c & 0x0F;
9296#ifdef __LITTLE_ENDIAN__
9297 return vec_perm(
9298 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9299 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9300 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9301 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9302#else
9303 return vec_perm(
9304 __a, __b,
9305 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9306 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9307 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9308#endif
9309}
9310#endif
9311
9312/* vec_sldw */
9313static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
9314 vector signed char __a, vector signed char __b, unsigned const int __c) {
9315 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9316}
9317
9318static __inline__ vector unsigned char __ATTRS_o_ai
9319vec_sldw(vector unsigned char __a, vector unsigned char __b,
9320 unsigned const int __c) {
9321 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9322}
9323
9324static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
9325 vector signed short __a, vector signed short __b, unsigned const int __c) {
9326 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9327}
9328
9329static __inline__ vector unsigned short __ATTRS_o_ai
9330vec_sldw(vector unsigned short __a, vector unsigned short __b,
9331 unsigned const int __c) {
9332 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9333}
9334
9335static __inline__ vector signed int __ATTRS_o_ai
9336vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
9337 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9338}
9339
9340static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
9341 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9342 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9343}
9344
9345static __inline__ vector float __ATTRS_o_ai vec_sldw(
9346 vector float __a, vector float __b, unsigned const int __c) {
9347 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9348}
9349
9350#ifdef __VSX__
9351static __inline__ vector signed long long __ATTRS_o_ai
9352vec_sldw(vector signed long long __a, vector signed long long __b,
9353 unsigned const int __c) {
9354 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9355}
9356
9357static __inline__ vector unsigned long long __ATTRS_o_ai
9358vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
9359 unsigned const int __c) {
9360 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9361}
9362
9363static __inline__ vector double __ATTRS_o_ai vec_sldw(
9364 vector double __a, vector double __b, unsigned const int __c) {
9365 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9366}
9367#endif
9368
9369#ifdef __POWER9_VECTOR__
9370/* vec_slv */
9371static __inline__ vector unsigned char __ATTRS_o_ai
9372vec_slv(vector unsigned char __a, vector unsigned char __b) {
9373 return __builtin_altivec_vslv(__a, __b);
9374}
9375
9376/* vec_srv */
9377static __inline__ vector unsigned char __ATTRS_o_ai
9378vec_srv(vector unsigned char __a, vector unsigned char __b) {
9379 return __builtin_altivec_vsrv(__a, __b);
9380}
9381#endif
9382
9383/* vec_vsldoi */
9384
9385static __inline__ vector signed char __ATTRS_o_ai
9386vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
9387 unsigned char __d = __c & 0x0F;
9388#ifdef __LITTLE_ENDIAN__
9389 return vec_perm(
9390 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9391 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9392 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9393 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9394#else
9395 return vec_perm(
9396 __a, __b,
9397 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9398 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9399 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9400#endif
9401}
9402
9403static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
9404 vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
9405 unsigned char __d = __c & 0x0F;
9406#ifdef __LITTLE_ENDIAN__
9407 return vec_perm(
9408 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9409 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9410 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9411 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9412#else
9413 return vec_perm(
9414 __a, __b,
9415 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9416 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9417 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9418#endif
9419}
9420
9421static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
9422 vector short __b,
9423 unsigned char __c) {
9424 unsigned char __d = __c & 0x0F;
9425#ifdef __LITTLE_ENDIAN__
9426 return vec_perm(
9427 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9428 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9429 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9430 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9431#else
9432 return vec_perm(
9433 __a, __b,
9434 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9435 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9436 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9437#endif
9438}
9439
9440static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
9441 vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
9442 unsigned char __d = __c & 0x0F;
9443#ifdef __LITTLE_ENDIAN__
9444 return vec_perm(
9445 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9446 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9447 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9448 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9449#else
9450 return vec_perm(
9451 __a, __b,
9452 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9453 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9454 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9455#endif
9456}
9457
9458static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
9459 vector pixel __b,
9460 unsigned char __c) {
9461 unsigned char __d = __c & 0x0F;
9462#ifdef __LITTLE_ENDIAN__
9463 return vec_perm(
9464 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9465 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9466 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9467 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9468#else
9469 return vec_perm(
9470 __a, __b,
9471 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9472 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9473 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9474#endif
9475}
9476
9477static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
9478 vector int __b,
9479 unsigned char __c) {
9480 unsigned char __d = __c & 0x0F;
9481#ifdef __LITTLE_ENDIAN__
9482 return vec_perm(
9483 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9484 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9485 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9486 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9487#else
9488 return vec_perm(
9489 __a, __b,
9490 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9491 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9492 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9493#endif
9494}
9495
9496static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
9497 vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
9498 unsigned char __d = __c & 0x0F;
9499#ifdef __LITTLE_ENDIAN__
9500 return vec_perm(
9501 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9502 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9503 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9504 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9505#else
9506 return vec_perm(
9507 __a, __b,
9508 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9509 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9510 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9511#endif
9512}
9513
9514static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
9515 vector float __b,
9516 unsigned char __c) {
9517 unsigned char __d = __c & 0x0F;
9518#ifdef __LITTLE_ENDIAN__
9519 return vec_perm(
9520 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9521 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9522 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9523 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9524#else
9525 return vec_perm(
9526 __a, __b,
9527 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9528 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9529 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9530#endif
9531}
9532
9533/* vec_sll */
9534
9535static __inline__ vector signed char __ATTRS_o_ai
9536vec_sll(vector signed char __a, vector unsigned char __b) {
9537 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9538 (vector int)__b);
9539}
9540
9541static __inline__ vector signed char __ATTRS_o_ai
9542vec_sll(vector signed char __a, vector unsigned short __b) {
9543 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9544 (vector int)__b);
9545}
9546
9547static __inline__ vector signed char __ATTRS_o_ai
9548vec_sll(vector signed char __a, vector unsigned int __b) {
9549 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9550 (vector int)__b);
9551}
9552
9553static __inline__ vector unsigned char __ATTRS_o_ai
9554vec_sll(vector unsigned char __a, vector unsigned char __b) {
9555 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9556 (vector int)__b);
9557}
9558
9559static __inline__ vector unsigned char __ATTRS_o_ai
9560vec_sll(vector unsigned char __a, vector unsigned short __b) {
9561 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9562 (vector int)__b);
9563}
9564
9565static __inline__ vector unsigned char __ATTRS_o_ai
9566vec_sll(vector unsigned char __a, vector unsigned int __b) {
9567 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9568 (vector int)__b);
9569}
9570
9571static __inline__ vector bool char __ATTRS_o_ai
9572vec_sll(vector bool char __a, vector unsigned char __b) {
9573 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9574 (vector int)__b);
9575}
9576
9577static __inline__ vector bool char __ATTRS_o_ai
9578vec_sll(vector bool char __a, vector unsigned short __b) {
9579 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9580 (vector int)__b);
9581}
9582
9583static __inline__ vector bool char __ATTRS_o_ai
9584vec_sll(vector bool char __a, vector unsigned int __b) {
9585 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9586 (vector int)__b);
9587}
9588
9589static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9590 vector unsigned char __b) {
9591 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9592}
9593
9594static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9595 vector unsigned short __b) {
9596 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9597}
9598
9599static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9600 vector unsigned int __b) {
9601 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9602}
9603
9604static __inline__ vector unsigned short __ATTRS_o_ai
9605vec_sll(vector unsigned short __a, vector unsigned char __b) {
9606 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9607 (vector int)__b);
9608}
9609
9610static __inline__ vector unsigned short __ATTRS_o_ai
9611vec_sll(vector unsigned short __a, vector unsigned short __b) {
9612 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9613 (vector int)__b);
9614}
9615
9616static __inline__ vector unsigned short __ATTRS_o_ai
9617vec_sll(vector unsigned short __a, vector unsigned int __b) {
9618 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9619 (vector int)__b);
9620}
9621
9622static __inline__ vector bool short __ATTRS_o_ai
9623vec_sll(vector bool short __a, vector unsigned char __b) {
9624 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9625 (vector int)__b);
9626}
9627
9628static __inline__ vector bool short __ATTRS_o_ai
9629vec_sll(vector bool short __a, vector unsigned short __b) {
9630 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9631 (vector int)__b);
9632}
9633
9634static __inline__ vector bool short __ATTRS_o_ai
9635vec_sll(vector bool short __a, vector unsigned int __b) {
9636 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9637 (vector int)__b);
9638}
9639
9640static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9641 vector unsigned char __b) {
9642 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9643}
9644
9645static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9646 vector unsigned short __b) {
9647 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9648}
9649
9650static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9651 vector unsigned int __b) {
9652 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9653}
9654
9655static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9656 vector unsigned char __b) {
9657 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9658}
9659
9660static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9661 vector unsigned short __b) {
9662 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9663}
9664
9665static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9666 vector unsigned int __b) {
9667 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9668}
9669
9670static __inline__ vector unsigned int __ATTRS_o_ai
9671vec_sll(vector unsigned int __a, vector unsigned char __b) {
9672 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9673 (vector int)__b);
9674}
9675
9676static __inline__ vector unsigned int __ATTRS_o_ai
9677vec_sll(vector unsigned int __a, vector unsigned short __b) {
9678 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9679 (vector int)__b);
9680}
9681
9682static __inline__ vector unsigned int __ATTRS_o_ai
9683vec_sll(vector unsigned int __a, vector unsigned int __b) {
9684 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9685 (vector int)__b);
9686}
9687
9688static __inline__ vector bool int __ATTRS_o_ai
9689vec_sll(vector bool int __a, vector unsigned char __b) {
9690 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9691 (vector int)__b);
9692}
9693
9694static __inline__ vector bool int __ATTRS_o_ai
9695vec_sll(vector bool int __a, vector unsigned short __b) {
9696 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9697 (vector int)__b);
9698}
9699
9700static __inline__ vector bool int __ATTRS_o_ai
9701vec_sll(vector bool int __a, vector unsigned int __b) {
9702 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9703 (vector int)__b);
9704}
9705
9706#ifdef __VSX__
9707static __inline__ vector signed long long __ATTRS_o_ai
9708vec_sll(vector signed long long __a, vector unsigned char __b) {
9709 return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
9710 (vector int)__b);
9711}
9712
9713static __inline__ vector unsigned long long __ATTRS_o_ai
9714vec_sll(vector unsigned long long __a, vector unsigned char __b) {
9715 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
9716 (vector int)__b);
9717}
9718#endif
9719
9720/* vec_vsl */
9721
9722static __inline__ vector signed char __ATTRS_o_ai
9723vec_vsl(vector signed char __a, vector unsigned char __b) {
9724 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9725 (vector int)__b);
9726}
9727
9728static __inline__ vector signed char __ATTRS_o_ai
9729vec_vsl(vector signed char __a, vector unsigned short __b) {
9730 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9731 (vector int)__b);
9732}
9733
9734static __inline__ vector signed char __ATTRS_o_ai
9735vec_vsl(vector signed char __a, vector unsigned int __b) {
9736 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9737 (vector int)__b);
9738}
9739
9740static __inline__ vector unsigned char __ATTRS_o_ai
9741vec_vsl(vector unsigned char __a, vector unsigned char __b) {
9742 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9743 (vector int)__b);
9744}
9745
9746static __inline__ vector unsigned char __ATTRS_o_ai
9747vec_vsl(vector unsigned char __a, vector unsigned short __b) {
9748 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9749 (vector int)__b);
9750}
9751
9752static __inline__ vector unsigned char __ATTRS_o_ai
9753vec_vsl(vector unsigned char __a, vector unsigned int __b) {
9754 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9755 (vector int)__b);
9756}
9757
9758static __inline__ vector bool char __ATTRS_o_ai
9759vec_vsl(vector bool char __a, vector unsigned char __b) {
9760 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9761 (vector int)__b);
9762}
9763
9764static __inline__ vector bool char __ATTRS_o_ai
9765vec_vsl(vector bool char __a, vector unsigned short __b) {
9766 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9767 (vector int)__b);
9768}
9769
9770static __inline__ vector bool char __ATTRS_o_ai
9771vec_vsl(vector bool char __a, vector unsigned int __b) {
9772 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9773 (vector int)__b);
9774}
9775
9776static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9777 vector unsigned char __b) {
9778 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9779}
9780
9781static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9782 vector unsigned short __b) {
9783 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9784}
9785
9786static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9787 vector unsigned int __b) {
9788 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9789}
9790
9791static __inline__ vector unsigned short __ATTRS_o_ai
9792vec_vsl(vector unsigned short __a, vector unsigned char __b) {
9793 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9794 (vector int)__b);
9795}
9796
9797static __inline__ vector unsigned short __ATTRS_o_ai
9798vec_vsl(vector unsigned short __a, vector unsigned short __b) {
9799 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9800 (vector int)__b);
9801}
9802
9803static __inline__ vector unsigned short __ATTRS_o_ai
9804vec_vsl(vector unsigned short __a, vector unsigned int __b) {
9805 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9806 (vector int)__b);
9807}
9808
9809static __inline__ vector bool short __ATTRS_o_ai
9810vec_vsl(vector bool short __a, vector unsigned char __b) {
9811 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9812 (vector int)__b);
9813}
9814
9815static __inline__ vector bool short __ATTRS_o_ai
9816vec_vsl(vector bool short __a, vector unsigned short __b) {
9817 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9818 (vector int)__b);
9819}
9820
9821static __inline__ vector bool short __ATTRS_o_ai
9822vec_vsl(vector bool short __a, vector unsigned int __b) {
9823 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9824 (vector int)__b);
9825}
9826
9827static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9828 vector unsigned char __b) {
9829 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9830}
9831
9832static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9833 vector unsigned short __b) {
9834 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9835}
9836
9837static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9838 vector unsigned int __b) {
9839 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9840}
9841
9842static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9843 vector unsigned char __b) {
9844 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9845}
9846
9847static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9848 vector unsigned short __b) {
9849 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9850}
9851
9852static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9853 vector unsigned int __b) {
9854 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9855}
9856
9857static __inline__ vector unsigned int __ATTRS_o_ai
9858vec_vsl(vector unsigned int __a, vector unsigned char __b) {
9859 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9860 (vector int)__b);
9861}
9862
9863static __inline__ vector unsigned int __ATTRS_o_ai
9864vec_vsl(vector unsigned int __a, vector unsigned short __b) {
9865 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9866 (vector int)__b);
9867}
9868
9869static __inline__ vector unsigned int __ATTRS_o_ai
9870vec_vsl(vector unsigned int __a, vector unsigned int __b) {
9871 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9872 (vector int)__b);
9873}
9874
9875static __inline__ vector bool int __ATTRS_o_ai
9876vec_vsl(vector bool int __a, vector unsigned char __b) {
9877 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9878 (vector int)__b);
9879}
9880
9881static __inline__ vector bool int __ATTRS_o_ai
9882vec_vsl(vector bool int __a, vector unsigned short __b) {
9883 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9884 (vector int)__b);
9885}
9886
9887static __inline__ vector bool int __ATTRS_o_ai
9888vec_vsl(vector bool int __a, vector unsigned int __b) {
9889 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9890 (vector int)__b);
9891}
9892
9893/* vec_slo */
9894
9895static __inline__ vector signed char __ATTRS_o_ai
9896vec_slo(vector signed char __a, vector signed char __b) {
9897 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9898 (vector int)__b);
9899}
9900
9901static __inline__ vector signed char __ATTRS_o_ai
9902vec_slo(vector signed char __a, vector unsigned char __b) {
9903 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9904 (vector int)__b);
9905}
9906
9907static __inline__ vector unsigned char __ATTRS_o_ai
9908vec_slo(vector unsigned char __a, vector signed char __b) {
9909 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9910 (vector int)__b);
9911}
9912
9913static __inline__ vector unsigned char __ATTRS_o_ai
9914vec_slo(vector unsigned char __a, vector unsigned char __b) {
9915 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9916 (vector int)__b);
9917}
9918
9919static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9920 vector signed char __b) {
9921 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9922}
9923
9924static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9925 vector unsigned char __b) {
9926 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9927}
9928
9929static __inline__ vector unsigned short __ATTRS_o_ai
9930vec_slo(vector unsigned short __a, vector signed char __b) {
9931 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9932 (vector int)__b);
9933}
9934
9935static __inline__ vector unsigned short __ATTRS_o_ai
9936vec_slo(vector unsigned short __a, vector unsigned char __b) {
9937 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9938 (vector int)__b);
9939}
9940
9941static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9942 vector signed char __b) {
9943 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9944}
9945
9946static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9947 vector unsigned char __b) {
9948 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9949}
9950
9951static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9952 vector signed char __b) {
9953 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9954}
9955
9956static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9957 vector unsigned char __b) {
9958 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9959}
9960
9961static __inline__ vector unsigned int __ATTRS_o_ai
9962vec_slo(vector unsigned int __a, vector signed char __b) {
9963 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9964 (vector int)__b);
9965}
9966
9967static __inline__ vector unsigned int __ATTRS_o_ai
9968vec_slo(vector unsigned int __a, vector unsigned char __b) {
9969 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9970 (vector int)__b);
9971}
9972
9973static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9974 vector signed char __b) {
9975 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9976}
9977
9978static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9979 vector unsigned char __b) {
9980 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9981}
9982
9983#ifdef __VSX__
9984static __inline__ vector signed long long __ATTRS_o_ai
9985vec_slo(vector signed long long __a, vector signed char __b) {
9986 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9987 (vector int)__b);
9988}
9989
9990static __inline__ vector signed long long __ATTRS_o_ai
9991vec_slo(vector signed long long __a, vector unsigned char __b) {
9992 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9993 (vector int)__b);
9994}
9995
9996static __inline__ vector unsigned long long __ATTRS_o_ai
9997vec_slo(vector unsigned long long __a, vector signed char __b) {
9998 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9999 (vector int)__b);
10000}
10001
10002static __inline__ vector unsigned long long __ATTRS_o_ai
10003vec_slo(vector unsigned long long __a, vector unsigned char __b) {
10004 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
10005 (vector int)__b);
10006}
10007#endif
10008
10009/* vec_vslo */
10010
10011static __inline__ vector signed char __ATTRS_o_ai
10012vec_vslo(vector signed char __a, vector signed char __b) {
10013 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10014 (vector int)__b);
10015}
10016
10017static __inline__ vector signed char __ATTRS_o_ai
10018vec_vslo(vector signed char __a, vector unsigned char __b) {
10019 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10020 (vector int)__b);
10021}
10022
10023static __inline__ vector unsigned char __ATTRS_o_ai
10024vec_vslo(vector unsigned char __a, vector signed char __b) {
10025 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10026 (vector int)__b);
10027}
10028
10029static __inline__ vector unsigned char __ATTRS_o_ai
10030vec_vslo(vector unsigned char __a, vector unsigned char __b) {
10031 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10032 (vector int)__b);
10033}
10034
10035static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10036 vector signed char __b) {
10037 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10038}
10039
10040static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10041 vector unsigned char __b) {
10042 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10043}
10044
10045static __inline__ vector unsigned short __ATTRS_o_ai
10046vec_vslo(vector unsigned short __a, vector signed char __b) {
10047 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10048 (vector int)__b);
10049}
10050
10051static __inline__ vector unsigned short __ATTRS_o_ai
10052vec_vslo(vector unsigned short __a, vector unsigned char __b) {
10053 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10054 (vector int)__b);
10055}
10056
10057static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10058 vector signed char __b) {
10059 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10060}
10061
10062static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10063 vector unsigned char __b) {
10064 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10065}
10066
10067static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10068 vector signed char __b) {
10069 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10070}
10071
10072static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10073 vector unsigned char __b) {
10074 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10075}
10076
10077static __inline__ vector unsigned int __ATTRS_o_ai
10078vec_vslo(vector unsigned int __a, vector signed char __b) {
10079 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10080 (vector int)__b);
10081}
10082
10083static __inline__ vector unsigned int __ATTRS_o_ai
10084vec_vslo(vector unsigned int __a, vector unsigned char __b) {
10085 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10086 (vector int)__b);
10087}
10088
10089static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10090 vector signed char __b) {
10091 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10092}
10093
10094static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10095 vector unsigned char __b) {
10096 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10097}
10098
10099/* vec_splat */
10100
10101static __inline__ vector signed char __ATTRS_o_ai
10102vec_splat(vector signed char __a, unsigned const int __b) {
10103 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10104}
10105
10106static __inline__ vector unsigned char __ATTRS_o_ai
10107vec_splat(vector unsigned char __a, unsigned const int __b) {
10108 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10109}
10110
10111static __inline__ vector bool char __ATTRS_o_ai
10112vec_splat(vector bool char __a, unsigned const int __b) {
10113 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10114}
10115
10116static __inline__ vector signed short __ATTRS_o_ai
10117vec_splat(vector signed short __a, unsigned const int __b) {
10118 unsigned char b0 = (__b & 0x07) * 2;
10119 unsigned char b1 = b0 + 1;
10120 return vec_perm(__a, __a,
10121 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10122 b0, b1, b0, b1, b0, b1));
10123}
10124
10125static __inline__ vector unsigned short __ATTRS_o_ai
10126vec_splat(vector unsigned short __a, unsigned const int __b) {
10127 unsigned char b0 = (__b & 0x07) * 2;
10128 unsigned char b1 = b0 + 1;
10129 return vec_perm(__a, __a,
10130 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10131 b0, b1, b0, b1, b0, b1));
10132}
10133
10134static __inline__ vector bool short __ATTRS_o_ai
10135vec_splat(vector bool short __a, unsigned const int __b) {
10136 unsigned char b0 = (__b & 0x07) * 2;
10137 unsigned char b1 = b0 + 1;
10138 return vec_perm(__a, __a,
10139 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10140 b0, b1, b0, b1, b0, b1));
10141}
10142
10143static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
10144 unsigned const int __b) {
10145 unsigned char b0 = (__b & 0x07) * 2;
10146 unsigned char b1 = b0 + 1;
10147 return vec_perm(__a, __a,
10148 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10149 b0, b1, b0, b1, b0, b1));
10150}
10151
10152static __inline__ vector signed int __ATTRS_o_ai
10153vec_splat(vector signed int __a, unsigned const int __b) {
10154 unsigned char b0 = (__b & 0x03) * 4;
10155 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10156 return vec_perm(__a, __a,
10157 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10158 b2, b3, b0, b1, b2, b3));
10159}
10160
10161static __inline__ vector unsigned int __ATTRS_o_ai
10162vec_splat(vector unsigned int __a, unsigned const int __b) {
10163 unsigned char b0 = (__b & 0x03) * 4;
10164 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10165 return vec_perm(__a, __a,
10166 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10167 b2, b3, b0, b1, b2, b3));
10168}
10169
10170static __inline__ vector bool int __ATTRS_o_ai
10171vec_splat(vector bool int __a, unsigned const int __b) {
10172 unsigned char b0 = (__b & 0x03) * 4;
10173 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10174 return vec_perm(__a, __a,
10175 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10176 b2, b3, b0, b1, b2, b3));
10177}
10178
10179static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
10180 unsigned const int __b) {
10181 unsigned char b0 = (__b & 0x03) * 4;
10182 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10183 return vec_perm(__a, __a,
10184 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10185 b2, b3, b0, b1, b2, b3));
10186}
10187
10188#ifdef __VSX__
10189static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
10190 unsigned const int __b) {
10191 unsigned char b0 = (__b & 0x01) * 8;
10192 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10193 b6 = b0 + 6, b7 = b0 + 7;
10194 return vec_perm(__a, __a,
10195 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10196 b2, b3, b4, b5, b6, b7));
10197}
10198static __inline__ vector bool long long __ATTRS_o_ai
10199vec_splat(vector bool long long __a, unsigned const int __b) {
10200 unsigned char b0 = (__b & 0x01) * 8;
10201 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10202 b6 = b0 + 6, b7 = b0 + 7;
10203 return vec_perm(__a, __a,
10204 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10205 b2, b3, b4, b5, b6, b7));
10206}
10207static __inline__ vector signed long long __ATTRS_o_ai
10208vec_splat(vector signed long long __a, unsigned const int __b) {
10209 unsigned char b0 = (__b & 0x01) * 8;
10210 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10211 b6 = b0 + 6, b7 = b0 + 7;
10212 return vec_perm(__a, __a,
10213 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10214 b2, b3, b4, b5, b6, b7));
10215}
10216static __inline__ vector unsigned long long __ATTRS_o_ai
10217vec_splat(vector unsigned long long __a, unsigned const int __b) {
10218 unsigned char b0 = (__b & 0x01) * 8;
10219 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10220 b6 = b0 + 6, b7 = b0 + 7;
10221 return vec_perm(__a, __a,
10222 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10223 b2, b3, b4, b5, b6, b7));
10224}
10225#endif
10226
10227/* vec_vspltb */
10228
10229#define __builtin_altivec_vspltb vec_vspltb
10230
10231static __inline__ vector signed char __ATTRS_o_ai
10232vec_vspltb(vector signed char __a, unsigned char __b) {
10233 return vec_perm(__a, __a, (vector unsigned char)(__b));
10234}
10235
10236static __inline__ vector unsigned char __ATTRS_o_ai
10237vec_vspltb(vector unsigned char __a, unsigned char __b) {
10238 return vec_perm(__a, __a, (vector unsigned char)(__b));
10239}
10240
10241static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
10242 unsigned char __b) {
10243 return vec_perm(__a, __a, (vector unsigned char)(__b));
10244}
10245
10246/* vec_vsplth */
10247
10248#define __builtin_altivec_vsplth vec_vsplth
10249
10250static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
10251 unsigned char __b) {
10252 __b *= 2;
10253 unsigned char b1 = __b + 1;
10254 return vec_perm(__a, __a,
10255 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10256 __b, b1, __b, b1, __b, b1, __b, b1));
10257}
10258
10259static __inline__ vector unsigned short __ATTRS_o_ai
10260vec_vsplth(vector unsigned short __a, unsigned char __b) {
10261 __b *= 2;
10262 unsigned char b1 = __b + 1;
10263 return vec_perm(__a, __a,
10264 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10265 __b, b1, __b, b1, __b, b1, __b, b1));
10266}
10267
10268static __inline__ vector bool short __ATTRS_o_ai
10269vec_vsplth(vector bool short __a, unsigned char __b) {
10270 __b *= 2;
10271 unsigned char b1 = __b + 1;
10272 return vec_perm(__a, __a,
10273 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10274 __b, b1, __b, b1, __b, b1, __b, b1));
10275}
10276
10277static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
10278 unsigned char __b) {
10279 __b *= 2;
10280 unsigned char b1 = __b + 1;
10281 return vec_perm(__a, __a,
10282 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10283 __b, b1, __b, b1, __b, b1, __b, b1));
10284}
10285
10286/* vec_vspltw */
10287
10288#define __builtin_altivec_vspltw vec_vspltw
10289
10290static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
10291 unsigned char __b) {
10292 __b *= 4;
10293 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10294 return vec_perm(__a, __a,
10295 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10296 b1, b2, b3, __b, b1, b2, b3));
10297}
10298
10299static __inline__ vector unsigned int __ATTRS_o_ai
10300vec_vspltw(vector unsigned int __a, unsigned char __b) {
10301 __b *= 4;
10302 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10303 return vec_perm(__a, __a,
10304 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10305 b1, b2, b3, __b, b1, b2, b3));
10306}
10307
10308static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
10309 unsigned char __b) {
10310 __b *= 4;
10311 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10312 return vec_perm(__a, __a,
10313 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10314 b1, b2, b3, __b, b1, b2, b3));
10315}
10316
10317static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
10318 unsigned char __b) {
10319 __b *= 4;
10320 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10321 return vec_perm(__a, __a,
10322 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10323 b1, b2, b3, __b, b1, b2, b3));
10324}
10325
10326/* vec_splat_s8 */
10327
10328#define __builtin_altivec_vspltisb vec_splat_s8
10329
10330// FIXME: parameter should be treated as 5-bit signed literal
10331static __inline__ vector signed char __ATTRS_o_ai
10332vec_splat_s8(signed char __a) {
10333 return (vector signed char)(__a);
10334}
10335
10336/* vec_vspltisb */
10337
10338// FIXME: parameter should be treated as 5-bit signed literal
10339static __inline__ vector signed char __ATTRS_o_ai
10340vec_vspltisb(signed char __a) {
10341 return (vector signed char)(__a);
10342}
10343
10344/* vec_splat_s16 */
10345
10346#define __builtin_altivec_vspltish vec_splat_s16
10347
10348// FIXME: parameter should be treated as 5-bit signed literal
10349static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
10350 return (vector short)(__a);
10351}
10352
10353/* vec_vspltish */
10354
10355// FIXME: parameter should be treated as 5-bit signed literal
10356static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
10357 return (vector short)(__a);
10358}
10359
10360/* vec_splat_s32 */
10361
10362#define __builtin_altivec_vspltisw vec_splat_s32
10363
10364// FIXME: parameter should be treated as 5-bit signed literal
10365static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
10366 return (vector int)(__a);
10367}
10368
10369/* vec_vspltisw */
10370
10371// FIXME: parameter should be treated as 5-bit signed literal
10372static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
10373 return (vector int)(__a);
10374}
10375
10376/* vec_splat_u8 */
10377
10378// FIXME: parameter should be treated as 5-bit signed literal
10379static __inline__ vector unsigned char __ATTRS_o_ai
10380vec_splat_u8(unsigned char __a) {
10381 return (vector unsigned char)(__a);
10382}
10383
10384/* vec_splat_u16 */
10385
10386// FIXME: parameter should be treated as 5-bit signed literal
10387static __inline__ vector unsigned short __ATTRS_o_ai
10388vec_splat_u16(signed char __a) {
10389 return (vector unsigned short)(__a);
10390}
10391
10392/* vec_splat_u32 */
10393
10394// FIXME: parameter should be treated as 5-bit signed literal
10395static __inline__ vector unsigned int __ATTRS_o_ai
10396vec_splat_u32(signed char __a) {
10397 return (vector unsigned int)(__a);
10398}
10399
10400/* vec_sr */
10401
10402// vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
10403// than the length of __a.
10404static __inline__ vector unsigned char __ATTRS_o_ai
10405vec_sr(vector unsigned char __a, vector unsigned char __b) {
10406 return __a >>
10407 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
10408}
10409
10410static __inline__ vector signed char __ATTRS_o_ai
10411vec_sr(vector signed char __a, vector unsigned char __b) {
10412 return (vector signed char)vec_sr((vector unsigned char)__a, __b);
10413}
10414
10415static __inline__ vector unsigned short __ATTRS_o_ai
10416vec_sr(vector unsigned short __a, vector unsigned short __b) {
10417 return __a >>
10418 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
10419}
10420
10421static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
10422 vector unsigned short __b) {
10423 return (vector short)vec_sr((vector unsigned short)__a, __b);
10424}
10425
10426static __inline__ vector unsigned int __ATTRS_o_ai
10427vec_sr(vector unsigned int __a, vector unsigned int __b) {
10428 return __a >>
10429 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
10430}
10431
10432static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
10433 vector unsigned int __b) {
10434 return (vector int)vec_sr((vector unsigned int)__a, __b);
10435}
10436
10437#ifdef __POWER8_VECTOR__
10438static __inline__ vector unsigned long long __ATTRS_o_ai
10439vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10440 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
10441 __CHAR_BIT__));
10442}
10443
10444static __inline__ vector long long __ATTRS_o_ai
10445vec_sr(vector long long __a, vector unsigned long long __b) {
10446 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10447}
10448#elif defined(__VSX__)
10449static __inline__ vector unsigned long long __ATTRS_o_ai
10450vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10451 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10452
10453 // Big endian element zero (the left doubleword) can be right shifted as-is.
10454 // However the shift amount must be in the right doubleword.
10455 // The other element needs to be swapped into the left doubleword and
10456 // shifted. Then the left doublewords of the two result vectors are merged.
10457 vector unsigned long long __swapshift =
10458 __builtin_shufflevector(__b, __b, 1, 0);
10459 vector unsigned long long __leftelt =
10460 (vector unsigned long long)__builtin_altivec_vsro(
10461 (vector signed int)__a, (vector signed int)__swapshift);
10462#ifdef __LITTLE_ENDIAN__
10463 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10464 (vector signed int)__leftelt,
10465 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0));
10466#else
10467 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10468 (vector signed int)__leftelt,
10469 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15));
10470#endif
10471 __a = __builtin_shufflevector(__a, __a, 1, 0);
10472 vector unsigned long long __rightelt =
10473 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a,
10474 (vector signed int)__b);
10475#ifdef __LITTLE_ENDIAN__
10476 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10477 (vector signed int)__rightelt,
10478 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
10479 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3);
10480#else
10481 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10482 (vector signed int)__rightelt,
10483 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
10484 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2);
10485#endif
10486}
10487
10488static __inline__ vector long long __ATTRS_o_ai
10489vec_sr(vector long long __a, vector unsigned long long __b) {
10490 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10491}
10492#endif /* __VSX__ */
10493
10494/* vec_vsrb */
10495
10496#define __builtin_altivec_vsrb vec_vsrb
10497
10498static __inline__ vector signed char __ATTRS_o_ai
10499vec_vsrb(vector signed char __a, vector unsigned char __b) {
10500 return vec_sr(__a, __b);
10501}
10502
10503static __inline__ vector unsigned char __ATTRS_o_ai
10504vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
10505 return vec_sr(__a, __b);
10506}
10507
10508/* vec_vsrh */
10509
10510#define __builtin_altivec_vsrh vec_vsrh
10511
10512static __inline__ vector short __ATTRS_o_ai
10513vec_vsrh(vector short __a, vector unsigned short __b) {
10514 return vec_sr(__a, __b);
10515}
10516
10517static __inline__ vector unsigned short __ATTRS_o_ai
10518vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
10519 return vec_sr(__a, __b);
10520}
10521
10522/* vec_vsrw */
10523
10524#define __builtin_altivec_vsrw vec_vsrw
10525
10526static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
10527 vector unsigned int __b) {
10528 return vec_sr(__a, __b);
10529}
10530
10531static __inline__ vector unsigned int __ATTRS_o_ai
10532vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
10533 return vec_sr(__a, __b);
10534}
10535
10536/* vec_sra */
10537
10538static __inline__ vector signed char __ATTRS_o_ai
10539vec_sra(vector signed char __a, vector unsigned char __b) {
10540 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10541}
10542
10543static __inline__ vector unsigned char __ATTRS_o_ai
10544vec_sra(vector unsigned char __a, vector unsigned char __b) {
10545 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10546}
10547
10548static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
10549 vector unsigned short __b) {
10550 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10551}
10552
10553static __inline__ vector unsigned short __ATTRS_o_ai
10554vec_sra(vector unsigned short __a, vector unsigned short __b) {
10555 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10556}
10557
10558static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
10559 vector unsigned int __b) {
10560 return __builtin_altivec_vsraw(__a, __b);
10561}
10562
10563static __inline__ vector unsigned int __ATTRS_o_ai
10564vec_sra(vector unsigned int __a, vector unsigned int __b) {
10565 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10566}
10567
10568#ifdef __POWER8_VECTOR__
10569static __inline__ vector signed long long __ATTRS_o_ai
10570vec_sra(vector signed long long __a, vector unsigned long long __b) {
10571 return __a >> __b;
10572}
10573
10574static __inline__ vector unsigned long long __ATTRS_o_ai
10575vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10576 return (vector unsigned long long)((vector signed long long)__a >> __b);
10577}
10578#elif defined(__VSX__)
10579static __inline__ vector signed long long __ATTRS_o_ai
10580vec_sra(vector signed long long __a, vector unsigned long long __b) {
10581 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10582 return __a >> __b;
10583}
10584
10585static __inline__ vector unsigned long long __ATTRS_o_ai
10586vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10587 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10588 return (vector unsigned long long)((vector signed long long)__a >> __b);
10589}
10590#endif /* __VSX__ */
10591
10592/* vec_vsrab */
10593
10594static __inline__ vector signed char __ATTRS_o_ai
10595vec_vsrab(vector signed char __a, vector unsigned char __b) {
10596 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10597}
10598
10599static __inline__ vector unsigned char __ATTRS_o_ai
10600vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
10601 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10602}
10603
10604/* vec_vsrah */
10605
10606static __inline__ vector short __ATTRS_o_ai
10607vec_vsrah(vector short __a, vector unsigned short __b) {
10608 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10609}
10610
10611static __inline__ vector unsigned short __ATTRS_o_ai
10612vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
10613 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10614}
10615
10616/* vec_vsraw */
10617
10618static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
10619 vector unsigned int __b) {
10620 return __builtin_altivec_vsraw(__a, __b);
10621}
10622
10623static __inline__ vector unsigned int __ATTRS_o_ai
10624vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
10625 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10626}
10627
10628/* vec_srl */
10629
10630static __inline__ vector signed char __ATTRS_o_ai
10631vec_srl(vector signed char __a, vector unsigned char __b) {
10632 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10633 (vector int)__b);
10634}
10635
10636static __inline__ vector signed char __ATTRS_o_ai
10637vec_srl(vector signed char __a, vector unsigned short __b) {
10638 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10639 (vector int)__b);
10640}
10641
10642static __inline__ vector signed char __ATTRS_o_ai
10643vec_srl(vector signed char __a, vector unsigned int __b) {
10644 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10645 (vector int)__b);
10646}
10647
10648static __inline__ vector unsigned char __ATTRS_o_ai
10649vec_srl(vector unsigned char __a, vector unsigned char __b) {
10650 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10651 (vector int)__b);
10652}
10653
10654static __inline__ vector unsigned char __ATTRS_o_ai
10655vec_srl(vector unsigned char __a, vector unsigned short __b) {
10656 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10657 (vector int)__b);
10658}
10659
10660static __inline__ vector unsigned char __ATTRS_o_ai
10661vec_srl(vector unsigned char __a, vector unsigned int __b) {
10662 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10663 (vector int)__b);
10664}
10665
10666static __inline__ vector bool char __ATTRS_o_ai
10667vec_srl(vector bool char __a, vector unsigned char __b) {
10668 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10669 (vector int)__b);
10670}
10671
10672static __inline__ vector bool char __ATTRS_o_ai
10673vec_srl(vector bool char __a, vector unsigned short __b) {
10674 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10675 (vector int)__b);
10676}
10677
10678static __inline__ vector bool char __ATTRS_o_ai
10679vec_srl(vector bool char __a, vector unsigned int __b) {
10680 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10681 (vector int)__b);
10682}
10683
10684static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10685 vector unsigned char __b) {
10686 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10687}
10688
10689static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10690 vector unsigned short __b) {
10691 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10692}
10693
10694static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10695 vector unsigned int __b) {
10696 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10697}
10698
10699static __inline__ vector unsigned short __ATTRS_o_ai
10700vec_srl(vector unsigned short __a, vector unsigned char __b) {
10701 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10702 (vector int)__b);
10703}
10704
10705static __inline__ vector unsigned short __ATTRS_o_ai
10706vec_srl(vector unsigned short __a, vector unsigned short __b) {
10707 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10708 (vector int)__b);
10709}
10710
10711static __inline__ vector unsigned short __ATTRS_o_ai
10712vec_srl(vector unsigned short __a, vector unsigned int __b) {
10713 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10714 (vector int)__b);
10715}
10716
10717static __inline__ vector bool short __ATTRS_o_ai
10718vec_srl(vector bool short __a, vector unsigned char __b) {
10719 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10720 (vector int)__b);
10721}
10722
10723static __inline__ vector bool short __ATTRS_o_ai
10724vec_srl(vector bool short __a, vector unsigned short __b) {
10725 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10726 (vector int)__b);
10727}
10728
10729static __inline__ vector bool short __ATTRS_o_ai
10730vec_srl(vector bool short __a, vector unsigned int __b) {
10731 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10732 (vector int)__b);
10733}
10734
10735static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10736 vector unsigned char __b) {
10737 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10738}
10739
10740static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10741 vector unsigned short __b) {
10742 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10743}
10744
10745static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10746 vector unsigned int __b) {
10747 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10748}
10749
10750static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10751 vector unsigned char __b) {
10752 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10753}
10754
10755static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10756 vector unsigned short __b) {
10757 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10758}
10759
10760static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10761 vector unsigned int __b) {
10762 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10763}
10764
10765static __inline__ vector unsigned int __ATTRS_o_ai
10766vec_srl(vector unsigned int __a, vector unsigned char __b) {
10767 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10768 (vector int)__b);
10769}
10770
10771static __inline__ vector unsigned int __ATTRS_o_ai
10772vec_srl(vector unsigned int __a, vector unsigned short __b) {
10773 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10774 (vector int)__b);
10775}
10776
10777static __inline__ vector unsigned int __ATTRS_o_ai
10778vec_srl(vector unsigned int __a, vector unsigned int __b) {
10779 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10780 (vector int)__b);
10781}
10782
10783static __inline__ vector bool int __ATTRS_o_ai
10784vec_srl(vector bool int __a, vector unsigned char __b) {
10785 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10786 (vector int)__b);
10787}
10788
10789static __inline__ vector bool int __ATTRS_o_ai
10790vec_srl(vector bool int __a, vector unsigned short __b) {
10791 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10792 (vector int)__b);
10793}
10794
10795static __inline__ vector bool int __ATTRS_o_ai
10796vec_srl(vector bool int __a, vector unsigned int __b) {
10797 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10798 (vector int)__b);
10799}
10800
10801#ifdef __VSX__
10802static __inline__ vector signed long long __ATTRS_o_ai
10803vec_srl(vector signed long long __a, vector unsigned char __b) {
10804 return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
10805 (vector int)__b);
10806}
10807
10808static __inline__ vector unsigned long long __ATTRS_o_ai
10809vec_srl(vector unsigned long long __a, vector unsigned char __b) {
10810 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
10811 (vector int)__b);
10812}
10813#endif
10814
10815/* vec_vsr */
10816
10817static __inline__ vector signed char __ATTRS_o_ai
10818vec_vsr(vector signed char __a, vector unsigned char __b) {
10819 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10820 (vector int)__b);
10821}
10822
10823static __inline__ vector signed char __ATTRS_o_ai
10824vec_vsr(vector signed char __a, vector unsigned short __b) {
10825 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10826 (vector int)__b);
10827}
10828
10829static __inline__ vector signed char __ATTRS_o_ai
10830vec_vsr(vector signed char __a, vector unsigned int __b) {
10831 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10832 (vector int)__b);
10833}
10834
10835static __inline__ vector unsigned char __ATTRS_o_ai
10836vec_vsr(vector unsigned char __a, vector unsigned char __b) {
10837 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10838 (vector int)__b);
10839}
10840
10841static __inline__ vector unsigned char __ATTRS_o_ai
10842vec_vsr(vector unsigned char __a, vector unsigned short __b) {
10843 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10844 (vector int)__b);
10845}
10846
10847static __inline__ vector unsigned char __ATTRS_o_ai
10848vec_vsr(vector unsigned char __a, vector unsigned int __b) {
10849 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10850 (vector int)__b);
10851}
10852
10853static __inline__ vector bool char __ATTRS_o_ai
10854vec_vsr(vector bool char __a, vector unsigned char __b) {
10855 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10856 (vector int)__b);
10857}
10858
10859static __inline__ vector bool char __ATTRS_o_ai
10860vec_vsr(vector bool char __a, vector unsigned short __b) {
10861 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10862 (vector int)__b);
10863}
10864
10865static __inline__ vector bool char __ATTRS_o_ai
10866vec_vsr(vector bool char __a, vector unsigned int __b) {
10867 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10868 (vector int)__b);
10869}
10870
10871static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10872 vector unsigned char __b) {
10873 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10874}
10875
10876static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10877 vector unsigned short __b) {
10878 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10879}
10880
10881static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10882 vector unsigned int __b) {
10883 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10884}
10885
10886static __inline__ vector unsigned short __ATTRS_o_ai
10887vec_vsr(vector unsigned short __a, vector unsigned char __b) {
10888 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10889 (vector int)__b);
10890}
10891
10892static __inline__ vector unsigned short __ATTRS_o_ai
10893vec_vsr(vector unsigned short __a, vector unsigned short __b) {
10894 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10895 (vector int)__b);
10896}
10897
10898static __inline__ vector unsigned short __ATTRS_o_ai
10899vec_vsr(vector unsigned short __a, vector unsigned int __b) {
10900 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10901 (vector int)__b);
10902}
10903
10904static __inline__ vector bool short __ATTRS_o_ai
10905vec_vsr(vector bool short __a, vector unsigned char __b) {
10906 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10907 (vector int)__b);
10908}
10909
10910static __inline__ vector bool short __ATTRS_o_ai
10911vec_vsr(vector bool short __a, vector unsigned short __b) {
10912 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10913 (vector int)__b);
10914}
10915
10916static __inline__ vector bool short __ATTRS_o_ai
10917vec_vsr(vector bool short __a, vector unsigned int __b) {
10918 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10919 (vector int)__b);
10920}
10921
10922static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10923 vector unsigned char __b) {
10924 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10925}
10926
10927static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10928 vector unsigned short __b) {
10929 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10930}
10931
10932static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10933 vector unsigned int __b) {
10934 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10935}
10936
10937static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10938 vector unsigned char __b) {
10939 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10940}
10941
10942static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10943 vector unsigned short __b) {
10944 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10945}
10946
10947static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10948 vector unsigned int __b) {
10949 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10950}
10951
10952static __inline__ vector unsigned int __ATTRS_o_ai
10953vec_vsr(vector unsigned int __a, vector unsigned char __b) {
10954 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10955 (vector int)__b);
10956}
10957
10958static __inline__ vector unsigned int __ATTRS_o_ai
10959vec_vsr(vector unsigned int __a, vector unsigned short __b) {
10960 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10961 (vector int)__b);
10962}
10963
10964static __inline__ vector unsigned int __ATTRS_o_ai
10965vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10966 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10967 (vector int)__b);
10968}
10969
10970static __inline__ vector bool int __ATTRS_o_ai
10971vec_vsr(vector bool int __a, vector unsigned char __b) {
10972 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10973 (vector int)__b);
10974}
10975
10976static __inline__ vector bool int __ATTRS_o_ai
10977vec_vsr(vector bool int __a, vector unsigned short __b) {
10978 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10979 (vector int)__b);
10980}
10981
10982static __inline__ vector bool int __ATTRS_o_ai
10983vec_vsr(vector bool int __a, vector unsigned int __b) {
10984 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10985 (vector int)__b);
10986}
10987
10988/* vec_sro */
10989
10990static __inline__ vector signed char __ATTRS_o_ai
10991vec_sro(vector signed char __a, vector signed char __b) {
10992 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10993 (vector int)__b);
10994}
10995
10996static __inline__ vector signed char __ATTRS_o_ai
10997vec_sro(vector signed char __a, vector unsigned char __b) {
10998 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10999 (vector int)__b);
11000}
11001
11002static __inline__ vector unsigned char __ATTRS_o_ai
11003vec_sro(vector unsigned char __a, vector signed char __b) {
11004 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11005 (vector int)__b);
11006}
11007
11008static __inline__ vector unsigned char __ATTRS_o_ai
11009vec_sro(vector unsigned char __a, vector unsigned char __b) {
11010 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11011 (vector int)__b);
11012}
11013
11014static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11015 vector signed char __b) {
11016 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11017}
11018
11019static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11020 vector unsigned char __b) {
11021 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11022}
11023
11024static __inline__ vector unsigned short __ATTRS_o_ai
11025vec_sro(vector unsigned short __a, vector signed char __b) {
11026 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11027 (vector int)__b);
11028}
11029
11030static __inline__ vector unsigned short __ATTRS_o_ai
11031vec_sro(vector unsigned short __a, vector unsigned char __b) {
11032 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11033 (vector int)__b);
11034}
11035
11036static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11037 vector signed char __b) {
11038 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11039}
11040
11041static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11042 vector unsigned char __b) {
11043 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11044}
11045
11046static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11047 vector signed char __b) {
11048 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11049}
11050
11051static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11052 vector unsigned char __b) {
11053 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11054}
11055
11056static __inline__ vector unsigned int __ATTRS_o_ai
11057vec_sro(vector unsigned int __a, vector signed char __b) {
11058 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11059 (vector int)__b);
11060}
11061
11062static __inline__ vector unsigned int __ATTRS_o_ai
11063vec_sro(vector unsigned int __a, vector unsigned char __b) {
11064 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11065 (vector int)__b);
11066}
11067
11068static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11069 vector signed char __b) {
11070 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11071}
11072
11073static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11074 vector unsigned char __b) {
11075 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11076}
11077
11078#ifdef __VSX__
11079static __inline__ vector signed long long __ATTRS_o_ai
11080vec_sro(vector signed long long __a, vector signed char __b) {
11081 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11082 (vector int)__b);
11083}
11084
11085static __inline__ vector signed long long __ATTRS_o_ai
11086vec_sro(vector signed long long __a, vector unsigned char __b) {
11087 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11088 (vector int)__b);
11089}
11090
11091static __inline__ vector unsigned long long __ATTRS_o_ai
11092vec_sro(vector unsigned long long __a, vector signed char __b) {
11093 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11094 (vector int)__b);
11095}
11096
11097static __inline__ vector unsigned long long __ATTRS_o_ai
11098vec_sro(vector unsigned long long __a, vector unsigned char __b) {
11099 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11100 (vector int)__b);
11101}
11102#endif
11103
11104/* vec_vsro */
11105
11106static __inline__ vector signed char __ATTRS_o_ai
11107vec_vsro(vector signed char __a, vector signed char __b) {
11108 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11109 (vector int)__b);
11110}
11111
11112static __inline__ vector signed char __ATTRS_o_ai
11113vec_vsro(vector signed char __a, vector unsigned char __b) {
11114 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11115 (vector int)__b);
11116}
11117
11118static __inline__ vector unsigned char __ATTRS_o_ai
11119vec_vsro(vector unsigned char __a, vector signed char __b) {
11120 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11121 (vector int)__b);
11122}
11123
11124static __inline__ vector unsigned char __ATTRS_o_ai
11125vec_vsro(vector unsigned char __a, vector unsigned char __b) {
11126 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11127 (vector int)__b);
11128}
11129
11130static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11131 vector signed char __b) {
11132 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11133}
11134
11135static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11136 vector unsigned char __b) {
11137 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11138}
11139
11140static __inline__ vector unsigned short __ATTRS_o_ai
11141vec_vsro(vector unsigned short __a, vector signed char __b) {
11142 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11143 (vector int)__b);
11144}
11145
11146static __inline__ vector unsigned short __ATTRS_o_ai
11147vec_vsro(vector unsigned short __a, vector unsigned char __b) {
11148 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11149 (vector int)__b);
11150}
11151
11152static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11153 vector signed char __b) {
11154 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11155}
11156
11157static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11158 vector unsigned char __b) {
11159 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11160}
11161
11162static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11163 vector signed char __b) {
11164 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11165}
11166
11167static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11168 vector unsigned char __b) {
11169 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11170}
11171
11172static __inline__ vector unsigned int __ATTRS_o_ai
11173vec_vsro(vector unsigned int __a, vector signed char __b) {
11174 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11175 (vector int)__b);
11176}
11177
11178static __inline__ vector unsigned int __ATTRS_o_ai
11179vec_vsro(vector unsigned int __a, vector unsigned char __b) {
11180 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11181 (vector int)__b);
11182}
11183
11184static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11185 vector signed char __b) {
11186 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11187}
11188
11189static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11190 vector unsigned char __b) {
11191 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11192}
11193
11194/* vec_st */
11195
11196static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11197 vector signed char *__c) {
11198 __builtin_altivec_stvx((vector int)__a, __b, __c);
11199}
11200
11201static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11202 signed char *__c) {
11203 __builtin_altivec_stvx((vector int)__a, __b, __c);
11204}
11205
11206static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11207 vector unsigned char *__c) {
11208 __builtin_altivec_stvx((vector int)__a, __b, __c);
11209}
11210
11211static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11212 unsigned char *__c) {
11213 __builtin_altivec_stvx((vector int)__a, __b, __c);
11214}
11215
11216static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11217 signed char *__c) {
11218 __builtin_altivec_stvx((vector int)__a, __b, __c);
11219}
11220
11221static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11222 unsigned char *__c) {
11223 __builtin_altivec_stvx((vector int)__a, __b, __c);
11224}
11225
11226static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11227 vector bool char *__c) {
11228 __builtin_altivec_stvx((vector int)__a, __b, __c);
11229}
11230
11231static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11232 vector short *__c) {
11233 __builtin_altivec_stvx((vector int)__a, __b, __c);
11234}
11235
11236static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11237 short *__c) {
11238 __builtin_altivec_stvx((vector int)__a, __b, __c);
11239}
11240
11241static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11242 vector unsigned short *__c) {
11243 __builtin_altivec_stvx((vector int)__a, __b, __c);
11244}
11245
11246static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11247 unsigned short *__c) {
11248 __builtin_altivec_stvx((vector int)__a, __b, __c);
11249}
11250
11251static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11252 short *__c) {
11253 __builtin_altivec_stvx((vector int)__a, __b, __c);
11254}
11255
11256static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11257 unsigned short *__c) {
11258 __builtin_altivec_stvx((vector int)__a, __b, __c);
11259}
11260
11261static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11262 vector bool short *__c) {
11263 __builtin_altivec_stvx((vector int)__a, __b, __c);
11264}
11265
11266static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11267 short *__c) {
11268 __builtin_altivec_stvx((vector int)__a, __b, __c);
11269}
11270
11271static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11272 unsigned short *__c) {
11273 __builtin_altivec_stvx((vector int)__a, __b, __c);
11274}
11275
11276static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11277 vector pixel *__c) {
11278 __builtin_altivec_stvx((vector int)__a, __b, __c);
11279}
11280
11281static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b,
11282 vector int *__c) {
11283 __builtin_altivec_stvx(__a, __b, __c);
11284}
11285
11286static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) {
11287 __builtin_altivec_stvx(__a, __b, __c);
11288}
11289
11290static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11291 vector unsigned int *__c) {
11292 __builtin_altivec_stvx((vector int)__a, __b, __c);
11293}
11294
11295static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11296 unsigned int *__c) {
11297 __builtin_altivec_stvx((vector int)__a, __b, __c);
11298}
11299
11300static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11301 int *__c) {
11302 __builtin_altivec_stvx((vector int)__a, __b, __c);
11303}
11304
11305static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11306 unsigned int *__c) {
11307 __builtin_altivec_stvx((vector int)__a, __b, __c);
11308}
11309
11310static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11311 vector bool int *__c) {
11312 __builtin_altivec_stvx((vector int)__a, __b, __c);
11313}
11314
11315static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11316 vector float *__c) {
11317 __builtin_altivec_stvx((vector int)__a, __b, __c);
11318}
11319
11320static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11321 float *__c) {
11322 __builtin_altivec_stvx((vector int)__a, __b, __c);
11323}
11324
11325/* vec_stvx */
11326
11327static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11328 vector signed char *__c) {
11329 __builtin_altivec_stvx((vector int)__a, __b, __c);
11330}
11331
11332static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11333 signed char *__c) {
11334 __builtin_altivec_stvx((vector int)__a, __b, __c);
11335}
11336
11337static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11338 vector unsigned char *__c) {
11339 __builtin_altivec_stvx((vector int)__a, __b, __c);
11340}
11341
11342static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11343 unsigned char *__c) {
11344 __builtin_altivec_stvx((vector int)__a, __b, __c);
11345}
11346
11347static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11348 signed char *__c) {
11349 __builtin_altivec_stvx((vector int)__a, __b, __c);
11350}
11351
11352static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11353 unsigned char *__c) {
11354 __builtin_altivec_stvx((vector int)__a, __b, __c);
11355}
11356
11357static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11358 vector bool char *__c) {
11359 __builtin_altivec_stvx((vector int)__a, __b, __c);
11360}
11361
11362static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11363 vector short *__c) {
11364 __builtin_altivec_stvx((vector int)__a, __b, __c);
11365}
11366
11367static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11368 short *__c) {
11369 __builtin_altivec_stvx((vector int)__a, __b, __c);
11370}
11371
11372static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11373 vector unsigned short *__c) {
11374 __builtin_altivec_stvx((vector int)__a, __b, __c);
11375}
11376
11377static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11378 unsigned short *__c) {
11379 __builtin_altivec_stvx((vector int)__a, __b, __c);
11380}
11381
11382static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11383 short *__c) {
11384 __builtin_altivec_stvx((vector int)__a, __b, __c);
11385}
11386
11387static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11388 unsigned short *__c) {
11389 __builtin_altivec_stvx((vector int)__a, __b, __c);
11390}
11391
11392static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11393 vector bool short *__c) {
11394 __builtin_altivec_stvx((vector int)__a, __b, __c);
11395}
11396
11397static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11398 short *__c) {
11399 __builtin_altivec_stvx((vector int)__a, __b, __c);
11400}
11401
11402static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11403 unsigned short *__c) {
11404 __builtin_altivec_stvx((vector int)__a, __b, __c);
11405}
11406
11407static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11408 vector pixel *__c) {
11409 __builtin_altivec_stvx((vector int)__a, __b, __c);
11410}
11411
11412static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11413 vector int *__c) {
11414 __builtin_altivec_stvx(__a, __b, __c);
11415}
11416
11417static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11418 int *__c) {
11419 __builtin_altivec_stvx(__a, __b, __c);
11420}
11421
11422static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11423 vector unsigned int *__c) {
11424 __builtin_altivec_stvx((vector int)__a, __b, __c);
11425}
11426
11427static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11428 unsigned int *__c) {
11429 __builtin_altivec_stvx((vector int)__a, __b, __c);
11430}
11431
11432static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11433 int *__c) {
11434 __builtin_altivec_stvx((vector int)__a, __b, __c);
11435}
11436
11437static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11438 unsigned int *__c) {
11439 __builtin_altivec_stvx((vector int)__a, __b, __c);
11440}
11441
11442static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11443 vector bool int *__c) {
11444 __builtin_altivec_stvx((vector int)__a, __b, __c);
11445}
11446
11447static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11448 vector float *__c) {
11449 __builtin_altivec_stvx((vector int)__a, __b, __c);
11450}
11451
11452static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11453 float *__c) {
11454 __builtin_altivec_stvx((vector int)__a, __b, __c);
11455}
11456
11457/* vec_ste */
11458
11459static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b,
11460 signed char *__c) {
11461 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11462}
11463
11464static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b,
11465 unsigned char *__c) {
11466 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11467}
11468
11469static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11470 signed char *__c) {
11471 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11472}
11473
11474static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11475 unsigned char *__c) {
11476 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11477}
11478
11479static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b,
11480 short *__c) {
11481 __builtin_altivec_stvehx(__a, __b, __c);
11482}
11483
11484static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b,
11485 unsigned short *__c) {
11486 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11487}
11488
11489static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11490 short *__c) {
11491 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11492}
11493
11494static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11495 unsigned short *__c) {
11496 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11497}
11498
11499static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11500 short *__c) {
11501 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11502}
11503
11504static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11505 unsigned short *__c) {
11506 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11507}
11508
11509static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) {
11510 __builtin_altivec_stvewx(__a, __b, __c);
11511}
11512
11513static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b,
11514 unsigned int *__c) {
11515 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11516}
11517
11518static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11519 int *__c) {
11520 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11521}
11522
11523static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11524 unsigned int *__c) {
11525 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11526}
11527
11528static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b,
11529 float *__c) {
11530 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11531}
11532
11533/* vec_stvebx */
11534
11535static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b,
11536 signed char *__c) {
11537 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11538}
11539
11540static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
11541 long __b, unsigned char *__c) {
11542 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11543}
11544
11545static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11546 signed char *__c) {
11547 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11548}
11549
11550static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11551 unsigned char *__c) {
11552 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11553}
11554
11555/* vec_stvehx */
11556
11557static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b,
11558 short *__c) {
11559 __builtin_altivec_stvehx(__a, __b, __c);
11560}
11561
11562static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
11563 long __b, unsigned short *__c) {
11564 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11565}
11566
11567static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11568 short *__c) {
11569 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11570}
11571
11572static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11573 unsigned short *__c) {
11574 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11575}
11576
11577static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11578 short *__c) {
11579 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11580}
11581
11582static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11583 unsigned short *__c) {
11584 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11585}
11586
11587/* vec_stvewx */
11588
11589static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b,
11590 int *__c) {
11591 __builtin_altivec_stvewx(__a, __b, __c);
11592}
11593
11594static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b,
11595 unsigned int *__c) {
11596 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11597}
11598
11599static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11600 int *__c) {
11601 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11602}
11603
11604static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11605 unsigned int *__c) {
11606 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11607}
11608
11609static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b,
11610 float *__c) {
11611 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11612}
11613
11614/* vec_stl */
11615
11616static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11617 vector signed char *__c) {
11618 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11619}
11620
11621static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11622 signed char *__c) {
11623 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11624}
11625
11626static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11627 vector unsigned char *__c) {
11628 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11629}
11630
11631static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11632 unsigned char *__c) {
11633 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11634}
11635
11636static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11637 signed char *__c) {
11638 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11639}
11640
11641static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11642 unsigned char *__c) {
11643 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11644}
11645
11646static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11647 vector bool char *__c) {
11648 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11649}
11650
11651static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11652 vector short *__c) {
11653 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11654}
11655
11656static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11657 short *__c) {
11658 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11659}
11660
11661static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11662 vector unsigned short *__c) {
11663 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11664}
11665
11666static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11667 unsigned short *__c) {
11668 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11669}
11670
11671static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11672 short *__c) {
11673 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11674}
11675
11676static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11677 unsigned short *__c) {
11678 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11679}
11680
11681static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11682 vector bool short *__c) {
11683 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11684}
11685
11686static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11687 short *__c) {
11688 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11689}
11690
11691static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11692 unsigned short *__c) {
11693 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11694}
11695
11696static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11697 vector pixel *__c) {
11698 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11699}
11700
11701static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
11702 vector int *__c) {
11703 __builtin_altivec_stvxl(__a, __b, __c);
11704}
11705
11706static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
11707 __builtin_altivec_stvxl(__a, __b, __c);
11708}
11709
11710static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11711 vector unsigned int *__c) {
11712 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11713}
11714
11715static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11716 unsigned int *__c) {
11717 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11718}
11719
11720static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11721 int *__c) {
11722 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11723}
11724
11725static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11726 unsigned int *__c) {
11727 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11728}
11729
11730static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11731 vector bool int *__c) {
11732 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11733}
11734
11735static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11736 vector float *__c) {
11737 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11738}
11739
11740static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11741 float *__c) {
11742 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11743}
11744
11745/* vec_stvxl */
11746
11747static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11748 vector signed char *__c) {
11749 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11750}
11751
11752static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11753 signed char *__c) {
11754 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11755}
11756
11757static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11758 vector unsigned char *__c) {
11759 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11760}
11761
11762static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11763 unsigned char *__c) {
11764 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11765}
11766
11767static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11768 signed char *__c) {
11769 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11770}
11771
11772static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11773 unsigned char *__c) {
11774 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11775}
11776
11777static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11778 vector bool char *__c) {
11779 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11780}
11781
11782static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11783 vector short *__c) {
11784 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11785}
11786
11787static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11788 short *__c) {
11789 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11790}
11791
11792static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11793 int __b,
11794 vector unsigned short *__c) {
11795 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11796}
11797
11798static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11799 int __b, unsigned short *__c) {
11800 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11801}
11802
11803static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11804 short *__c) {
11805 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11806}
11807
11808static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11809 unsigned short *__c) {
11810 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11811}
11812
11813static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11814 vector bool short *__c) {
11815 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11816}
11817
11818static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11819 short *__c) {
11820 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11821}
11822
11823static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11824 unsigned short *__c) {
11825 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11826}
11827
11828static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11829 vector pixel *__c) {
11830 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11831}
11832
11833static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11834 vector int *__c) {
11835 __builtin_altivec_stvxl(__a, __b, __c);
11836}
11837
11838static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11839 int *__c) {
11840 __builtin_altivec_stvxl(__a, __b, __c);
11841}
11842
11843static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11844 vector unsigned int *__c) {
11845 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11846}
11847
11848static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11849 unsigned int *__c) {
11850 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11851}
11852
11853static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11854 int *__c) {
11855 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11856}
11857
11858static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11859 unsigned int *__c) {
11860 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11861}
11862
11863static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11864 vector bool int *__c) {
11865 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11866}
11867
11868static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11869 vector float *__c) {
11870 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11871}
11872
11873static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11874 float *__c) {
11875 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11876}
11877
11878/* vec_sub */
11879
11880static __inline__ vector signed char __ATTRS_o_ai
11881vec_sub(vector signed char __a, vector signed char __b) {
11882 return __a - __b;
11883}
11884
11885static __inline__ vector signed char __ATTRS_o_ai
11886vec_sub(vector bool char __a, vector signed char __b) {
11887 return (vector signed char)__a - __b;
11888}
11889
11890static __inline__ vector signed char __ATTRS_o_ai
11891vec_sub(vector signed char __a, vector bool char __b) {
11892 return __a - (vector signed char)__b;
11893}
11894
11895static __inline__ vector unsigned char __ATTRS_o_ai
11896vec_sub(vector unsigned char __a, vector unsigned char __b) {
11897 return __a - __b;
11898}
11899
11900static __inline__ vector unsigned char __ATTRS_o_ai
11901vec_sub(vector bool char __a, vector unsigned char __b) {
11902 return (vector unsigned char)__a - __b;
11903}
11904
11905static __inline__ vector unsigned char __ATTRS_o_ai
11906vec_sub(vector unsigned char __a, vector bool char __b) {
11907 return __a - (vector unsigned char)__b;
11908}
11909
11910static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11911 vector short __b) {
11912 return __a - __b;
11913}
11914
11915static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
11916 vector short __b) {
11917 return (vector short)__a - __b;
11918}
11919
11920static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11921 vector bool short __b) {
11922 return __a - (vector short)__b;
11923}
11924
11925static __inline__ vector unsigned short __ATTRS_o_ai
11926vec_sub(vector unsigned short __a, vector unsigned short __b) {
11927 return __a - __b;
11928}
11929
11930static __inline__ vector unsigned short __ATTRS_o_ai
11931vec_sub(vector bool short __a, vector unsigned short __b) {
11932 return (vector unsigned short)__a - __b;
11933}
11934
11935static __inline__ vector unsigned short __ATTRS_o_ai
11936vec_sub(vector unsigned short __a, vector bool short __b) {
11937 return __a - (vector unsigned short)__b;
11938}
11939
11940static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11941 vector int __b) {
11942 return __a - __b;
11943}
11944
11945static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
11946 vector int __b) {
11947 return (vector int)__a - __b;
11948}
11949
11950static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11951 vector bool int __b) {
11952 return __a - (vector int)__b;
11953}
11954
11955static __inline__ vector unsigned int __ATTRS_o_ai
11956vec_sub(vector unsigned int __a, vector unsigned int __b) {
11957 return __a - __b;
11958}
11959
11960static __inline__ vector unsigned int __ATTRS_o_ai
11961vec_sub(vector bool int __a, vector unsigned int __b) {
11962 return (vector unsigned int)__a - __b;
11963}
11964
11965static __inline__ vector unsigned int __ATTRS_o_ai
11966vec_sub(vector unsigned int __a, vector bool int __b) {
11967 return __a - (vector unsigned int)__b;
11968}
11969
11970#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
11971 defined(__SIZEOF_INT128__)
11972static __inline__ vector signed __int128 __ATTRS_o_ai
11973vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11974 return __a - __b;
11975}
11976
11977static __inline__ vector unsigned __int128 __ATTRS_o_ai
11978vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11979 return __a - __b;
11980}
11981#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) &&
11982 // defined(__SIZEOF_INT128__)
11983
11984#ifdef __VSX__
11985static __inline__ vector signed long long __ATTRS_o_ai
11986vec_sub(vector signed long long __a, vector signed long long __b) {
11987 return __a - __b;
11988}
11989
11990static __inline__ vector unsigned long long __ATTRS_o_ai
11991vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11992 return __a - __b;
11993}
11994
11995static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11996 vector double __b) {
11997 return __a - __b;
11998}
11999#endif
12000
12001static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
12002 vector float __b) {
12003 return __a - __b;
12004}
12005
12006/* vec_vsububm */
12007
12008#define __builtin_altivec_vsububm vec_vsububm
12009
12010static __inline__ vector signed char __ATTRS_o_ai
12011vec_vsububm(vector signed char __a, vector signed char __b) {
12012 return __a - __b;
12013}
12014
12015static __inline__ vector signed char __ATTRS_o_ai
12016vec_vsububm(vector bool char __a, vector signed char __b) {
12017 return (vector signed char)__a - __b;
12018}
12019
12020static __inline__ vector signed char __ATTRS_o_ai
12021vec_vsububm(vector signed char __a, vector bool char __b) {
12022 return __a - (vector signed char)__b;
12023}
12024
12025static __inline__ vector unsigned char __ATTRS_o_ai
12026vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
12027 return __a - __b;
12028}
12029
12030static __inline__ vector unsigned char __ATTRS_o_ai
12031vec_vsububm(vector bool char __a, vector unsigned char __b) {
12032 return (vector unsigned char)__a - __b;
12033}
12034
12035static __inline__ vector unsigned char __ATTRS_o_ai
12036vec_vsububm(vector unsigned char __a, vector bool char __b) {
12037 return __a - (vector unsigned char)__b;
12038}
12039
12040/* vec_vsubuhm */
12041
12042#define __builtin_altivec_vsubuhm vec_vsubuhm
12043
12044static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12045 vector short __b) {
12046 return __a - __b;
12047}
12048
12049static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
12050 vector short __b) {
12051 return (vector short)__a - __b;
12052}
12053
12054static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12055 vector bool short __b) {
12056 return __a - (vector short)__b;
12057}
12058
12059static __inline__ vector unsigned short __ATTRS_o_ai
12060vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
12061 return __a - __b;
12062}
12063
12064static __inline__ vector unsigned short __ATTRS_o_ai
12065vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
12066 return (vector unsigned short)__a - __b;
12067}
12068
12069static __inline__ vector unsigned short __ATTRS_o_ai
12070vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
12071 return __a - (vector unsigned short)__b;
12072}
12073
12074/* vec_vsubuwm */
12075
12076#define __builtin_altivec_vsubuwm vec_vsubuwm
12077
12078static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12079 vector int __b) {
12080 return __a - __b;
12081}
12082
12083static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
12084 vector int __b) {
12085 return (vector int)__a - __b;
12086}
12087
12088static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12089 vector bool int __b) {
12090 return __a - (vector int)__b;
12091}
12092
12093static __inline__ vector unsigned int __ATTRS_o_ai
12094vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
12095 return __a - __b;
12096}
12097
12098static __inline__ vector unsigned int __ATTRS_o_ai
12099vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
12100 return (vector unsigned int)__a - __b;
12101}
12102
12103static __inline__ vector unsigned int __ATTRS_o_ai
12104vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
12105 return __a - (vector unsigned int)__b;
12106}
12107
12108/* vec_vsubfp */
12109
12110#define __builtin_altivec_vsubfp vec_vsubfp
12111
12112static __inline__ vector float __attribute__((__always_inline__))
12113vec_vsubfp(vector float __a, vector float __b) {
12114 return __a - __b;
12115}
12116
12117/* vec_subc */
12118
12119static __inline__ vector signed int __ATTRS_o_ai
12120vec_subc(vector signed int __a, vector signed int __b) {
12121 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
12122 (vector unsigned int) __b);
12123}
12124
12125static __inline__ vector unsigned int __ATTRS_o_ai
12126vec_subc(vector unsigned int __a, vector unsigned int __b) {
12127 return __builtin_altivec_vsubcuw(__a, __b);
12128}
12129
12130#ifdef __POWER8_VECTOR__
12131#ifdef __SIZEOF_INT128__
12132static __inline__ vector unsigned __int128 __ATTRS_o_ai
12133vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12134 return __builtin_altivec_vsubcuq(__a, __b);
12135}
12136
12137static __inline__ vector signed __int128 __ATTRS_o_ai
12138vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
12139 return (vector signed __int128)__builtin_altivec_vsubcuq(
12140 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12141}
12142#endif
12143
12144static __inline__ vector unsigned char __attribute__((__always_inline__))
12145vec_subc_u128(vector unsigned char __a, vector unsigned char __b) {
12146 return (vector unsigned char)__builtin_altivec_vsubcuq_c(
12147 (vector unsigned char)__a, (vector unsigned char)__b);
12148}
12149#endif // __POWER8_VECTOR__
12150
12151/* vec_vsubcuw */
12152
12153static __inline__ vector unsigned int __attribute__((__always_inline__))
12154vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
12155 return __builtin_altivec_vsubcuw(__a, __b);
12156}
12157
12158/* vec_subs */
12159
12160static __inline__ vector signed char __ATTRS_o_ai
12161vec_subs(vector signed char __a, vector signed char __b) {
12162 return __builtin_altivec_vsubsbs(__a, __b);
12163}
12164
12165static __inline__ vector signed char __ATTRS_o_ai
12166vec_subs(vector bool char __a, vector signed char __b) {
12167 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12168}
12169
12170static __inline__ vector signed char __ATTRS_o_ai
12171vec_subs(vector signed char __a, vector bool char __b) {
12172 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12173}
12174
12175static __inline__ vector unsigned char __ATTRS_o_ai
12176vec_subs(vector unsigned char __a, vector unsigned char __b) {
12177 return __builtin_altivec_vsububs(__a, __b);
12178}
12179
12180static __inline__ vector unsigned char __ATTRS_o_ai
12181vec_subs(vector bool char __a, vector unsigned char __b) {
12182 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12183}
12184
12185static __inline__ vector unsigned char __ATTRS_o_ai
12186vec_subs(vector unsigned char __a, vector bool char __b) {
12187 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12188}
12189
12190static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12191 vector short __b) {
12192 return __builtin_altivec_vsubshs(__a, __b);
12193}
12194
12195static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
12196 vector short __b) {
12197 return __builtin_altivec_vsubshs((vector short)__a, __b);
12198}
12199
12200static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12201 vector bool short __b) {
12202 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12203}
12204
12205static __inline__ vector unsigned short __ATTRS_o_ai
12206vec_subs(vector unsigned short __a, vector unsigned short __b) {
12207 return __builtin_altivec_vsubuhs(__a, __b);
12208}
12209
12210static __inline__ vector unsigned short __ATTRS_o_ai
12211vec_subs(vector bool short __a, vector unsigned short __b) {
12212 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12213}
12214
12215static __inline__ vector unsigned short __ATTRS_o_ai
12216vec_subs(vector unsigned short __a, vector bool short __b) {
12217 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12218}
12219
12220static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12221 vector int __b) {
12222 return __builtin_altivec_vsubsws(__a, __b);
12223}
12224
12225static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
12226 vector int __b) {
12227 return __builtin_altivec_vsubsws((vector int)__a, __b);
12228}
12229
12230static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12231 vector bool int __b) {
12232 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12233}
12234
12235static __inline__ vector unsigned int __ATTRS_o_ai
12236vec_subs(vector unsigned int __a, vector unsigned int __b) {
12237 return __builtin_altivec_vsubuws(__a, __b);
12238}
12239
12240static __inline__ vector unsigned int __ATTRS_o_ai
12241vec_subs(vector bool int __a, vector unsigned int __b) {
12242 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12243}
12244
12245static __inline__ vector unsigned int __ATTRS_o_ai
12246vec_subs(vector unsigned int __a, vector bool int __b) {
12247 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12248}
12249
12250/* vec_vsubsbs */
12251
12252static __inline__ vector signed char __ATTRS_o_ai
12253vec_vsubsbs(vector signed char __a, vector signed char __b) {
12254 return __builtin_altivec_vsubsbs(__a, __b);
12255}
12256
12257static __inline__ vector signed char __ATTRS_o_ai
12258vec_vsubsbs(vector bool char __a, vector signed char __b) {
12259 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12260}
12261
12262static __inline__ vector signed char __ATTRS_o_ai
12263vec_vsubsbs(vector signed char __a, vector bool char __b) {
12264 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12265}
12266
12267/* vec_vsububs */
12268
12269static __inline__ vector unsigned char __ATTRS_o_ai
12270vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
12271 return __builtin_altivec_vsububs(__a, __b);
12272}
12273
12274static __inline__ vector unsigned char __ATTRS_o_ai
12275vec_vsububs(vector bool char __a, vector unsigned char __b) {
12276 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12277}
12278
12279static __inline__ vector unsigned char __ATTRS_o_ai
12280vec_vsububs(vector unsigned char __a, vector bool char __b) {
12281 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12282}
12283
12284/* vec_vsubshs */
12285
12286static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12287 vector short __b) {
12288 return __builtin_altivec_vsubshs(__a, __b);
12289}
12290
12291static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
12292 vector short __b) {
12293 return __builtin_altivec_vsubshs((vector short)__a, __b);
12294}
12295
12296static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12297 vector bool short __b) {
12298 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12299}
12300
12301/* vec_vsubuhs */
12302
12303static __inline__ vector unsigned short __ATTRS_o_ai
12304vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
12305 return __builtin_altivec_vsubuhs(__a, __b);
12306}
12307
12308static __inline__ vector unsigned short __ATTRS_o_ai
12309vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
12310 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12311}
12312
12313static __inline__ vector unsigned short __ATTRS_o_ai
12314vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
12315 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12316}
12317
12318/* vec_vsubsws */
12319
12320static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12321 vector int __b) {
12322 return __builtin_altivec_vsubsws(__a, __b);
12323}
12324
12325static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
12326 vector int __b) {
12327 return __builtin_altivec_vsubsws((vector int)__a, __b);
12328}
12329
12330static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12331 vector bool int __b) {
12332 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12333}
12334
12335/* vec_vsubuws */
12336
12337static __inline__ vector unsigned int __ATTRS_o_ai
12338vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
12339 return __builtin_altivec_vsubuws(__a, __b);
12340}
12341
12342static __inline__ vector unsigned int __ATTRS_o_ai
12343vec_vsubuws(vector bool int __a, vector unsigned int __b) {
12344 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12345}
12346
12347static __inline__ vector unsigned int __ATTRS_o_ai
12348vec_vsubuws(vector unsigned int __a, vector bool int __b) {
12349 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12350}
12351
12352#ifdef __POWER8_VECTOR__
12353/* vec_vsubuqm */
12354
12355#ifdef __SIZEOF_INT128__
12356static __inline__ vector signed __int128 __ATTRS_o_ai
12357vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
12358 return __a - __b;
12359}
12360
12361static __inline__ vector unsigned __int128 __ATTRS_o_ai
12362vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12363 return __a - __b;
12364}
12365#endif
12366
12367static __inline__ vector unsigned char __attribute__((__always_inline__))
12368vec_sub_u128(vector unsigned char __a, vector unsigned char __b) {
12369 return (vector unsigned char)__builtin_altivec_vsubuqm(__a, __b);
12370}
12371
12372/* vec_vsubeuqm */
12373
12374#ifdef __SIZEOF_INT128__
12375static __inline__ vector signed __int128 __ATTRS_o_ai
12376vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
12377 vector signed __int128 __c) {
12378 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12379 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12380 (vector unsigned __int128)__c);
12381}
12382
12383static __inline__ vector unsigned __int128 __ATTRS_o_ai
12384vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
12385 vector unsigned __int128 __c) {
12386 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12387}
12388
12389static __inline__ vector signed __int128 __ATTRS_o_ai
12390vec_sube(vector signed __int128 __a, vector signed __int128 __b,
12391 vector signed __int128 __c) {
12392 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12393 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12394 (vector unsigned __int128)__c);
12395}
12396
12397static __inline__ vector unsigned __int128 __ATTRS_o_ai
12398vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
12399 vector unsigned __int128 __c) {
12400 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12401}
12402#endif
12403
12404static __inline__ vector unsigned char __attribute__((__always_inline__))
12405vec_sube_u128(vector unsigned char __a, vector unsigned char __b,
12406 vector unsigned char __c) {
12407 return (vector unsigned char)__builtin_altivec_vsubeuqm_c(
12408 (vector unsigned char)__a, (vector unsigned char)__b,
12409 (vector unsigned char)__c);
12410}
12411
12412/* vec_vsubcuq */
12413
12414#ifdef __SIZEOF_INT128__
12415static __inline__ vector signed __int128 __ATTRS_o_ai
12416vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
12417 return (vector signed __int128)__builtin_altivec_vsubcuq(
12418 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12419}
12420
12421static __inline__ vector unsigned __int128 __ATTRS_o_ai
12422vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12423 return __builtin_altivec_vsubcuq(__a, __b);
12424}
12425
12426/* vec_vsubecuq */
12427
12428static __inline__ vector signed __int128 __ATTRS_o_ai
12429vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
12430 vector signed __int128 __c) {
12431 return (vector signed __int128)__builtin_altivec_vsubecuq(
12432 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12433 (vector unsigned __int128)__c);
12434}
12435
12436static __inline__ vector unsigned __int128 __ATTRS_o_ai
12437vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
12438 vector unsigned __int128 __c) {
12439 return __builtin_altivec_vsubecuq(__a, __b, __c);
12440}
12441#endif
12442
12443#ifdef __powerpc64__
12444static __inline__ vector signed int __ATTRS_o_ai
12445vec_subec(vector signed int __a, vector signed int __b,
12446 vector signed int __c) {
12447 return vec_addec(__a, ~__b, __c);
12448}
12449
12450static __inline__ vector unsigned int __ATTRS_o_ai
12451vec_subec(vector unsigned int __a, vector unsigned int __b,
12452 vector unsigned int __c) {
12453 return vec_addec(__a, ~__b, __c);
12454}
12455#endif
12456
12457#ifdef __SIZEOF_INT128__
12458static __inline__ vector signed __int128 __ATTRS_o_ai
12459vec_subec(vector signed __int128 __a, vector signed __int128 __b,
12460 vector signed __int128 __c) {
12461 return (vector signed __int128)__builtin_altivec_vsubecuq(
12462 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12463 (vector unsigned __int128)__c);
12464}
12465
12466static __inline__ vector unsigned __int128 __ATTRS_o_ai
12467vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
12468 vector unsigned __int128 __c) {
12469 return __builtin_altivec_vsubecuq(__a, __b, __c);
12470}
12471#endif
12472
12473static __inline__ vector unsigned char __attribute__((__always_inline__))
12474vec_subec_u128(vector unsigned char __a, vector unsigned char __b,
12475 vector unsigned char __c) {
12476 return (vector unsigned char)__builtin_altivec_vsubecuq_c(
12477 (vector unsigned char)__a, (vector unsigned char)__b,
12478 (vector unsigned char)__c);
12479}
12480#endif // __POWER8_VECTOR__
12481
12482static __inline__ vector signed int __ATTRS_o_ai
12483vec_sube(vector signed int __a, vector signed int __b,
12484 vector signed int __c) {
12485 vector signed int __mask = {1, 1, 1, 1};
12486 vector signed int __carry = __c & __mask;
12487 return vec_adde(__a, ~__b, __carry);
12488}
12489
12490static __inline__ vector unsigned int __ATTRS_o_ai
12491vec_sube(vector unsigned int __a, vector unsigned int __b,
12492 vector unsigned int __c) {
12493 vector unsigned int __mask = {1, 1, 1, 1};
12494 vector unsigned int __carry = __c & __mask;
12495 return vec_adde(__a, ~__b, __carry);
12496}
12497/* vec_sum4s */
12498
12499static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
12500 vector int __b) {
12501 return __builtin_altivec_vsum4sbs(__a, __b);
12502}
12503
12504static __inline__ vector unsigned int __ATTRS_o_ai
12505vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
12506 return __builtin_altivec_vsum4ubs(__a, __b);
12507}
12508
12509static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
12510 vector int __b) {
12511 return __builtin_altivec_vsum4shs(__a, __b);
12512}
12513
12514/* vec_vsum4sbs */
12515
12516static __inline__ vector int __attribute__((__always_inline__))
12517vec_vsum4sbs(vector signed char __a, vector int __b) {
12518 return __builtin_altivec_vsum4sbs(__a, __b);
12519}
12520
12521/* vec_vsum4ubs */
12522
12523static __inline__ vector unsigned int __attribute__((__always_inline__))
12524vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
12525 return __builtin_altivec_vsum4ubs(__a, __b);
12526}
12527
12528/* vec_vsum4shs */
12529
12530static __inline__ vector int __attribute__((__always_inline__))
12531vec_vsum4shs(vector signed short __a, vector int __b) {
12532 return __builtin_altivec_vsum4shs(__a, __b);
12533}
12534
12535/* vec_sum2s */
12536
12537/* The vsum2sws instruction has a big-endian bias, so that the second
12538 input vector and the result always reference big-endian elements
12539 1 and 3 (little-endian element 0 and 2). For ease of porting the
12540 programmer wants elements 1 and 3 in both cases, so for little
12541 endian we must perform some permutes. */
12542
12543static __inline__ vector signed int __attribute__((__always_inline__))
12544vec_sum2s(vector int __a, vector int __b) {
12545#ifdef __LITTLE_ENDIAN__
12546 vector int __c = (vector signed int)vec_perm(
12547 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12548 8, 9, 10, 11));
12549 __c = __builtin_altivec_vsum2sws(__a, __c);
12550 return (vector signed int)vec_perm(
12551 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12552 8, 9, 10, 11));
12553#else
12554 return __builtin_altivec_vsum2sws(__a, __b);
12555#endif
12556}
12557
12558/* vec_vsum2sws */
12559
12560static __inline__ vector signed int __attribute__((__always_inline__))
12561vec_vsum2sws(vector int __a, vector int __b) {
12562#ifdef __LITTLE_ENDIAN__
12563 vector int __c = (vector signed int)vec_perm(
12564 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12565 8, 9, 10, 11));
12566 __c = __builtin_altivec_vsum2sws(__a, __c);
12567 return (vector signed int)vec_perm(
12568 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12569 8, 9, 10, 11));
12570#else
12571 return __builtin_altivec_vsum2sws(__a, __b);
12572#endif
12573}
12574
12575/* vec_sums */
12576
12577/* The vsumsws instruction has a big-endian bias, so that the second
12578 input vector and the result always reference big-endian element 3
12579 (little-endian element 0). For ease of porting the programmer
12580 wants element 3 in both cases, so for little endian we must perform
12581 some permutes. */
12582
12583static __inline__ vector signed int __attribute__((__always_inline__))
12584vec_sums(vector signed int __a, vector signed int __b) {
12585#ifdef __LITTLE_ENDIAN__
12586 __b = (vector signed int)vec_splat(__b, 3);
12587 __b = __builtin_altivec_vsumsws(__a, __b);
12588 return (vector signed int)(0, 0, 0, __b[0]);
12589#else
12590 return __builtin_altivec_vsumsws(__a, __b);
12591#endif
12592}
12593
12594/* vec_vsumsws */
12595
12596static __inline__ vector signed int __attribute__((__always_inline__))
12597vec_vsumsws(vector signed int __a, vector signed int __b) {
12598#ifdef __LITTLE_ENDIAN__
12599 __b = (vector signed int)vec_splat(__b, 3);
12600 __b = __builtin_altivec_vsumsws(__a, __b);
12601 return (vector signed int)(0, 0, 0, __b[0]);
12602#else
12603 return __builtin_altivec_vsumsws(__a, __b);
12604#endif
12605}
12606
12607/* vec_trunc */
12608
12609static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
12610#ifdef __VSX__
12611 return __builtin_vsx_xvrspiz(__a);
12612#else
12613 return __builtin_altivec_vrfiz(__a);
12614#endif
12615}
12616
12617#ifdef __VSX__
12618static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
12619 return __builtin_vsx_xvrdpiz(__a);
12620}
12621#endif
12622
12623/* vec_roundz */
12624static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) {
12625 return vec_trunc(__a);
12626}
12627
12628#ifdef __VSX__
12629static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) {
12630 return vec_trunc(__a);
12631}
12632#endif
12633
12634/* vec_vrfiz */
12635
12636static __inline__ vector float __attribute__((__always_inline__))
12637vec_vrfiz(vector float __a) {
12638 return __builtin_altivec_vrfiz(__a);
12639}
12640
12641/* vec_unpackh */
12642
12643/* The vector unpack instructions all have a big-endian bias, so for
12644 little endian we must reverse the meanings of "high" and "low." */
12645#ifdef __LITTLE_ENDIAN__
12646#define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12647#define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12648#else
12649#define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12650#define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12651#endif
12652
12653static __inline__ vector short __ATTRS_o_ai
12654vec_unpackh(vector signed char __a) {
12655#ifdef __LITTLE_ENDIAN__
12656 return __builtin_altivec_vupklsb((vector char)__a);
12657#else
12658 return __builtin_altivec_vupkhsb((vector char)__a);
12659#endif
12660}
12661
12662static __inline__ vector bool short __ATTRS_o_ai
12663vec_unpackh(vector bool char __a) {
12664#ifdef __LITTLE_ENDIAN__
12665 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12666#else
12667 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12668#endif
12669}
12670
12671static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
12672#ifdef __LITTLE_ENDIAN__
12673 return __builtin_altivec_vupklsh(__a);
12674#else
12675 return __builtin_altivec_vupkhsh(__a);
12676#endif
12677}
12678
12679static __inline__ vector bool int __ATTRS_o_ai
12680vec_unpackh(vector bool short __a) {
12681#ifdef __LITTLE_ENDIAN__
12682 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12683#else
12684 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12685#endif
12686}
12687
12688static __inline__ vector unsigned int __ATTRS_o_ai
12689vec_unpackh(vector pixel __a) {
12690#ifdef __LITTLE_ENDIAN__
12691 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12692#else
12693 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12694#endif
12695}
12696
12697#ifdef __POWER8_VECTOR__
12698static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
12699#ifdef __LITTLE_ENDIAN__
12700 return __builtin_altivec_vupklsw(__a);
12701#else
12702 return __builtin_altivec_vupkhsw(__a);
12703#endif
12704}
12705
12706static __inline__ vector bool long long __ATTRS_o_ai
12707vec_unpackh(vector bool int __a) {
12708#ifdef __LITTLE_ENDIAN__
12709 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12710#else
12711 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12712#endif
12713}
12714
12715static __inline__ vector double __ATTRS_o_ai
12716vec_unpackh(vector float __a) {
12717 return (vector double)(__a[0], __a[1]);
12718}
12719#endif
12720
12721/* vec_vupkhsb */
12722
12723static __inline__ vector short __ATTRS_o_ai
12724vec_vupkhsb(vector signed char __a) {
12725#ifdef __LITTLE_ENDIAN__
12726 return __builtin_altivec_vupklsb((vector char)__a);
12727#else
12728 return __builtin_altivec_vupkhsb((vector char)__a);
12729#endif
12730}
12731
12732static __inline__ vector bool short __ATTRS_o_ai
12733vec_vupkhsb(vector bool char __a) {
12734#ifdef __LITTLE_ENDIAN__
12735 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12736#else
12737 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12738#endif
12739}
12740
12741/* vec_vupkhsh */
12742
12743static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
12744#ifdef __LITTLE_ENDIAN__
12745 return __builtin_altivec_vupklsh(__a);
12746#else
12747 return __builtin_altivec_vupkhsh(__a);
12748#endif
12749}
12750
12751static __inline__ vector bool int __ATTRS_o_ai
12752vec_vupkhsh(vector bool short __a) {
12753#ifdef __LITTLE_ENDIAN__
12754 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12755#else
12756 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12757#endif
12758}
12759
12760static __inline__ vector unsigned int __ATTRS_o_ai
12761vec_vupkhsh(vector pixel __a) {
12762#ifdef __LITTLE_ENDIAN__
12763 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12764#else
12765 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12766#endif
12767}
12768
12769/* vec_vupkhsw */
12770
12771#ifdef __POWER8_VECTOR__
12772static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
12773#ifdef __LITTLE_ENDIAN__
12774 return __builtin_altivec_vupklsw(__a);
12775#else
12776 return __builtin_altivec_vupkhsw(__a);
12777#endif
12778}
12779
12780static __inline__ vector bool long long __ATTRS_o_ai
12781vec_vupkhsw(vector bool int __a) {
12782#ifdef __LITTLE_ENDIAN__
12783 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12784#else
12785 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12786#endif
12787}
12788#endif
12789
12790/* vec_unpackl */
12791
12792static __inline__ vector short __ATTRS_o_ai
12793vec_unpackl(vector signed char __a) {
12794#ifdef __LITTLE_ENDIAN__
12795 return __builtin_altivec_vupkhsb((vector char)__a);
12796#else
12797 return __builtin_altivec_vupklsb((vector char)__a);
12798#endif
12799}
12800
12801static __inline__ vector bool short __ATTRS_o_ai
12802vec_unpackl(vector bool char __a) {
12803#ifdef __LITTLE_ENDIAN__
12804 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12805#else
12806 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12807#endif
12808}
12809
12810static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
12811#ifdef __LITTLE_ENDIAN__
12812 return __builtin_altivec_vupkhsh(__a);
12813#else
12814 return __builtin_altivec_vupklsh(__a);
12815#endif
12816}
12817
12818static __inline__ vector bool int __ATTRS_o_ai
12819vec_unpackl(vector bool short __a) {
12820#ifdef __LITTLE_ENDIAN__
12821 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12822#else
12823 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12824#endif
12825}
12826
12827static __inline__ vector unsigned int __ATTRS_o_ai
12828vec_unpackl(vector pixel __a) {
12829#ifdef __LITTLE_ENDIAN__
12830 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12831#else
12832 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12833#endif
12834}
12835
12836#ifdef __POWER8_VECTOR__
12837static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
12838#ifdef __LITTLE_ENDIAN__
12839 return __builtin_altivec_vupkhsw(__a);
12840#else
12841 return __builtin_altivec_vupklsw(__a);
12842#endif
12843}
12844
12845static __inline__ vector bool long long __ATTRS_o_ai
12846vec_unpackl(vector bool int __a) {
12847#ifdef __LITTLE_ENDIAN__
12848 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12849#else
12850 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12851#endif
12852}
12853
12854static __inline__ vector double __ATTRS_o_ai
12855vec_unpackl(vector float __a) {
12856 return (vector double)(__a[2], __a[3]);
12857}
12858#endif
12859
12860/* vec_vupklsb */
12861
12862static __inline__ vector short __ATTRS_o_ai
12863vec_vupklsb(vector signed char __a) {
12864#ifdef __LITTLE_ENDIAN__
12865 return __builtin_altivec_vupkhsb((vector char)__a);
12866#else
12867 return __builtin_altivec_vupklsb((vector char)__a);
12868#endif
12869}
12870
12871static __inline__ vector bool short __ATTRS_o_ai
12872vec_vupklsb(vector bool char __a) {
12873#ifdef __LITTLE_ENDIAN__
12874 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12875#else
12876 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12877#endif
12878}
12879
12880/* vec_vupklsh */
12881
12882static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
12883#ifdef __LITTLE_ENDIAN__
12884 return __builtin_altivec_vupkhsh(__a);
12885#else
12886 return __builtin_altivec_vupklsh(__a);
12887#endif
12888}
12889
12890static __inline__ vector bool int __ATTRS_o_ai
12891vec_vupklsh(vector bool short __a) {
12892#ifdef __LITTLE_ENDIAN__
12893 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12894#else
12895 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12896#endif
12897}
12898
12899static __inline__ vector unsigned int __ATTRS_o_ai
12900vec_vupklsh(vector pixel __a) {
12901#ifdef __LITTLE_ENDIAN__
12902 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12903#else
12904 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12905#endif
12906}
12907
12908/* vec_vupklsw */
12909
12910#ifdef __POWER8_VECTOR__
12911static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
12912#ifdef __LITTLE_ENDIAN__
12913 return __builtin_altivec_vupkhsw(__a);
12914#else
12915 return __builtin_altivec_vupklsw(__a);
12916#endif
12917}
12918
12919static __inline__ vector bool long long __ATTRS_o_ai
12920vec_vupklsw(vector bool int __a) {
12921#ifdef __LITTLE_ENDIAN__
12922 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12923#else
12924 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12925#endif
12926}
12927#endif
12928
12929/* vec_vsx_ld */
12930
12931#ifdef __VSX__
12932
12933static __inline__ vector bool int __ATTRS_o_ai
12934vec_vsx_ld(int __a, const vector bool int *__b) {
12935 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
12936}
12937
12938static __inline__ vector signed int __ATTRS_o_ai
12939vec_vsx_ld(int __a, const vector signed int *__b) {
12940 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12941}
12942
12943static __inline__ vector signed int __ATTRS_o_ai
12944vec_vsx_ld(int __a, const signed int *__b) {
12945 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12946}
12947
12948static __inline__ vector unsigned int __ATTRS_o_ai
12949vec_vsx_ld(int __a, const vector unsigned int *__b) {
12950 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12951}
12952
12953static __inline__ vector unsigned int __ATTRS_o_ai
12954vec_vsx_ld(int __a, const unsigned int *__b) {
12955 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12956}
12957
12958static __inline__ vector float __ATTRS_o_ai
12959vec_vsx_ld(int __a, const vector float *__b) {
12960 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12961}
12962
12963static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
12964 const float *__b) {
12965 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12966}
12967
12968static __inline__ vector signed long long __ATTRS_o_ai
12969vec_vsx_ld(int __a, const vector signed long long *__b) {
12970 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
12971}
12972
12973static __inline__ vector unsigned long long __ATTRS_o_ai
12974vec_vsx_ld(int __a, const vector unsigned long long *__b) {
12975 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
12976}
12977
12978static __inline__ vector double __ATTRS_o_ai
12979vec_vsx_ld(int __a, const vector double *__b) {
12980 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12981}
12982
12983static __inline__ vector double __ATTRS_o_ai
12984vec_vsx_ld(int __a, const double *__b) {
12985 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12986}
12987
12988static __inline__ vector bool short __ATTRS_o_ai
12989vec_vsx_ld(int __a, const vector bool short *__b) {
12990 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
12991}
12992
12993static __inline__ vector signed short __ATTRS_o_ai
12994vec_vsx_ld(int __a, const vector signed short *__b) {
12995 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12996}
12997
12998static __inline__ vector signed short __ATTRS_o_ai
12999vec_vsx_ld(int __a, const signed short *__b) {
13000 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
13001}
13002
13003static __inline__ vector unsigned short __ATTRS_o_ai
13004vec_vsx_ld(int __a, const vector unsigned short *__b) {
13005 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
13006}
13007
13008static __inline__ vector unsigned short __ATTRS_o_ai
13009vec_vsx_ld(int __a, const unsigned short *__b) {
13010 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
13011}
13012
13013static __inline__ vector bool char __ATTRS_o_ai
13014vec_vsx_ld(int __a, const vector bool char *__b) {
13015 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
13016}
13017
13018static __inline__ vector signed char __ATTRS_o_ai
13019vec_vsx_ld(int __a, const vector signed char *__b) {
13020 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13021}
13022
13023static __inline__ vector signed char __ATTRS_o_ai
13024vec_vsx_ld(int __a, const signed char *__b) {
13025 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13026}
13027
13028static __inline__ vector unsigned char __ATTRS_o_ai
13029vec_vsx_ld(int __a, const vector unsigned char *__b) {
13030 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13031}
13032
13033static __inline__ vector unsigned char __ATTRS_o_ai
13034vec_vsx_ld(int __a, const unsigned char *__b) {
13035 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13036}
13037
13038#endif
13039
13040/* vec_vsx_st */
13041
13042#ifdef __VSX__
13043
13044static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13045 vector bool int *__c) {
13046 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13047}
13048
13049static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13050 signed int *__c) {
13051 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13052}
13053
13054static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13055 unsigned int *__c) {
13056 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13057}
13058
13059static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13060 vector signed int *__c) {
13061 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13062}
13063
13064static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13065 signed int *__c) {
13066 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13067}
13068
13069static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13070 vector unsigned int *__c) {
13071 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13072}
13073
13074static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13075 unsigned int *__c) {
13076 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13077}
13078
13079static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13080 vector float *__c) {
13081 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13082}
13083
13084static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13085 float *__c) {
13086 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13087}
13088
13089static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
13090 int __b,
13091 vector signed long long *__c) {
13092 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13093}
13094
13095static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
13096 int __b,
13097 vector unsigned long long *__c) {
13098 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13099}
13100
13101static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13102 vector double *__c) {
13103 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13104}
13105
13106static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13107 double *__c) {
13108 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13109}
13110
13111static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13112 vector bool short *__c) {
13113 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13114}
13115
13116static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13117 signed short *__c) {
13118 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13119}
13120
13121static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13122 unsigned short *__c) {
13123 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13124}
13125static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13126 vector signed short *__c) {
13127 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13128}
13129
13130static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13131 signed short *__c) {
13132 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13133}
13134
13135static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13136 int __b,
13137 vector unsigned short *__c) {
13138 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13139}
13140
13141static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13142 int __b, unsigned short *__c) {
13143 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13144}
13145
13146static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13147 vector bool char *__c) {
13148 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13149}
13150
13151static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13152 signed char *__c) {
13153 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13154}
13155
13156static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13157 unsigned char *__c) {
13158 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13159}
13160
13161static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13162 vector signed char *__c) {
13163 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13164}
13165
13166static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13167 signed char *__c) {
13168 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13169}
13170
13171static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13172 int __b,
13173 vector unsigned char *__c) {
13174 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13175}
13176
13177static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13178 int __b, unsigned char *__c) {
13179 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13180}
13181
13182#endif
13183
13184#ifdef __VSX__
13185#define vec_xxpermdi __builtin_vsx_xxpermdi
13186#define vec_xxsldwi __builtin_vsx_xxsldwi
13187#define vec_permi(__a, __b, __c) \
13188 _Generic((__a), vector signed long long \
13189 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13190 (((__c)&0x1) + 2)), \
13191 vector unsigned long long \
13192 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13193 (((__c)&0x1) + 2)), \
13194 vector double \
13195 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13196 (((__c)&0x1) + 2)))
13197#endif
13198
13199/* vec_xor */
13200
13201#define __builtin_altivec_vxor vec_xor
13202
13203static __inline__ vector signed char __ATTRS_o_ai
13204vec_xor(vector signed char __a, vector signed char __b) {
13205 return __a ^ __b;
13206}
13207
13208static __inline__ vector signed char __ATTRS_o_ai
13209vec_xor(vector bool char __a, vector signed char __b) {
13210 return (vector signed char)__a ^ __b;
13211}
13212
13213static __inline__ vector signed char __ATTRS_o_ai
13214vec_xor(vector signed char __a, vector bool char __b) {
13215 return __a ^ (vector signed char)__b;
13216}
13217
13218static __inline__ vector unsigned char __ATTRS_o_ai
13219vec_xor(vector unsigned char __a, vector unsigned char __b) {
13220 return __a ^ __b;
13221}
13222
13223static __inline__ vector unsigned char __ATTRS_o_ai
13224vec_xor(vector bool char __a, vector unsigned char __b) {
13225 return (vector unsigned char)__a ^ __b;
13226}
13227
13228static __inline__ vector unsigned char __ATTRS_o_ai
13229vec_xor(vector unsigned char __a, vector bool char __b) {
13230 return __a ^ (vector unsigned char)__b;
13231}
13232
13233static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
13234 vector bool char __b) {
13235 return __a ^ __b;
13236}
13237
13238static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13239 vector short __b) {
13240 return __a ^ __b;
13241}
13242
13243static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
13244 vector short __b) {
13245 return (vector short)__a ^ __b;
13246}
13247
13248static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13249 vector bool short __b) {
13250 return __a ^ (vector short)__b;
13251}
13252
13253static __inline__ vector unsigned short __ATTRS_o_ai
13254vec_xor(vector unsigned short __a, vector unsigned short __b) {
13255 return __a ^ __b;
13256}
13257
13258static __inline__ vector unsigned short __ATTRS_o_ai
13259vec_xor(vector bool short __a, vector unsigned short __b) {
13260 return (vector unsigned short)__a ^ __b;
13261}
13262
13263static __inline__ vector unsigned short __ATTRS_o_ai
13264vec_xor(vector unsigned short __a, vector bool short __b) {
13265 return __a ^ (vector unsigned short)__b;
13266}
13267
13268static __inline__ vector bool short __ATTRS_o_ai
13269vec_xor(vector bool short __a, vector bool short __b) {
13270 return __a ^ __b;
13271}
13272
13273static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13274 vector int __b) {
13275 return __a ^ __b;
13276}
13277
13278static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
13279 vector int __b) {
13280 return (vector int)__a ^ __b;
13281}
13282
13283static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13284 vector bool int __b) {
13285 return __a ^ (vector int)__b;
13286}
13287
13288static __inline__ vector unsigned int __ATTRS_o_ai
13289vec_xor(vector unsigned int __a, vector unsigned int __b) {
13290 return __a ^ __b;
13291}
13292
13293static __inline__ vector unsigned int __ATTRS_o_ai
13294vec_xor(vector bool int __a, vector unsigned int __b) {
13295 return (vector unsigned int)__a ^ __b;
13296}
13297
13298static __inline__ vector unsigned int __ATTRS_o_ai
13299vec_xor(vector unsigned int __a, vector bool int __b) {
13300 return __a ^ (vector unsigned int)__b;
13301}
13302
13303static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
13304 vector bool int __b) {
13305 return __a ^ __b;
13306}
13307
13308static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13309 vector float __b) {
13310 vector unsigned int __res =
13311 (vector unsigned int)__a ^ (vector unsigned int)__b;
13312 return (vector float)__res;
13313}
13314
13315static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
13316 vector float __b) {
13317 vector unsigned int __res =
13318 (vector unsigned int)__a ^ (vector unsigned int)__b;
13319 return (vector float)__res;
13320}
13321
13322static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13323 vector bool int __b) {
13324 vector unsigned int __res =
13325 (vector unsigned int)__a ^ (vector unsigned int)__b;
13326 return (vector float)__res;
13327}
13328
13329#ifdef __VSX__
13330static __inline__ vector signed long long __ATTRS_o_ai
13331vec_xor(vector signed long long __a, vector signed long long __b) {
13332 return __a ^ __b;
13333}
13334
13335static __inline__ vector signed long long __ATTRS_o_ai
13336vec_xor(vector bool long long __a, vector signed long long __b) {
13337 return (vector signed long long)__a ^ __b;
13338}
13339
13340static __inline__ vector signed long long __ATTRS_o_ai
13341vec_xor(vector signed long long __a, vector bool long long __b) {
13342 return __a ^ (vector signed long long)__b;
13343}
13344
13345static __inline__ vector unsigned long long __ATTRS_o_ai
13346vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
13347 return __a ^ __b;
13348}
13349
13350static __inline__ vector unsigned long long __ATTRS_o_ai
13351vec_xor(vector bool long long __a, vector unsigned long long __b) {
13352 return (vector unsigned long long)__a ^ __b;
13353}
13354
13355static __inline__ vector unsigned long long __ATTRS_o_ai
13356vec_xor(vector unsigned long long __a, vector bool long long __b) {
13357 return __a ^ (vector unsigned long long)__b;
13358}
13359
13360static __inline__ vector bool long long __ATTRS_o_ai
13361vec_xor(vector bool long long __a, vector bool long long __b) {
13362 return __a ^ __b;
13363}
13364
13365static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
13366 vector double __b) {
13367 return (vector double)((vector unsigned long long)__a ^
13368 (vector unsigned long long)__b);
13369}
13370
13371static __inline__ vector double __ATTRS_o_ai
13372vec_xor(vector double __a, vector bool long long __b) {
13373 return (vector double)((vector unsigned long long)__a ^
13374 (vector unsigned long long)__b);
13375}
13376
13377static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
13378 vector double __b) {
13379 return (vector double)((vector unsigned long long)__a ^
13380 (vector unsigned long long)__b);
13381}
13382#endif
13383
13384/* vec_vxor */
13385
13386static __inline__ vector signed char __ATTRS_o_ai
13387vec_vxor(vector signed char __a, vector signed char __b) {
13388 return __a ^ __b;
13389}
13390
13391static __inline__ vector signed char __ATTRS_o_ai
13392vec_vxor(vector bool char __a, vector signed char __b) {
13393 return (vector signed char)__a ^ __b;
13394}
13395
13396static __inline__ vector signed char __ATTRS_o_ai
13397vec_vxor(vector signed char __a, vector bool char __b) {
13398 return __a ^ (vector signed char)__b;
13399}
13400
13401static __inline__ vector unsigned char __ATTRS_o_ai
13402vec_vxor(vector unsigned char __a, vector unsigned char __b) {
13403 return __a ^ __b;
13404}
13405
13406static __inline__ vector unsigned char __ATTRS_o_ai
13407vec_vxor(vector bool char __a, vector unsigned char __b) {
13408 return (vector unsigned char)__a ^ __b;
13409}
13410
13411static __inline__ vector unsigned char __ATTRS_o_ai
13412vec_vxor(vector unsigned char __a, vector bool char __b) {
13413 return __a ^ (vector unsigned char)__b;
13414}
13415
13416static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
13417 vector bool char __b) {
13418 return __a ^ __b;
13419}
13420
13421static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13422 vector short __b) {
13423 return __a ^ __b;
13424}
13425
13426static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
13427 vector short __b) {
13428 return (vector short)__a ^ __b;
13429}
13430
13431static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13432 vector bool short __b) {
13433 return __a ^ (vector short)__b;
13434}
13435
13436static __inline__ vector unsigned short __ATTRS_o_ai
13437vec_vxor(vector unsigned short __a, vector unsigned short __b) {
13438 return __a ^ __b;
13439}
13440
13441static __inline__ vector unsigned short __ATTRS_o_ai
13442vec_vxor(vector bool short __a, vector unsigned short __b) {
13443 return (vector unsigned short)__a ^ __b;
13444}
13445
13446static __inline__ vector unsigned short __ATTRS_o_ai
13447vec_vxor(vector unsigned short __a, vector bool short __b) {
13448 return __a ^ (vector unsigned short)__b;
13449}
13450
13451static __inline__ vector bool short __ATTRS_o_ai
13452vec_vxor(vector bool short __a, vector bool short __b) {
13453 return __a ^ __b;
13454}
13455
13456static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13457 vector int __b) {
13458 return __a ^ __b;
13459}
13460
13461static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
13462 vector int __b) {
13463 return (vector int)__a ^ __b;
13464}
13465
13466static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13467 vector bool int __b) {
13468 return __a ^ (vector int)__b;
13469}
13470
13471static __inline__ vector unsigned int __ATTRS_o_ai
13472vec_vxor(vector unsigned int __a, vector unsigned int __b) {
13473 return __a ^ __b;
13474}
13475
13476static __inline__ vector unsigned int __ATTRS_o_ai
13477vec_vxor(vector bool int __a, vector unsigned int __b) {
13478 return (vector unsigned int)__a ^ __b;
13479}
13480
13481static __inline__ vector unsigned int __ATTRS_o_ai
13482vec_vxor(vector unsigned int __a, vector bool int __b) {
13483 return __a ^ (vector unsigned int)__b;
13484}
13485
13486static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
13487 vector bool int __b) {
13488 return __a ^ __b;
13489}
13490
13491static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13492 vector float __b) {
13493 vector unsigned int __res =
13494 (vector unsigned int)__a ^ (vector unsigned int)__b;
13495 return (vector float)__res;
13496}
13497
13498static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
13499 vector float __b) {
13500 vector unsigned int __res =
13501 (vector unsigned int)__a ^ (vector unsigned int)__b;
13502 return (vector float)__res;
13503}
13504
13505static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13506 vector bool int __b) {
13507 vector unsigned int __res =
13508 (vector unsigned int)__a ^ (vector unsigned int)__b;
13509 return (vector float)__res;
13510}
13511
13512#ifdef __VSX__
13513static __inline__ vector signed long long __ATTRS_o_ai
13514vec_vxor(vector signed long long __a, vector signed long long __b) {
13515 return __a ^ __b;
13516}
13517
13518static __inline__ vector signed long long __ATTRS_o_ai
13519vec_vxor(vector bool long long __a, vector signed long long __b) {
13520 return (vector signed long long)__a ^ __b;
13521}
13522
13523static __inline__ vector signed long long __ATTRS_o_ai
13524vec_vxor(vector signed long long __a, vector bool long long __b) {
13525 return __a ^ (vector signed long long)__b;
13526}
13527
13528static __inline__ vector unsigned long long __ATTRS_o_ai
13529vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
13530 return __a ^ __b;
13531}
13532
13533static __inline__ vector unsigned long long __ATTRS_o_ai
13534vec_vxor(vector bool long long __a, vector unsigned long long __b) {
13535 return (vector unsigned long long)__a ^ __b;
13536}
13537
13538static __inline__ vector unsigned long long __ATTRS_o_ai
13539vec_vxor(vector unsigned long long __a, vector bool long long __b) {
13540 return __a ^ (vector unsigned long long)__b;
13541}
13542
13543static __inline__ vector bool long long __ATTRS_o_ai
13544vec_vxor(vector bool long long __a, vector bool long long __b) {
13545 return __a ^ __b;
13546}
13547#endif
13548
13549/* ------------------------ extensions for CBEA ----------------------------- */
13550
13551/* vec_extract */
13552
13553static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
13554 signed int __b) {
13555 return __a[__b & 0xf];
13556}
13557
13558static __inline__ unsigned char __ATTRS_o_ai
13559vec_extract(vector unsigned char __a, signed int __b) {
13560 return __a[__b & 0xf];
13561}
13562
13563static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
13564 signed int __b) {
13565 return __a[__b & 0xf];
13566}
13567
13568static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
13569 signed int __b) {
13570 return __a[__b & 0x7];
13571}
13572
13573static __inline__ unsigned short __ATTRS_o_ai
13574vec_extract(vector unsigned short __a, signed int __b) {
13575 return __a[__b & 0x7];
13576}
13577
13578static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
13579 signed int __b) {
13580 return __a[__b & 0x7];
13581}
13582
13583static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
13584 signed int __b) {
13585 return __a[__b & 0x3];
13586}
13587
13588static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
13589 signed int __b) {
13590 return __a[__b & 0x3];
13591}
13592
13593static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
13594 signed int __b) {
13595 return __a[__b & 0x3];
13596}
13597
13598#ifdef __VSX__
13599static __inline__ signed long long __ATTRS_o_ai
13600vec_extract(vector signed long long __a, signed int __b) {
13601 return __a[__b & 0x1];
13602}
13603
13604static __inline__ unsigned long long __ATTRS_o_ai
13605vec_extract(vector unsigned long long __a, signed int __b) {
13606 return __a[__b & 0x1];
13607}
13608
13609static __inline__ unsigned long long __ATTRS_o_ai
13610vec_extract(vector bool long long __a, signed int __b) {
13611 return __a[__b & 0x1];
13612}
13613
13614static __inline__ double __ATTRS_o_ai vec_extract(vector double __a,
13615 signed int __b) {
13616 return __a[__b & 0x1];
13617}
13618#endif
13619
13620static __inline__ float __ATTRS_o_ai vec_extract(vector float __a,
13621 signed int __b) {
13622 return __a[__b & 0x3];
13623}
13624
13625#ifdef __POWER9_VECTOR__
13626
13627#define vec_insert4b __builtin_vsx_insertword
13628#define vec_extract4b __builtin_vsx_extractuword
13629
13630/* vec_extract_exp */
13631
13632static __inline__ vector unsigned int __ATTRS_o_ai
13633vec_extract_exp(vector float __a) {
13634 return __builtin_vsx_xvxexpsp(__a);
13635}
13636
13637static __inline__ vector unsigned long long __ATTRS_o_ai
13638vec_extract_exp(vector double __a) {
13639 return __builtin_vsx_xvxexpdp(__a);
13640}
13641
13642/* vec_extract_sig */
13643
13644static __inline__ vector unsigned int __ATTRS_o_ai
13645vec_extract_sig(vector float __a) {
13646 return __builtin_vsx_xvxsigsp(__a);
13647}
13648
13649static __inline__ vector unsigned long long __ATTRS_o_ai
13650vec_extract_sig (vector double __a) {
13651 return __builtin_vsx_xvxsigdp(__a);
13652}
13653
13654static __inline__ vector float __ATTRS_o_ai
13655vec_extract_fp32_from_shorth(vector unsigned short __a) {
13656 vector unsigned short __b =
13657#ifdef __LITTLE_ENDIAN__
13658 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
13659#else
13660 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
13661#endif
13662 return __builtin_vsx_xvcvhpsp(__b);
13663}
13664
13665static __inline__ vector float __ATTRS_o_ai
13666vec_extract_fp32_from_shortl(vector unsigned short __a) {
13667 vector unsigned short __b =
13668#ifdef __LITTLE_ENDIAN__
13669 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
13670#else
13671 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
13672#endif
13673 return __builtin_vsx_xvcvhpsp(__b);
13674}
13675#endif /* __POWER9_VECTOR__ */
13676
13677/* vec_insert */
13678
13679static __inline__ vector signed char __ATTRS_o_ai
13680vec_insert(signed char __a, vector signed char __b, int __c) {
13681 __b[__c & 0xF] = __a;
13682 return __b;
13683}
13684
13685static __inline__ vector unsigned char __ATTRS_o_ai
13686vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
13687 __b[__c & 0xF] = __a;
13688 return __b;
13689}
13690
13691static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
13692 vector bool char __b,
13693 int __c) {
13694 __b[__c & 0xF] = __a;
13695 return __b;
13696}
13697
13698static __inline__ vector signed short __ATTRS_o_ai
13699vec_insert(signed short __a, vector signed short __b, int __c) {
13700 __b[__c & 0x7] = __a;
13701 return __b;
13702}
13703
13704static __inline__ vector unsigned short __ATTRS_o_ai
13705vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
13706 __b[__c & 0x7] = __a;
13707 return __b;
13708}
13709
13710static __inline__ vector bool short __ATTRS_o_ai
13711vec_insert(unsigned short __a, vector bool short __b, int __c) {
13712 __b[__c & 0x7] = __a;
13713 return __b;
13714}
13715
13716static __inline__ vector signed int __ATTRS_o_ai
13717vec_insert(signed int __a, vector signed int __b, int __c) {
13718 __b[__c & 0x3] = __a;
13719 return __b;
13720}
13721
13722static __inline__ vector unsigned int __ATTRS_o_ai
13723vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
13724 __b[__c & 0x3] = __a;
13725 return __b;
13726}
13727
13728static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
13729 vector bool int __b,
13730 int __c) {
13731 __b[__c & 0x3] = __a;
13732 return __b;
13733}
13734
13735#ifdef __VSX__
13736static __inline__ vector signed long long __ATTRS_o_ai
13737vec_insert(signed long long __a, vector signed long long __b, int __c) {
13738 __b[__c & 0x1] = __a;
13739 return __b;
13740}
13741
13742static __inline__ vector unsigned long long __ATTRS_o_ai
13743vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
13744 __b[__c & 0x1] = __a;
13745 return __b;
13746}
13747
13748static __inline__ vector bool long long __ATTRS_o_ai
13749vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
13750 __b[__c & 0x1] = __a;
13751 return __b;
13752}
13753static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
13754 vector double __b,
13755 int __c) {
13756 __b[__c & 0x1] = __a;
13757 return __b;
13758}
13759#endif
13760
13761static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
13762 vector float __b,
13763 int __c) {
13764 __b[__c & 0x3] = __a;
13765 return __b;
13766}
13767
13768/* vec_lvlx */
13769
13770static __inline__ vector signed char __ATTRS_o_ai
13771vec_lvlx(int __a, const signed char *__b) {
13772 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13773 vec_lvsl(__a, __b));
13774}
13775
13776static __inline__ vector signed char __ATTRS_o_ai
13777vec_lvlx(int __a, const vector signed char *__b) {
13778 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13779 vec_lvsl(__a, (unsigned char *)__b));
13780}
13781
13782static __inline__ vector unsigned char __ATTRS_o_ai
13783vec_lvlx(int __a, const unsigned char *__b) {
13784 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13785 vec_lvsl(__a, __b));
13786}
13787
13788static __inline__ vector unsigned char __ATTRS_o_ai
13789vec_lvlx(int __a, const vector unsigned char *__b) {
13790 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13791 vec_lvsl(__a, (unsigned char *)__b));
13792}
13793
13794static __inline__ vector bool char __ATTRS_o_ai
13795vec_lvlx(int __a, const vector bool char *__b) {
13796 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
13797 vec_lvsl(__a, (unsigned char *)__b));
13798}
13799
13800static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13801 const short *__b) {
13802 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13803}
13804
13805static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13806 const vector short *__b) {
13807 return vec_perm(vec_ld(__a, __b), (vector short)(0),
13808 vec_lvsl(__a, (unsigned char *)__b));
13809}
13810
13811static __inline__ vector unsigned short __ATTRS_o_ai
13812vec_lvlx(int __a, const unsigned short *__b) {
13813 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13814 vec_lvsl(__a, __b));
13815}
13816
13817static __inline__ vector unsigned short __ATTRS_o_ai
13818vec_lvlx(int __a, const vector unsigned short *__b) {
13819 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13820 vec_lvsl(__a, (unsigned char *)__b));
13821}
13822
13823static __inline__ vector bool short __ATTRS_o_ai
13824vec_lvlx(int __a, const vector bool short *__b) {
13825 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
13826 vec_lvsl(__a, (unsigned char *)__b));
13827}
13828
13829static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
13830 const vector pixel *__b) {
13831 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
13832 vec_lvsl(__a, (unsigned char *)__b));
13833}
13834
13835static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
13836 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13837}
13838
13839static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
13840 const vector int *__b) {
13841 return vec_perm(vec_ld(__a, __b), (vector int)(0),
13842 vec_lvsl(__a, (unsigned char *)__b));
13843}
13844
13845static __inline__ vector unsigned int __ATTRS_o_ai
13846vec_lvlx(int __a, const unsigned int *__b) {
13847 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13848 vec_lvsl(__a, __b));
13849}
13850
13851static __inline__ vector unsigned int __ATTRS_o_ai
13852vec_lvlx(int __a, const vector unsigned int *__b) {
13853 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13854 vec_lvsl(__a, (unsigned char *)__b));
13855}
13856
13857static __inline__ vector bool int __ATTRS_o_ai
13858vec_lvlx(int __a, const vector bool int *__b) {
13859 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
13860 vec_lvsl(__a, (unsigned char *)__b));
13861}
13862
13863static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13864 const float *__b) {
13865 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13866}
13867
13868static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13869 const vector float *__b) {
13870 return vec_perm(vec_ld(__a, __b), (vector float)(0),
13871 vec_lvsl(__a, (unsigned char *)__b));
13872}
13873
13874/* vec_lvlxl */
13875
13876static __inline__ vector signed char __ATTRS_o_ai
13877vec_lvlxl(int __a, const signed char *__b) {
13878 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13879 vec_lvsl(__a, __b));
13880}
13881
13882static __inline__ vector signed char __ATTRS_o_ai
13883vec_lvlxl(int __a, const vector signed char *__b) {
13884 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13885 vec_lvsl(__a, (unsigned char *)__b));
13886}
13887
13888static __inline__ vector unsigned char __ATTRS_o_ai
13889vec_lvlxl(int __a, const unsigned char *__b) {
13890 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13891 vec_lvsl(__a, __b));
13892}
13893
13894static __inline__ vector unsigned char __ATTRS_o_ai
13895vec_lvlxl(int __a, const vector unsigned char *__b) {
13896 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13897 vec_lvsl(__a, (unsigned char *)__b));
13898}
13899
13900static __inline__ vector bool char __ATTRS_o_ai
13901vec_lvlxl(int __a, const vector bool char *__b) {
13902 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
13903 vec_lvsl(__a, (unsigned char *)__b));
13904}
13905
13906static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13907 const short *__b) {
13908 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13909}
13910
13911static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13912 const vector short *__b) {
13913 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
13914 vec_lvsl(__a, (unsigned char *)__b));
13915}
13916
13917static __inline__ vector unsigned short __ATTRS_o_ai
13918vec_lvlxl(int __a, const unsigned short *__b) {
13919 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13920 vec_lvsl(__a, __b));
13921}
13922
13923static __inline__ vector unsigned short __ATTRS_o_ai
13924vec_lvlxl(int __a, const vector unsigned short *__b) {
13925 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13926 vec_lvsl(__a, (unsigned char *)__b));
13927}
13928
13929static __inline__ vector bool short __ATTRS_o_ai
13930vec_lvlxl(int __a, const vector bool short *__b) {
13931 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
13932 vec_lvsl(__a, (unsigned char *)__b));
13933}
13934
13935static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
13936 const vector pixel *__b) {
13937 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
13938 vec_lvsl(__a, (unsigned char *)__b));
13939}
13940
13941static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
13942 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13943}
13944
13945static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
13946 const vector int *__b) {
13947 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
13948 vec_lvsl(__a, (unsigned char *)__b));
13949}
13950
13951static __inline__ vector unsigned int __ATTRS_o_ai
13952vec_lvlxl(int __a, const unsigned int *__b) {
13953 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13954 vec_lvsl(__a, __b));
13955}
13956
13957static __inline__ vector unsigned int __ATTRS_o_ai
13958vec_lvlxl(int __a, const vector unsigned int *__b) {
13959 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13960 vec_lvsl(__a, (unsigned char *)__b));
13961}
13962
13963static __inline__ vector bool int __ATTRS_o_ai
13964vec_lvlxl(int __a, const vector bool int *__b) {
13965 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
13966 vec_lvsl(__a, (unsigned char *)__b));
13967}
13968
13969static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13970 const float *__b) {
13971 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13972}
13973
13974static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13975 vector float *__b) {
13976 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
13977 vec_lvsl(__a, (unsigned char *)__b));
13978}
13979
13980/* vec_lvrx */
13981
13982static __inline__ vector signed char __ATTRS_o_ai
13983vec_lvrx(int __a, const signed char *__b) {
13984 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13985 vec_lvsl(__a, __b));
13986}
13987
13988static __inline__ vector signed char __ATTRS_o_ai
13989vec_lvrx(int __a, const vector signed char *__b) {
13990 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13991 vec_lvsl(__a, (unsigned char *)__b));
13992}
13993
13994static __inline__ vector unsigned char __ATTRS_o_ai
13995vec_lvrx(int __a, const unsigned char *__b) {
13996 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13997 vec_lvsl(__a, __b));
13998}
13999
14000static __inline__ vector unsigned char __ATTRS_o_ai
14001vec_lvrx(int __a, const vector unsigned char *__b) {
14002 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
14003 vec_lvsl(__a, (unsigned char *)__b));
14004}
14005
14006static __inline__ vector bool char __ATTRS_o_ai
14007vec_lvrx(int __a, const vector bool char *__b) {
14008 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
14009 vec_lvsl(__a, (unsigned char *)__b));
14010}
14011
14012static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14013 const short *__b) {
14014 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14015}
14016
14017static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14018 const vector short *__b) {
14019 return vec_perm((vector short)(0), vec_ld(__a, __b),
14020 vec_lvsl(__a, (unsigned char *)__b));
14021}
14022
14023static __inline__ vector unsigned short __ATTRS_o_ai
14024vec_lvrx(int __a, const unsigned short *__b) {
14025 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14026 vec_lvsl(__a, __b));
14027}
14028
14029static __inline__ vector unsigned short __ATTRS_o_ai
14030vec_lvrx(int __a, const vector unsigned short *__b) {
14031 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14032 vec_lvsl(__a, (unsigned char *)__b));
14033}
14034
14035static __inline__ vector bool short __ATTRS_o_ai
14036vec_lvrx(int __a, const vector bool short *__b) {
14037 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
14038 vec_lvsl(__a, (unsigned char *)__b));
14039}
14040
14041static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
14042 const vector pixel *__b) {
14043 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
14044 vec_lvsl(__a, (unsigned char *)__b));
14045}
14046
14047static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
14048 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14049}
14050
14051static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
14052 const vector int *__b) {
14053 return vec_perm((vector int)(0), vec_ld(__a, __b),
14054 vec_lvsl(__a, (unsigned char *)__b));
14055}
14056
14057static __inline__ vector unsigned int __ATTRS_o_ai
14058vec_lvrx(int __a, const unsigned int *__b) {
14059 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14060 vec_lvsl(__a, __b));
14061}
14062
14063static __inline__ vector unsigned int __ATTRS_o_ai
14064vec_lvrx(int __a, const vector unsigned int *__b) {
14065 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14066 vec_lvsl(__a, (unsigned char *)__b));
14067}
14068
14069static __inline__ vector bool int __ATTRS_o_ai
14070vec_lvrx(int __a, const vector bool int *__b) {
14071 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
14072 vec_lvsl(__a, (unsigned char *)__b));
14073}
14074
14075static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14076 const float *__b) {
14077 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14078}
14079
14080static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14081 const vector float *__b) {
14082 return vec_perm((vector float)(0), vec_ld(__a, __b),
14083 vec_lvsl(__a, (unsigned char *)__b));
14084}
14085
14086/* vec_lvrxl */
14087
14088static __inline__ vector signed char __ATTRS_o_ai
14089vec_lvrxl(int __a, const signed char *__b) {
14090 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14091 vec_lvsl(__a, __b));
14092}
14093
14094static __inline__ vector signed char __ATTRS_o_ai
14095vec_lvrxl(int __a, const vector signed char *__b) {
14096 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14097 vec_lvsl(__a, (unsigned char *)__b));
14098}
14099
14100static __inline__ vector unsigned char __ATTRS_o_ai
14101vec_lvrxl(int __a, const unsigned char *__b) {
14102 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14103 vec_lvsl(__a, __b));
14104}
14105
14106static __inline__ vector unsigned char __ATTRS_o_ai
14107vec_lvrxl(int __a, const vector unsigned char *__b) {
14108 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14109 vec_lvsl(__a, (unsigned char *)__b));
14110}
14111
14112static __inline__ vector bool char __ATTRS_o_ai
14113vec_lvrxl(int __a, const vector bool char *__b) {
14114 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
14115 vec_lvsl(__a, (unsigned char *)__b));
14116}
14117
14118static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14119 const short *__b) {
14120 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14121}
14122
14123static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14124 const vector short *__b) {
14125 return vec_perm((vector short)(0), vec_ldl(__a, __b),
14126 vec_lvsl(__a, (unsigned char *)__b));
14127}
14128
14129static __inline__ vector unsigned short __ATTRS_o_ai
14130vec_lvrxl(int __a, const unsigned short *__b) {
14131 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14132 vec_lvsl(__a, __b));
14133}
14134
14135static __inline__ vector unsigned short __ATTRS_o_ai
14136vec_lvrxl(int __a, const vector unsigned short *__b) {
14137 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14138 vec_lvsl(__a, (unsigned char *)__b));
14139}
14140
14141static __inline__ vector bool short __ATTRS_o_ai
14142vec_lvrxl(int __a, const vector bool short *__b) {
14143 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
14144 vec_lvsl(__a, (unsigned char *)__b));
14145}
14146
14147static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
14148 const vector pixel *__b) {
14149 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
14150 vec_lvsl(__a, (unsigned char *)__b));
14151}
14152
14153static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
14154 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14155}
14156
14157static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
14158 const vector int *__b) {
14159 return vec_perm((vector int)(0), vec_ldl(__a, __b),
14160 vec_lvsl(__a, (unsigned char *)__b));
14161}
14162
14163static __inline__ vector unsigned int __ATTRS_o_ai
14164vec_lvrxl(int __a, const unsigned int *__b) {
14165 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14166 vec_lvsl(__a, __b));
14167}
14168
14169static __inline__ vector unsigned int __ATTRS_o_ai
14170vec_lvrxl(int __a, const vector unsigned int *__b) {
14171 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14172 vec_lvsl(__a, (unsigned char *)__b));
14173}
14174
14175static __inline__ vector bool int __ATTRS_o_ai
14176vec_lvrxl(int __a, const vector bool int *__b) {
14177 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
14178 vec_lvsl(__a, (unsigned char *)__b));
14179}
14180
14181static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14182 const float *__b) {
14183 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14184}
14185
14186static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14187 const vector float *__b) {
14188 return vec_perm((vector float)(0), vec_ldl(__a, __b),
14189 vec_lvsl(__a, (unsigned char *)__b));
14190}
14191
14192/* vec_stvlx */
14193
14194static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14195 signed char *__c) {
14197 __c);
14198}
14199
14200static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14201 vector signed char *__c) {
14202 return vec_st(
14203 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14204 __b, __c);
14205}
14206
14207static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14208 unsigned char *__c) {
14210 __c);
14211}
14212
14213static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14214 vector unsigned char *__c) {
14215 return vec_st(
14216 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14217 __b, __c);
14218}
14219
14220static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
14221 vector bool char *__c) {
14222 return vec_st(
14223 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14224 __b, __c);
14225}
14226
14227static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14228 short *__c) {
14230 __c);
14231}
14232
14233static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14234 vector short *__c) {
14235 return vec_st(
14236 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14237 __b, __c);
14238}
14239
14240static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14241 int __b, unsigned short *__c) {
14243 __c);
14244}
14245
14246static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14247 int __b,
14248 vector unsigned short *__c) {
14249 return vec_st(
14250 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14251 __b, __c);
14252}
14253
14254static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
14255 vector bool short *__c) {
14256 return vec_st(
14257 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14258 __b, __c);
14259}
14260
14261static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
14262 vector pixel *__c) {
14263 return vec_st(
14264 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14265 __b, __c);
14266}
14267
14268static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14269 int *__c) {
14271 __c);
14272}
14273
14274static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14275 vector int *__c) {
14276 return vec_st(
14277 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14278 __b, __c);
14279}
14280
14281static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14282 unsigned int *__c) {
14284 __c);
14285}
14286
14287static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14288 vector unsigned int *__c) {
14289 return vec_st(
14290 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14291 __b, __c);
14292}
14293
14294static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
14295 vector bool int *__c) {
14296 return vec_st(
14297 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14298 __b, __c);
14299}
14300
14301static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
14302 vector float *__c) {
14303 return vec_st(
14304 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14305 __b, __c);
14306}
14307
14308/* vec_stvlxl */
14309
14310static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14311 signed char *__c) {
14313 __c);
14314}
14315
14316static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14317 vector signed char *__c) {
14318 return vec_stl(
14319 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14320 __b, __c);
14321}
14322
14323static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14324 int __b, unsigned char *__c) {
14326 __c);
14327}
14328
14329static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14330 int __b,
14331 vector unsigned char *__c) {
14332 return vec_stl(
14333 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14334 __b, __c);
14335}
14336
14337static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
14338 vector bool char *__c) {
14339 return vec_stl(
14340 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14341 __b, __c);
14342}
14343
14344static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14345 short *__c) {
14347 __c);
14348}
14349
14350static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14351 vector short *__c) {
14352 return vec_stl(
14353 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14354 __b, __c);
14355}
14356
14357static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14358 int __b, unsigned short *__c) {
14360 __c);
14361}
14362
14363static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14364 int __b,
14365 vector unsigned short *__c) {
14366 return vec_stl(
14367 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14368 __b, __c);
14369}
14370
14371static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
14372 vector bool short *__c) {
14373 return vec_stl(
14374 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14375 __b, __c);
14376}
14377
14378static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
14379 vector pixel *__c) {
14380 return vec_stl(
14381 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14382 __b, __c);
14383}
14384
14385static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14386 int *__c) {
14388 __c);
14389}
14390
14391static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14392 vector int *__c) {
14393 return vec_stl(
14394 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14395 __b, __c);
14396}
14397
14398static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14399 unsigned int *__c) {
14401 __c);
14402}
14403
14404static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14405 vector unsigned int *__c) {
14406 return vec_stl(
14407 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14408 __b, __c);
14409}
14410
14411static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
14412 vector bool int *__c) {
14413 return vec_stl(
14414 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14415 __b, __c);
14416}
14417
14418static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
14419 vector float *__c) {
14420 return vec_stl(
14421 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14422 __b, __c);
14423}
14424
14425/* vec_stvrx */
14426
14427static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14428 signed char *__c) {
14430 __c);
14431}
14432
14433static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14434 vector signed char *__c) {
14435 return vec_st(
14436 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14437 __b, __c);
14438}
14439
14440static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14441 unsigned char *__c) {
14443 __c);
14444}
14445
14446static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14447 vector unsigned char *__c) {
14448 return vec_st(
14449 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14450 __b, __c);
14451}
14452
14453static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
14454 vector bool char *__c) {
14455 return vec_st(
14456 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14457 __b, __c);
14458}
14459
14460static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14461 short *__c) {
14463 __c);
14464}
14465
14466static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14467 vector short *__c) {
14468 return vec_st(
14469 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14470 __b, __c);
14471}
14472
14473static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14474 int __b, unsigned short *__c) {
14476 __c);
14477}
14478
14479static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14480 int __b,
14481 vector unsigned short *__c) {
14482 return vec_st(
14483 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14484 __b, __c);
14485}
14486
14487static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
14488 vector bool short *__c) {
14489 return vec_st(
14490 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14491 __b, __c);
14492}
14493
14494static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
14495 vector pixel *__c) {
14496 return vec_st(
14497 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14498 __b, __c);
14499}
14500
14501static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14502 int *__c) {
14504 __c);
14505}
14506
14507static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14508 vector int *__c) {
14509 return vec_st(
14510 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14511 __b, __c);
14512}
14513
14514static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14515 unsigned int *__c) {
14517 __c);
14518}
14519
14520static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14521 vector unsigned int *__c) {
14522 return vec_st(
14523 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14524 __b, __c);
14525}
14526
14527static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
14528 vector bool int *__c) {
14529 return vec_st(
14530 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14531 __b, __c);
14532}
14533
14534static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
14535 vector float *__c) {
14536 return vec_st(
14537 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14538 __b, __c);
14539}
14540
14541/* vec_stvrxl */
14542
14543static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14544 signed char *__c) {
14546 __c);
14547}
14548
14549static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14550 vector signed char *__c) {
14551 return vec_stl(
14552 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14553 __b, __c);
14554}
14555
14556static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14557 int __b, unsigned char *__c) {
14559 __c);
14560}
14561
14562static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14563 int __b,
14564 vector unsigned char *__c) {
14565 return vec_stl(
14566 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14567 __b, __c);
14568}
14569
14570static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
14571 vector bool char *__c) {
14572 return vec_stl(
14573 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14574 __b, __c);
14575}
14576
14577static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14578 short *__c) {
14580 __c);
14581}
14582
14583static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14584 vector short *__c) {
14585 return vec_stl(
14586 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14587 __b, __c);
14588}
14589
14590static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14591 int __b, unsigned short *__c) {
14593 __c);
14594}
14595
14596static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14597 int __b,
14598 vector unsigned short *__c) {
14599 return vec_stl(
14600 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14601 __b, __c);
14602}
14603
14604static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
14605 vector bool short *__c) {
14606 return vec_stl(
14607 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14608 __b, __c);
14609}
14610
14611static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
14612 vector pixel *__c) {
14613 return vec_stl(
14614 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14615 __b, __c);
14616}
14617
14618static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14619 int *__c) {
14621 __c);
14622}
14623
14624static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14625 vector int *__c) {
14626 return vec_stl(
14627 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14628 __b, __c);
14629}
14630
14631static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14632 unsigned int *__c) {
14634 __c);
14635}
14636
14637static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14638 vector unsigned int *__c) {
14639 return vec_stl(
14640 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14641 __b, __c);
14642}
14643
14644static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
14645 vector bool int *__c) {
14646 return vec_stl(
14647 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14648 __b, __c);
14649}
14650
14651static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
14652 vector float *__c) {
14653 return vec_stl(
14654 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14655 __b, __c);
14656}
14657
14658/* vec_promote */
14659
14660static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
14661 int __b) {
14662 const vector signed char __zero = (vector signed char)0;
14663 vector signed char __res =
14664 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1,
14665 -1, -1, -1, -1, -1, -1, -1, -1);
14666 __res[__b & 0xf] = __a;
14667 return __res;
14668}
14669
14670static __inline__ vector unsigned char __ATTRS_o_ai
14671vec_promote(unsigned char __a, int __b) {
14672 const vector unsigned char __zero = (vector unsigned char)(0);
14673 vector unsigned char __res =
14674 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1,
14675 -1, -1, -1, -1, -1, -1, -1, -1);
14676 __res[__b & 0xf] = __a;
14677 return __res;
14678}
14679
14680static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
14681 const vector short __zero = (vector short)(0);
14682 vector short __res =
14683 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1);
14684 __res[__b & 0x7] = __a;
14685 return __res;
14686}
14687
14688static __inline__ vector unsigned short __ATTRS_o_ai
14689vec_promote(unsigned short __a, int __b) {
14690 const vector unsigned short __zero = (vector unsigned short)(0);
14691 vector unsigned short __res =
14692 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1);
14693 __res[__b & 0x7] = __a;
14694 return __res;
14695}
14696
14697static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
14698 const vector int __zero = (vector int)(0);
14699 vector int __res = __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14700 __res[__b & 0x3] = __a;
14701 return __res;
14702}
14703
14704static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
14705 int __b) {
14706 const vector unsigned int __zero = (vector unsigned int)(0);
14707 vector unsigned int __res =
14708 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14709 __res[__b & 0x3] = __a;
14710 return __res;
14711}
14712
14713static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
14714 const vector float __zero = (vector float)(0);
14715 vector float __res = __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14716 __res[__b & 0x3] = __a;
14717 return __res;
14718}
14719
14720#ifdef __VSX__
14721static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) {
14722 const vector double __zero = (vector double)(0);
14723 vector double __res = __builtin_shufflevector(__zero, __zero, -1, -1);
14724 __res[__b & 0x1] = __a;
14725 return __res;
14726}
14727
14728static __inline__ vector signed long long __ATTRS_o_ai
14729vec_promote(signed long long __a, int __b) {
14730 const vector signed long long __zero = (vector signed long long)(0);
14731 vector signed long long __res =
14732 __builtin_shufflevector(__zero, __zero, -1, -1);
14733 __res[__b & 0x1] = __a;
14734 return __res;
14735}
14736
14737static __inline__ vector unsigned long long __ATTRS_o_ai
14738vec_promote(unsigned long long __a, int __b) {
14739 const vector unsigned long long __zero = (vector unsigned long long)(0);
14740 vector unsigned long long __res =
14741 __builtin_shufflevector(__zero, __zero, -1, -1);
14742 __res[__b & 0x1] = __a;
14743 return __res;
14744}
14745#endif
14746
14747/* vec_splats */
14748
14749static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
14750 return (vector signed char)(__a);
14751}
14752
14753static __inline__ vector unsigned char __ATTRS_o_ai
14754vec_splats(unsigned char __a) {
14755 return (vector unsigned char)(__a);
14756}
14757
14758static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
14759 return (vector short)(__a);
14760}
14761
14762static __inline__ vector unsigned short __ATTRS_o_ai
14763vec_splats(unsigned short __a) {
14764 return (vector unsigned short)(__a);
14765}
14766
14767static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
14768 return (vector int)(__a);
14769}
14770
14771static __inline__ vector unsigned int __ATTRS_o_ai
14772vec_splats(unsigned int __a) {
14773 return (vector unsigned int)(__a);
14774}
14775
14776#ifdef __VSX__
14777static __inline__ vector signed long long __ATTRS_o_ai
14778vec_splats(signed long long __a) {
14779 return (vector signed long long)(__a);
14780}
14781
14782static __inline__ vector unsigned long long __ATTRS_o_ai
14783vec_splats(unsigned long long __a) {
14784 return (vector unsigned long long)(__a);
14785}
14786
14787#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
14788 defined(__SIZEOF_INT128__)
14789static __inline__ vector signed __int128 __ATTRS_o_ai
14790vec_splats(signed __int128 __a) {
14791 return (vector signed __int128)(__a);
14792}
14793
14794static __inline__ vector unsigned __int128 __ATTRS_o_ai
14795vec_splats(unsigned __int128 __a) {
14796 return (vector unsigned __int128)(__a);
14797}
14798
14799#endif
14800
14801static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
14802 return (vector double)(__a);
14803}
14804#endif
14805
14806static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
14807 return (vector float)(__a);
14808}
14809
14810/* ----------------------------- predicates --------------------------------- */
14811
14812/* vec_all_eq */
14813
14814static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14815 vector signed char __b) {
14816 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14817 (vector char)__b);
14818}
14819
14820static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14821 vector bool char __b) {
14822 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14823 (vector char)__b);
14824}
14825
14826static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14827 vector unsigned char __b) {
14828 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14829 (vector char)__b);
14830}
14831
14832static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14833 vector bool char __b) {
14834 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14835 (vector char)__b);
14836}
14837
14838static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14839 vector signed char __b) {
14840 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14841 (vector char)__b);
14842}
14843
14844static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14845 vector unsigned char __b) {
14846 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14847 (vector char)__b);
14848}
14849
14850static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14851 vector bool char __b) {
14852 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14853 (vector char)__b);
14854}
14855
14856static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14857 vector short __b) {
14858 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
14859}
14860
14861static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14862 vector bool short __b) {
14863 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
14864}
14865
14866static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14867 vector unsigned short __b) {
14868 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14869 (vector short)__b);
14870}
14871
14872static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14873 vector bool short __b) {
14874 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14875 (vector short)__b);
14876}
14877
14878static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14879 vector short __b) {
14880 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14881 (vector short)__b);
14882}
14883
14884static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14885 vector unsigned short __b) {
14886 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14887 (vector short)__b);
14888}
14889
14890static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14891 vector bool short __b) {
14892 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14893 (vector short)__b);
14894}
14895
14896static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
14897 vector pixel __b) {
14898 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14899 (vector short)__b);
14900}
14901
14902static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
14903 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
14904}
14905
14906static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
14907 vector bool int __b) {
14908 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
14909}
14910
14911static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14912 vector unsigned int __b) {
14913 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14914 (vector int)__b);
14915}
14916
14917static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14918 vector bool int __b) {
14919 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14920 (vector int)__b);
14921}
14922
14923static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14924 vector int __b) {
14925 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14926 (vector int)__b);
14927}
14928
14929static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14930 vector unsigned int __b) {
14931 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14932 (vector int)__b);
14933}
14934
14935static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14936 vector bool int __b) {
14937 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14938 (vector int)__b);
14939}
14940
14941#ifdef __VSX__
14942static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
14943 vector signed long long __b) {
14944#ifdef __POWER8_VECTOR__
14945 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
14946#else
14947 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as
14948 // 32-bit elements.
14949 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0);
14950#endif
14951}
14952
14953static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
14954 vector bool long long __b) {
14955 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14956}
14957
14958static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14959 vector unsigned long long __b) {
14960 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14961}
14962
14963static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14964 vector bool long long __b) {
14965 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14966}
14967
14968static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14969 vector long long __b) {
14970 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14971}
14972
14973static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14974 vector unsigned long long __b) {
14975 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14976}
14977
14978static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14979 vector bool long long __b) {
14980 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14981}
14982#endif
14983
14984static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
14985 vector float __b) {
14986#ifdef __VSX__
14987 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
14988#else
14989 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
14990#endif
14991}
14992
14993#ifdef __VSX__
14994static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
14995 vector double __b) {
14996 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
14997}
14998#endif
14999
15000#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15001static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a,
15002 vector signed __int128 __b) {
15003 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
15004 (vector signed __int128)__b);
15005}
15006
15007static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a,
15008 vector unsigned __int128 __b) {
15009 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a,
15010 (vector signed __int128)__b);
15011}
15012
15013static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a,
15014 vector bool __int128 __b) {
15015 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
15016 (vector signed __int128)__b);
15017}
15018#endif
15019
15020/* vec_all_ge */
15021
15022static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
15023 vector signed char __b) {
15024 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
15025}
15026
15027static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
15028 vector bool char __b) {
15029 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
15030}
15031
15032static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15033 vector unsigned char __b) {
15034 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
15035}
15036
15037static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15038 vector bool char __b) {
15039 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
15040}
15041
15042static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15043 vector signed char __b) {
15044 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a);
15045}
15046
15047static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15048 vector unsigned char __b) {
15049 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
15050}
15051
15052static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15053 vector bool char __b) {
15054 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
15055 (vector unsigned char)__a);
15056}
15057
15058static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15059 vector short __b) {
15060 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
15061}
15062
15063static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15064 vector bool short __b) {
15065 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
15066}
15067
15068static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15069 vector unsigned short __b) {
15070 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
15071}
15072
15073static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15074 vector bool short __b) {
15075 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15076 __a);
15077}
15078
15079static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15080 vector short __b) {
15081 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a);
15082}
15083
15084static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15085 vector unsigned short __b) {
15086 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
15087 (vector unsigned short)__a);
15088}
15089
15090static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15091 vector bool short __b) {
15092 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15093 (vector unsigned short)__a);
15094}
15095
15096static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
15097 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
15098}
15099
15100static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
15101 vector bool int __b) {
15102 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
15103}
15104
15105static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15106 vector unsigned int __b) {
15107 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
15108}
15109
15110static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15111 vector bool int __b) {
15112 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
15113}
15114
15115static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15116 vector int __b) {
15117 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a);
15118}
15119
15120static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15121 vector unsigned int __b) {
15122 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
15123}
15124
15125static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15126 vector bool int __b) {
15127 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
15128 (vector unsigned int)__a);
15129}
15130
15131#ifdef __VSX__
15132static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15133 vector signed long long __b) {
15134 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
15135}
15136static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15137 vector bool long long __b) {
15138 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
15139 __a);
15140}
15141
15142static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15143 vector unsigned long long __b) {
15144 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
15145}
15146
15147static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15148 vector bool long long __b) {
15149 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15150 __a);
15151}
15152
15153static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15154 vector signed long long __b) {
15155 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b,
15156 (vector signed long long)__a);
15157}
15158
15159static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15160 vector unsigned long long __b) {
15161 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
15162 (vector unsigned long long)__a);
15163}
15164
15165static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15166 vector bool long long __b) {
15167 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15168 (vector unsigned long long)__a);
15169}
15170#endif
15171
15172static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
15173 vector float __b) {
15174#ifdef __VSX__
15175 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
15176#else
15177 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
15178#endif
15179}
15180
15181#ifdef __VSX__
15182static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
15183 vector double __b) {
15184 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
15185}
15186#endif
15187
15188#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15189static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a,
15190 vector signed __int128 __b) {
15191 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a);
15192}
15193
15194static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a,
15195 vector unsigned __int128 __b) {
15196 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a);
15197}
15198#endif
15199
15200/* vec_all_gt */
15201
15202static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15203 vector signed char __b) {
15204 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
15205}
15206
15207static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15208 vector bool char __b) {
15209 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
15210}
15211
15212static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15213 vector unsigned char __b) {
15214 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
15215}
15216
15217static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15218 vector bool char __b) {
15219 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
15220}
15221
15222static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15223 vector signed char __b) {
15224 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b);
15225}
15226
15227static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15228 vector unsigned char __b) {
15229 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
15230}
15231
15232static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15233 vector bool char __b) {
15234 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
15235 (vector unsigned char)__b);
15236}
15237
15238static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15239 vector short __b) {
15240 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
15241}
15242
15243static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15244 vector bool short __b) {
15245 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
15246}
15247
15248static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15249 vector unsigned short __b) {
15250 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
15251}
15252
15253static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15254 vector bool short __b) {
15255 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
15256 (vector unsigned short)__b);
15257}
15258
15259static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15260 vector short __b) {
15261 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b);
15262}
15263
15264static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15265 vector unsigned short __b) {
15266 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15267 __b);
15268}
15269
15270static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15271 vector bool short __b) {
15272 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15273 (vector unsigned short)__b);
15274}
15275
15276static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
15277 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
15278}
15279
15280static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
15281 vector bool int __b) {
15282 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
15283}
15284
15285static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15286 vector unsigned int __b) {
15287 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
15288}
15289
15290static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15291 vector bool int __b) {
15292 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
15293}
15294
15295static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15296 vector int __b) {
15297 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b);
15298}
15299
15300static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15301 vector unsigned int __b) {
15302 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
15303}
15304
15305static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15306 vector bool int __b) {
15307 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
15308 (vector unsigned int)__b);
15309}
15310
15311#ifdef __VSX__
15312static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15313 vector signed long long __b) {
15314 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
15315}
15316static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15317 vector bool long long __b) {
15318 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
15319 (vector signed long long)__b);
15320}
15321
15322static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15323 vector unsigned long long __b) {
15324 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
15325}
15326
15327static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15328 vector bool long long __b) {
15329 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
15330 (vector unsigned long long)__b);
15331}
15332
15333static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15334 vector signed long long __b) {
15335 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a,
15336 __b);
15337}
15338
15339static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15340 vector unsigned long long __b) {
15341 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15342 __b);
15343}
15344
15345static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15346 vector bool long long __b) {
15347 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15348 (vector unsigned long long)__b);
15349}
15350#endif
15351
15352static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
15353 vector float __b) {
15354#ifdef __VSX__
15355 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
15356#else
15357 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
15358#endif
15359}
15360
15361#ifdef __VSX__
15362static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
15363 vector double __b) {
15364 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
15365}
15366#endif
15367
15368#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15369static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a,
15370 vector signed __int128 __b) {
15371 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b);
15372}
15373
15374static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a,
15375 vector unsigned __int128 __b) {
15376 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b);
15377}
15378#endif
15379
15380/* vec_all_in */
15381
15382static __inline__ int __attribute__((__always_inline__))
15383vec_all_in(vector float __a, vector float __b) {
15384 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
15385}
15386
15387/* vec_all_le */
15388
15389static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15390 vector signed char __b) {
15391 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
15392}
15393
15394static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15395 vector bool char __b) {
15396 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
15397}
15398
15399static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15400 vector unsigned char __b) {
15401 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
15402}
15403
15404static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15405 vector bool char __b) {
15406 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
15407}
15408
15409static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15410 vector signed char __b) {
15411 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b);
15412}
15413
15414static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15415 vector unsigned char __b) {
15416 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
15417}
15418
15419static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15420 vector bool char __b) {
15421 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
15422 (vector unsigned char)__b);
15423}
15424
15425static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15426 vector short __b) {
15427 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
15428}
15429
15430static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15431 vector bool short __b) {
15432 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
15433}
15434
15435static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15436 vector unsigned short __b) {
15437 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
15438}
15439
15440static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15441 vector bool short __b) {
15442 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
15443 (vector unsigned short)__b);
15444}
15445
15446static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15447 vector short __b) {
15448 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b);
15449}
15450
15451static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15452 vector unsigned short __b) {
15453 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15454 __b);
15455}
15456
15457static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15458 vector bool short __b) {
15459 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15460 (vector unsigned short)__b);
15461}
15462
15463static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
15464 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
15465}
15466
15467static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
15468 vector bool int __b) {
15469 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
15470}
15471
15472static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15473 vector unsigned int __b) {
15474 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
15475}
15476
15477static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15478 vector bool int __b) {
15479 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
15480}
15481
15482static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15483 vector int __b) {
15484 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b);
15485}
15486
15487static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15488 vector unsigned int __b) {
15489 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
15490}
15491
15492static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15493 vector bool int __b) {
15494 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
15495 (vector unsigned int)__b);
15496}
15497
15498#ifdef __VSX__
15499static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15500 vector signed long long __b) {
15501 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
15502}
15503
15504static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15505 vector unsigned long long __b) {
15506 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
15507}
15508
15509static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15510 vector bool long long __b) {
15511 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
15512 (vector signed long long)__b);
15513}
15514
15515static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15516 vector bool long long __b) {
15517 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
15518 (vector unsigned long long)__b);
15519}
15520
15521static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15522 vector signed long long __b) {
15523 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a,
15524 __b);
15525}
15526
15527static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15528 vector unsigned long long __b) {
15529 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15530 __b);
15531}
15532
15533static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15534 vector bool long long __b) {
15535 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15536 (vector unsigned long long)__b);
15537}
15538#endif
15539
15540static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
15541 vector float __b) {
15542#ifdef __VSX__
15543 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
15544#else
15545 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
15546#endif
15547}
15548
15549#ifdef __VSX__
15550static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
15551 vector double __b) {
15552 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
15553}
15554#endif
15555
15556#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15557static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a,
15558 vector signed __int128 __b) {
15559 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b);
15560}
15561
15562static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a,
15563 vector unsigned __int128 __b) {
15564 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b);
15565}
15566#endif
15567
15568/* vec_all_lt */
15569
15570static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15571 vector signed char __b) {
15572 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
15573}
15574
15575static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15576 vector bool char __b) {
15577 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
15578}
15579
15580static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15581 vector unsigned char __b) {
15582 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
15583}
15584
15585static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15586 vector bool char __b) {
15587 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
15588}
15589
15590static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15591 vector signed char __b) {
15592 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a);
15593}
15594
15595static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15596 vector unsigned char __b) {
15597 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
15598}
15599
15600static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15601 vector bool char __b) {
15602 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
15603 (vector unsigned char)__a);
15604}
15605
15606static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15607 vector short __b) {
15608 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
15609}
15610
15611static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15612 vector bool short __b) {
15613 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
15614}
15615
15616static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15617 vector unsigned short __b) {
15618 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
15619}
15620
15621static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15622 vector bool short __b) {
15623 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15624 __a);
15625}
15626
15627static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15628 vector short __b) {
15629 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a);
15630}
15631
15632static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15633 vector unsigned short __b) {
15634 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
15635 (vector unsigned short)__a);
15636}
15637
15638static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15639 vector bool short __b) {
15640 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15641 (vector unsigned short)__a);
15642}
15643
15644static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
15645 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
15646}
15647
15648static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
15649 vector bool int __b) {
15650 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
15651}
15652
15653static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15654 vector unsigned int __b) {
15655 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
15656}
15657
15658static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15659 vector bool int __b) {
15660 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
15661}
15662
15663static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15664 vector int __b) {
15665 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a);
15666}
15667
15668static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15669 vector unsigned int __b) {
15670 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
15671}
15672
15673static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15674 vector bool int __b) {
15675 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
15676 (vector unsigned int)__a);
15677}
15678
15679#ifdef __VSX__
15680static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15681 vector signed long long __b) {
15682 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
15683}
15684
15685static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15686 vector unsigned long long __b) {
15687 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
15688}
15689
15690static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15691 vector bool long long __b) {
15692 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
15693 __a);
15694}
15695
15696static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15697 vector bool long long __b) {
15698 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15699 __a);
15700}
15701
15702static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15703 vector signed long long __b) {
15704 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b,
15705 (vector signed long long)__a);
15706}
15707
15708static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15709 vector unsigned long long __b) {
15710 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
15711 (vector unsigned long long)__a);
15712}
15713
15714static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15715 vector bool long long __b) {
15716 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15717 (vector unsigned long long)__a);
15718}
15719#endif
15720
15721static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
15722 vector float __b) {
15723#ifdef __VSX__
15724 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
15725#else
15726 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
15727#endif
15728}
15729
15730#ifdef __VSX__
15731static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
15732 vector double __b) {
15733 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
15734}
15735#endif
15736
15737#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15738static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a,
15739 vector signed __int128 __b) {
15740 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a);
15741}
15742
15743static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a,
15744 vector unsigned __int128 __b) {
15745 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a);
15746}
15747#endif
15748
15749/* vec_all_nan */
15750
15751static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
15752#ifdef __VSX__
15753 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
15754#else
15755 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
15756#endif
15757}
15758
15759#ifdef __VSX__
15760static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
15761 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
15762}
15763#endif
15764
15765/* vec_all_ne */
15766
15767static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15768 vector signed char __b) {
15769 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15770 (vector char)__b);
15771}
15772
15773static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15774 vector bool char __b) {
15775 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15776 (vector char)__b);
15777}
15778
15779static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15780 vector unsigned char __b) {
15781 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15782 (vector char)__b);
15783}
15784
15785static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15786 vector bool char __b) {
15787 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15788 (vector char)__b);
15789}
15790
15791static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15792 vector signed char __b) {
15793 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15794 (vector char)__b);
15795}
15796
15797static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15798 vector unsigned char __b) {
15799 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15800 (vector char)__b);
15801}
15802
15803static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15804 vector bool char __b) {
15805 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15806 (vector char)__b);
15807}
15808
15809static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15810 vector short __b) {
15811 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
15812}
15813
15814static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15815 vector bool short __b) {
15816 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
15817}
15818
15819static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15820 vector unsigned short __b) {
15821 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15822 (vector short)__b);
15823}
15824
15825static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15826 vector bool short __b) {
15827 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15828 (vector short)__b);
15829}
15830
15831static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15832 vector short __b) {
15833 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15834 (vector short)__b);
15835}
15836
15837static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15838 vector unsigned short __b) {
15839 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15840 (vector short)__b);
15841}
15842
15843static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15844 vector bool short __b) {
15845 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15846 (vector short)__b);
15847}
15848
15849static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
15850 vector pixel __b) {
15851 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15852 (vector short)__b);
15853}
15854
15855static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
15856 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
15857}
15858
15859static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
15860 vector bool int __b) {
15861 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
15862}
15863
15864static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15865 vector unsigned int __b) {
15866 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15867 (vector int)__b);
15868}
15869
15870static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15871 vector bool int __b) {
15872 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15873 (vector int)__b);
15874}
15875
15876static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15877 vector int __b) {
15878 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15879 (vector int)__b);
15880}
15881
15882static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15883 vector unsigned int __b) {
15884 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15885 (vector int)__b);
15886}
15887
15888static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15889 vector bool int __b) {
15890 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15891 (vector int)__b);
15892}
15893
15894#ifdef __VSX__
15895static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15896 vector signed long long __b) {
15897 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
15898}
15899
15900static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15901 vector unsigned long long __b) {
15902 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
15903 (vector long long)__b);
15904}
15905
15906static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15907 vector bool long long __b) {
15908 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
15909 (vector signed long long)__b);
15910}
15911
15912static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15913 vector bool long long __b) {
15914 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15915 (vector signed long long)__b);
15916}
15917
15918static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15919 vector signed long long __b) {
15920 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15921 (vector signed long long)__b);
15922}
15923
15924static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15925 vector unsigned long long __b) {
15926 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15927 (vector signed long long)__b);
15928}
15929
15930static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15931 vector bool long long __b) {
15932 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15933 (vector signed long long)__b);
15934}
15935#endif
15936
15937static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
15938 vector float __b) {
15939#ifdef __VSX__
15940 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
15941#else
15942 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
15943#endif
15944}
15945
15946#ifdef __VSX__
15947static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
15948 vector double __b) {
15949 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
15950}
15951#endif
15952
15953#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15954static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a,
15955 vector signed __int128 __b) {
15956 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15957 __b);
15958}
15959
15960static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a,
15961 vector unsigned __int128 __b) {
15962 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a,
15963 (vector signed __int128)__b);
15964}
15965
15966static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a,
15967 vector bool __int128 __b) {
15968 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15969 (vector signed __int128)__b);
15970}
15971#endif
15972
15973/* vec_all_nge */
15974
15975static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
15976 vector float __b) {
15977#ifdef __VSX__
15978 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
15979#else
15980 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
15981#endif
15982}
15983
15984#ifdef __VSX__
15985static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
15986 vector double __b) {
15987 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
15988}
15989#endif
15990
15991/* vec_all_ngt */
15992
15993static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
15994 vector float __b) {
15995#ifdef __VSX__
15996 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
15997#else
15998 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
15999#endif
16000}
16001
16002#ifdef __VSX__
16003static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
16004 vector double __b) {
16005 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
16006}
16007#endif
16008
16009/* vec_all_nle */
16010
16011static __inline__ int __ATTRS_o_ai
16012vec_all_nle(vector float __a, vector float __b) {
16013#ifdef __VSX__
16014 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a);
16015#else
16016 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
16017#endif
16018}
16019
16020#ifdef __VSX__
16021static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a,
16022 vector double __b) {
16023 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a);
16024}
16025#endif
16026
16027/* vec_all_nlt */
16028
16029static __inline__ int __ATTRS_o_ai
16030vec_all_nlt(vector float __a, vector float __b) {
16031#ifdef __VSX__
16032 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a);
16033#else
16034 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
16035#endif
16036}
16037
16038#ifdef __VSX__
16039static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a,
16040 vector double __b) {
16041 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a);
16042}
16043#endif
16044
16045/* vec_all_numeric */
16046
16047static __inline__ int __ATTRS_o_ai
16048vec_all_numeric(vector float __a) {
16049#ifdef __VSX__
16050 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a);
16051#else
16052 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
16053#endif
16054}
16055
16056#ifdef __VSX__
16057static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) {
16058 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a);
16059}
16060#endif
16061
16062/* vec_any_eq */
16063
16064static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16065 vector signed char __b) {
16066 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16067 (vector char)__b);
16068}
16069
16070static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16071 vector bool char __b) {
16072 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16073 (vector char)__b);
16074}
16075
16076static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16077 vector unsigned char __b) {
16078 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16079 (vector char)__b);
16080}
16081
16082static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16083 vector bool char __b) {
16084 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16085 (vector char)__b);
16086}
16087
16088static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16089 vector signed char __b) {
16090 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16091 (vector char)__b);
16092}
16093
16094static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16095 vector unsigned char __b) {
16096 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16097 (vector char)__b);
16098}
16099
16100static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16101 vector bool char __b) {
16102 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16103 (vector char)__b);
16104}
16105
16106static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16107 vector short __b) {
16108 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
16109}
16110
16111static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16112 vector bool short __b) {
16113 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
16114}
16115
16116static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16117 vector unsigned short __b) {
16118 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16119 (vector short)__b);
16120}
16121
16122static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16123 vector bool short __b) {
16124 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16125 (vector short)__b);
16126}
16127
16128static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16129 vector short __b) {
16130 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16131 (vector short)__b);
16132}
16133
16134static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16135 vector unsigned short __b) {
16136 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16137 (vector short)__b);
16138}
16139
16140static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16141 vector bool short __b) {
16142 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16143 (vector short)__b);
16144}
16145
16146static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
16147 vector pixel __b) {
16148 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16149 (vector short)__b);
16150}
16151
16152static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
16153 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
16154}
16155
16156static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
16157 vector bool int __b) {
16158 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
16159}
16160
16161static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16162 vector unsigned int __b) {
16163 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16164 (vector int)__b);
16165}
16166
16167static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16168 vector bool int __b) {
16169 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16170 (vector int)__b);
16171}
16172
16173static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16174 vector int __b) {
16175 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16176 (vector int)__b);
16177}
16178
16179static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16180 vector unsigned int __b) {
16181 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16182 (vector int)__b);
16183}
16184
16185static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16186 vector bool int __b) {
16187 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16188 (vector int)__b);
16189}
16190
16191#ifdef __VSX__
16192static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16193 vector signed long long __b) {
16194 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
16195}
16196
16197static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16198 vector unsigned long long __b) {
16199 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
16200 (vector long long)__b);
16201}
16202
16203static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16204 vector bool long long __b) {
16205 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
16206 (vector signed long long)__b);
16207}
16208
16209static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16210 vector bool long long __b) {
16211 return __builtin_altivec_vcmpequd_p(
16212 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16213}
16214
16215static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16216 vector signed long long __b) {
16217 return __builtin_altivec_vcmpequd_p(
16218 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16219}
16220
16221static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16222 vector unsigned long long __b) {
16223 return __builtin_altivec_vcmpequd_p(
16224 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16225}
16226
16227static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16228 vector bool long long __b) {
16229 return __builtin_altivec_vcmpequd_p(
16230 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16231}
16232#endif
16233
16234static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
16235 vector float __b) {
16236#ifdef __VSX__
16237 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
16238#else
16239 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
16240#endif
16241}
16242
16243#ifdef __VSX__
16244static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
16245 vector double __b) {
16246 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
16247}
16248#endif
16249
16250#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16251static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a,
16252 vector signed __int128 __b) {
16253 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV,
16254 (vector unsigned __int128)__a, __b);
16255}
16256
16257static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a,
16258 vector unsigned __int128 __b) {
16259 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a,
16260 (vector signed __int128)__b);
16261}
16262
16263static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a,
16264 vector bool __int128 __b) {
16265 return __builtin_altivec_vcmpequq_p(
16266 __CR6_EQ_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
16267}
16268#endif
16269
16270/* vec_any_ge */
16271
16272static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16273 vector signed char __b) {
16274 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
16275}
16276
16277static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16278 vector bool char __b) {
16279 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
16280 __a);
16281}
16282
16283static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16284 vector unsigned char __b) {
16285 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
16286}
16287
16288static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16289 vector bool char __b) {
16290 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16291 __a);
16292}
16293
16294static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16295 vector signed char __b) {
16296 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b,
16297 (vector signed char)__a);
16298}
16299
16300static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16301 vector unsigned char __b) {
16302 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
16303 (vector unsigned char)__a);
16304}
16305
16306static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16307 vector bool char __b) {
16308 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16309 (vector unsigned char)__a);
16310}
16311
16312static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16313 vector short __b) {
16314 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
16315}
16316
16317static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16318 vector bool short __b) {
16319 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
16320}
16321
16322static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16323 vector unsigned short __b) {
16324 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
16325}
16326
16327static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16328 vector bool short __b) {
16329 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16330 __a);
16331}
16332
16333static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16334 vector short __b) {
16335 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b,
16336 (vector signed short)__a);
16337}
16338
16339static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16340 vector unsigned short __b) {
16341 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
16342 (vector unsigned short)__a);
16343}
16344
16345static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16346 vector bool short __b) {
16347 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16348 (vector unsigned short)__a);
16349}
16350
16351static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
16352 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
16353}
16354
16355static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
16356 vector bool int __b) {
16357 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
16358}
16359
16360static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16361 vector unsigned int __b) {
16362 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
16363}
16364
16365static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16366 vector bool int __b) {
16367 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16368 __a);
16369}
16370
16371static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16372 vector int __b) {
16373 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b,
16374 (vector signed int)__a);
16375}
16376
16377static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16378 vector unsigned int __b) {
16379 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
16380 (vector unsigned int)__a);
16381}
16382
16383static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16384 vector bool int __b) {
16385 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16386 (vector unsigned int)__a);
16387}
16388
16389#ifdef __VSX__
16390static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16391 vector signed long long __b) {
16392 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
16393}
16394
16395static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16396 vector unsigned long long __b) {
16397 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
16398}
16399
16400static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16401 vector bool long long __b) {
16402 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16403 (vector signed long long)__b, __a);
16404}
16405
16406static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16407 vector bool long long __b) {
16408 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16409 (vector unsigned long long)__b, __a);
16410}
16411
16412static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16413 vector signed long long __b) {
16414 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b,
16415 (vector signed long long)__a);
16416}
16417
16418static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16419 vector unsigned long long __b) {
16420 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
16421 (vector unsigned long long)__a);
16422}
16423
16424static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16425 vector bool long long __b) {
16426 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16427 (vector unsigned long long)__b,
16428 (vector unsigned long long)__a);
16429}
16430#endif
16431
16432static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
16433 vector float __b) {
16434#ifdef __VSX__
16435 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
16436#else
16437 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
16438#endif
16439}
16440
16441#ifdef __VSX__
16442static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
16443 vector double __b) {
16444 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
16445}
16446#endif
16447
16448#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16449static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a,
16450 vector signed __int128 __b) {
16451 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a);
16452}
16453
16454static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a,
16455 vector unsigned __int128 __b) {
16456 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a);
16457}
16458#endif
16459
16460/* vec_any_gt */
16461
16462static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16463 vector signed char __b) {
16464 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
16465}
16466
16467static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16468 vector bool char __b) {
16469 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
16470 (vector signed char)__b);
16471}
16472
16473static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16474 vector unsigned char __b) {
16475 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
16476}
16477
16478static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16479 vector bool char __b) {
16480 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
16481 (vector unsigned char)__b);
16482}
16483
16484static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16485 vector signed char __b) {
16486 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a,
16487 __b);
16488}
16489
16490static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16491 vector unsigned char __b) {
16492 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16493 __b);
16494}
16495
16496static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16497 vector bool char __b) {
16498 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16499 (vector unsigned char)__b);
16500}
16501
16502static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16503 vector short __b) {
16504 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
16505}
16506
16507static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16508 vector bool short __b) {
16509 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
16510}
16511
16512static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16513 vector unsigned short __b) {
16514 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
16515}
16516
16517static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16518 vector bool short __b) {
16519 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
16520 (vector unsigned short)__b);
16521}
16522
16523static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16524 vector short __b) {
16525 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a,
16526 __b);
16527}
16528
16529static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16530 vector unsigned short __b) {
16531 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16532 __b);
16533}
16534
16535static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16536 vector bool short __b) {
16537 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16538 (vector unsigned short)__b);
16539}
16540
16541static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
16542 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
16543}
16544
16545static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
16546 vector bool int __b) {
16547 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
16548}
16549
16550static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16551 vector unsigned int __b) {
16552 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
16553}
16554
16555static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16556 vector bool int __b) {
16557 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
16558 (vector unsigned int)__b);
16559}
16560
16561static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16562 vector int __b) {
16563 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a,
16564 __b);
16565}
16566
16567static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16568 vector unsigned int __b) {
16569 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16570 __b);
16571}
16572
16573static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16574 vector bool int __b) {
16575 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16576 (vector unsigned int)__b);
16577}
16578
16579#ifdef __VSX__
16580static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16581 vector signed long long __b) {
16582 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
16583}
16584
16585static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16586 vector unsigned long long __b) {
16587 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
16588}
16589
16590static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16591 vector bool long long __b) {
16592 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
16593 (vector signed long long)__b);
16594}
16595
16596static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16597 vector bool long long __b) {
16598 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
16599 (vector unsigned long long)__b);
16600}
16601
16602static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16603 vector signed long long __b) {
16604 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16605 (vector signed long long)__a, __b);
16606}
16607
16608static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16609 vector unsigned long long __b) {
16610 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16611 (vector unsigned long long)__a, __b);
16612}
16613
16614static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16615 vector bool long long __b) {
16616 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16617 (vector unsigned long long)__a,
16618 (vector unsigned long long)__b);
16619}
16620#endif
16621
16622static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
16623 vector float __b) {
16624#ifdef __VSX__
16625 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
16626#else
16627 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
16628#endif
16629}
16630
16631#ifdef __VSX__
16632static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
16633 vector double __b) {
16634 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
16635}
16636#endif
16637
16638#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16639static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a,
16640 vector signed __int128 __b) {
16641 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b);
16642}
16643
16644static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a,
16645 vector unsigned __int128 __b) {
16646 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b);
16647}
16648#endif
16649
16650/* vec_any_le */
16651
16652static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16653 vector signed char __b) {
16654 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
16655}
16656
16657static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16658 vector bool char __b) {
16659 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
16660 (vector signed char)__b);
16661}
16662
16663static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16664 vector unsigned char __b) {
16665 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
16666}
16667
16668static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16669 vector bool char __b) {
16670 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
16671 (vector unsigned char)__b);
16672}
16673
16674static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16675 vector signed char __b) {
16676 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a,
16677 __b);
16678}
16679
16680static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16681 vector unsigned char __b) {
16682 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16683 __b);
16684}
16685
16686static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16687 vector bool char __b) {
16688 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16689 (vector unsigned char)__b);
16690}
16691
16692static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16693 vector short __b) {
16694 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
16695}
16696
16697static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16698 vector bool short __b) {
16699 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
16700}
16701
16702static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16703 vector unsigned short __b) {
16704 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
16705}
16706
16707static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16708 vector bool short __b) {
16709 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
16710 (vector unsigned short)__b);
16711}
16712
16713static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16714 vector short __b) {
16715 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a,
16716 __b);
16717}
16718
16719static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16720 vector unsigned short __b) {
16721 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16722 __b);
16723}
16724
16725static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16726 vector bool short __b) {
16727 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16728 (vector unsigned short)__b);
16729}
16730
16731static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
16732 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
16733}
16734
16735static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
16736 vector bool int __b) {
16737 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
16738}
16739
16740static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16741 vector unsigned int __b) {
16742 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
16743}
16744
16745static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16746 vector bool int __b) {
16747 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
16748 (vector unsigned int)__b);
16749}
16750
16751static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16752 vector int __b) {
16753 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a,
16754 __b);
16755}
16756
16757static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16758 vector unsigned int __b) {
16759 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16760 __b);
16761}
16762
16763static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16764 vector bool int __b) {
16765 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16766 (vector unsigned int)__b);
16767}
16768
16769#ifdef __VSX__
16770static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16771 vector signed long long __b) {
16772 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
16773}
16774
16775static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16776 vector unsigned long long __b) {
16777 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
16778}
16779
16780static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16781 vector bool long long __b) {
16782 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
16783 (vector signed long long)__b);
16784}
16785
16786static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16787 vector bool long long __b) {
16788 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
16789 (vector unsigned long long)__b);
16790}
16791
16792static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16793 vector signed long long __b) {
16794 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16795 (vector signed long long)__a, __b);
16796}
16797
16798static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16799 vector unsigned long long __b) {
16800 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16801 (vector unsigned long long)__a, __b);
16802}
16803
16804static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16805 vector bool long long __b) {
16806 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16807 (vector unsigned long long)__a,
16808 (vector unsigned long long)__b);
16809}
16810#endif
16811
16812static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
16813 vector float __b) {
16814#ifdef __VSX__
16815 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
16816#else
16817 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
16818#endif
16819}
16820
16821#ifdef __VSX__
16822static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
16823 vector double __b) {
16824 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
16825}
16826#endif
16827
16828#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16829static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a,
16830 vector signed __int128 __b) {
16831 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b);
16832}
16833
16834static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a,
16835 vector unsigned __int128 __b) {
16836 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b);
16837}
16838#endif
16839
16840/* vec_any_lt */
16841
16842static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16843 vector signed char __b) {
16844 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
16845}
16846
16847static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16848 vector bool char __b) {
16849 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
16850 __a);
16851}
16852
16853static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16854 vector unsigned char __b) {
16855 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
16856}
16857
16858static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16859 vector bool char __b) {
16860 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16861 __a);
16862}
16863
16864static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16865 vector signed char __b) {
16866 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b,
16867 (vector signed char)__a);
16868}
16869
16870static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16871 vector unsigned char __b) {
16872 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
16873 (vector unsigned char)__a);
16874}
16875
16876static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16877 vector bool char __b) {
16878 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16879 (vector unsigned char)__a);
16880}
16881
16882static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16883 vector short __b) {
16884 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
16885}
16886
16887static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16888 vector bool short __b) {
16889 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
16890}
16891
16892static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16893 vector unsigned short __b) {
16894 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
16895}
16896
16897static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16898 vector bool short __b) {
16899 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16900 __a);
16901}
16902
16903static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16904 vector short __b) {
16905 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b,
16906 (vector signed short)__a);
16907}
16908
16909static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16910 vector unsigned short __b) {
16911 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
16912 (vector unsigned short)__a);
16913}
16914
16915static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16916 vector bool short __b) {
16917 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16918 (vector unsigned short)__a);
16919}
16920
16921static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
16922 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
16923}
16924
16925static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
16926 vector bool int __b) {
16927 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
16928}
16929
16930static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16931 vector unsigned int __b) {
16932 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
16933}
16934
16935static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16936 vector bool int __b) {
16937 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16938 __a);
16939}
16940
16941static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16942 vector int __b) {
16943 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b,
16944 (vector signed int)__a);
16945}
16946
16947static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16948 vector unsigned int __b) {
16949 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
16950 (vector unsigned int)__a);
16951}
16952
16953static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16954 vector bool int __b) {
16955 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16956 (vector unsigned int)__a);
16957}
16958
16959#ifdef __VSX__
16960static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16961 vector signed long long __b) {
16962 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
16963}
16964
16965static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16966 vector unsigned long long __b) {
16967 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
16968}
16969
16970static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16971 vector bool long long __b) {
16972 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16973 (vector signed long long)__b, __a);
16974}
16975
16976static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16977 vector bool long long __b) {
16978 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16979 (vector unsigned long long)__b, __a);
16980}
16981
16982static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16983 vector signed long long __b) {
16984 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b,
16985 (vector signed long long)__a);
16986}
16987
16988static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16989 vector unsigned long long __b) {
16990 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
16991 (vector unsigned long long)__a);
16992}
16993
16994static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16995 vector bool long long __b) {
16996 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16997 (vector unsigned long long)__b,
16998 (vector unsigned long long)__a);
16999}
17000#endif
17001
17002static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
17003 vector float __b) {
17004#ifdef __VSX__
17005 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
17006#else
17007 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
17008#endif
17009}
17010
17011#ifdef __VSX__
17012static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
17013 vector double __b) {
17014 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
17015}
17016#endif
17017
17018#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17019static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a,
17020 vector signed __int128 __b) {
17021 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a);
17022}
17023
17024static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a,
17025 vector unsigned __int128 __b) {
17026 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a);
17027}
17028#endif
17029
17030/* vec_any_nan */
17031
17032static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) {
17033#ifdef __VSX__
17034 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a);
17035#else
17036 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
17037#endif
17038}
17039#ifdef __VSX__
17040static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) {
17041 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a);
17042}
17043#endif
17044
17045/* vec_any_ne */
17046
17047static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17048 vector signed char __b) {
17049 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17050 (vector char)__b);
17051}
17052
17053static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17054 vector bool char __b) {
17055 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17056 (vector char)__b);
17057}
17058
17059static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17060 vector unsigned char __b) {
17061 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17062 (vector char)__b);
17063}
17064
17065static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17066 vector bool char __b) {
17067 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17068 (vector char)__b);
17069}
17070
17071static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17072 vector signed char __b) {
17073 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17074 (vector char)__b);
17075}
17076
17077static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17078 vector unsigned char __b) {
17079 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17080 (vector char)__b);
17081}
17082
17083static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17084 vector bool char __b) {
17085 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17086 (vector char)__b);
17087}
17088
17089static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17090 vector short __b) {
17091 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
17092}
17093
17094static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17095 vector bool short __b) {
17096 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
17097}
17098
17099static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17100 vector unsigned short __b) {
17101 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17102 (vector short)__b);
17103}
17104
17105static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17106 vector bool short __b) {
17107 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17108 (vector short)__b);
17109}
17110
17111static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17112 vector short __b) {
17113 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17114 (vector short)__b);
17115}
17116
17117static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17118 vector unsigned short __b) {
17119 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17120 (vector short)__b);
17121}
17122
17123static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17124 vector bool short __b) {
17125 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17126 (vector short)__b);
17127}
17128
17129static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
17130 vector pixel __b) {
17131 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17132 (vector short)__b);
17133}
17134
17135static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
17136 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
17137}
17138
17139static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
17140 vector bool int __b) {
17141 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
17142}
17143
17144static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17145 vector unsigned int __b) {
17146 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17147 (vector int)__b);
17148}
17149
17150static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17151 vector bool int __b) {
17152 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17153 (vector int)__b);
17154}
17155
17156static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17157 vector int __b) {
17158 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17159 (vector int)__b);
17160}
17161
17162static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17163 vector unsigned int __b) {
17164 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17165 (vector int)__b);
17166}
17167
17168static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17169 vector bool int __b) {
17170 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17171 (vector int)__b);
17172}
17173
17174#ifdef __VSX__
17175static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17176 vector signed long long __b) {
17177#ifdef __POWER8_VECTOR__
17178 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
17179#else
17180 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is
17181 // not available.
17182 return !vec_all_eq(__a, __b);
17183#endif
17184}
17185
17186static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17187 vector unsigned long long __b) {
17188 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17189}
17190
17191static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17192 vector bool long long __b) {
17193 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17194}
17195
17196static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17197 vector bool long long __b) {
17198 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17199}
17200
17201static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17202 vector signed long long __b) {
17203 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17204}
17205
17206static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17207 vector unsigned long long __b) {
17208 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17209}
17210
17211static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17212 vector bool long long __b) {
17213 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17214}
17215#endif
17216
17217static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
17218 vector float __b) {
17219#ifdef __VSX__
17220 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
17221#else
17222 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
17223#endif
17224}
17225
17226#ifdef __VSX__
17227static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
17228 vector double __b) {
17229 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
17230}
17231#endif
17232
17233#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17234static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a,
17235 vector signed __int128 __b) {
17236 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV,
17237 (vector unsigned __int128)__a, __b);
17238}
17239
17240static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a,
17241 vector unsigned __int128 __b) {
17242 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a,
17243 (vector signed __int128)__b);
17244}
17245
17246static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a,
17247 vector bool __int128 __b) {
17248 return __builtin_altivec_vcmpequq_p(
17249 __CR6_LT_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
17250}
17251#endif
17252
17253/* vec_any_nge */
17254
17255static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a,
17256 vector float __b) {
17257#ifdef __VSX__
17258 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b);
17259#else
17260 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
17261#endif
17262}
17263
17264#ifdef __VSX__
17265static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a,
17266 vector double __b) {
17267 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b);
17268}
17269#endif
17270
17271/* vec_any_ngt */
17272
17273static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a,
17274 vector float __b) {
17275#ifdef __VSX__
17276 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b);
17277#else
17278 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
17279#endif
17280}
17281
17282#ifdef __VSX__
17283static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a,
17284 vector double __b) {
17285 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b);
17286}
17287#endif
17288
17289/* vec_any_nle */
17290
17291static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a,
17292 vector float __b) {
17293#ifdef __VSX__
17294 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a);
17295#else
17296 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
17297#endif
17298}
17299
17300#ifdef __VSX__
17301static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a,
17302 vector double __b) {
17303 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a);
17304}
17305#endif
17306
17307/* vec_any_nlt */
17308
17309static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a,
17310 vector float __b) {
17311#ifdef __VSX__
17312 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a);
17313#else
17314 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
17315#endif
17316}
17317
17318#ifdef __VSX__
17319static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a,
17320 vector double __b) {
17321 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a);
17322}
17323#endif
17324
17325/* vec_any_numeric */
17326
17327static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) {
17328#ifdef __VSX__
17329 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a);
17330#else
17331 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
17332#endif
17333}
17334
17335#ifdef __VSX__
17336static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) {
17337 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a);
17338}
17339#endif
17340
17341/* vec_any_out */
17342
17343static __inline__ int __attribute__((__always_inline__))
17344vec_any_out(vector float __a, vector float __b) {
17345 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
17346}
17347
17348/* Power 8 Crypto functions
17349Note: We diverge from the current GCC implementation with regard
17350to cryptography and related functions as follows:
17351- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
17352- The remaining ones are only available on Power8 and up so
17353 require -mpower8-vector
17354The justification for this is that export requirements require that
17355Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
17356support). As a result, we need to be able to turn off support for those.
17357The remaining ones (currently controlled by -mcrypto for GCC) still
17358need to be provided on compliant hardware even if Vector.Crypto is not
17359provided.
17360*/
17361#ifdef __CRYPTO__
17362#define vec_sbox_be __builtin_altivec_crypto_vsbox
17363#define vec_cipher_be __builtin_altivec_crypto_vcipher
17364#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
17365#define vec_ncipher_be __builtin_altivec_crypto_vncipher
17366#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
17367
17368#ifdef __VSX__
17369static __inline__ vector unsigned char __attribute__((__always_inline__))
17370__builtin_crypto_vsbox(vector unsigned char __a) {
17371 return __builtin_altivec_crypto_vsbox(__a);
17372}
17373
17374static __inline__ vector unsigned char __attribute__((__always_inline__))
17375__builtin_crypto_vcipher(vector unsigned char __a,
17376 vector unsigned char __b) {
17377 return __builtin_altivec_crypto_vcipher(__a, __b);
17378}
17379
17380static __inline__ vector unsigned char __attribute__((__always_inline__))
17381__builtin_crypto_vcipherlast(vector unsigned char __a,
17382 vector unsigned char __b) {
17383 return __builtin_altivec_crypto_vcipherlast(__a, __b);
17384}
17385
17386static __inline__ vector unsigned char __attribute__((__always_inline__))
17387__builtin_crypto_vncipher(vector unsigned char __a,
17388 vector unsigned char __b) {
17389 return __builtin_altivec_crypto_vncipher(__a, __b);
17390}
17391
17392static __inline__ vector unsigned char __attribute__((__always_inline__))
17393__builtin_crypto_vncipherlast(vector unsigned char __a,
17394 vector unsigned char __b) {
17395 return __builtin_altivec_crypto_vncipherlast(__a, __b);
17396}
17397#endif /* __VSX__ */
17398
17399#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
17400#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
17401
17402#define vec_shasigma_be(X, Y, Z) \
17403 _Generic((X), vector unsigned int \
17404 : __builtin_crypto_vshasigmaw, vector unsigned long long \
17405 : __builtin_crypto_vshasigmad)((X), (Y), (Z))
17406#endif
17407
17408#ifdef __POWER8_VECTOR__
17409static __inline__ vector bool char __ATTRS_o_ai
17410vec_permxor(vector bool char __a, vector bool char __b,
17411 vector bool char __c) {
17412 return (vector bool char)__builtin_altivec_crypto_vpermxor(
17413 (vector unsigned char)__a, (vector unsigned char)__b,
17414 (vector unsigned char)__c);
17415}
17416
17417static __inline__ vector signed char __ATTRS_o_ai
17418vec_permxor(vector signed char __a, vector signed char __b,
17419 vector signed char __c) {
17420 return (vector signed char)__builtin_altivec_crypto_vpermxor(
17421 (vector unsigned char)__a, (vector unsigned char)__b,
17422 (vector unsigned char)__c);
17423}
17424
17425static __inline__ vector unsigned char __ATTRS_o_ai
17426vec_permxor(vector unsigned char __a, vector unsigned char __b,
17427 vector unsigned char __c) {
17428 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17429}
17430
17431static __inline__ vector unsigned char __ATTRS_o_ai
17432__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
17433 vector unsigned char __c) {
17434 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17435}
17436
17437static __inline__ vector unsigned short __ATTRS_o_ai
17438__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
17439 vector unsigned short __c) {
17440 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
17441 (vector unsigned char)__a, (vector unsigned char)__b,
17442 (vector unsigned char)__c);
17443}
17444
17445static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
17446 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
17447 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
17448 (vector unsigned char)__a, (vector unsigned char)__b,
17449 (vector unsigned char)__c);
17450}
17451
17452static __inline__ vector unsigned long long __ATTRS_o_ai
17453__builtin_crypto_vpermxor(vector unsigned long long __a,
17454 vector unsigned long long __b,
17455 vector unsigned long long __c) {
17456 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
17457 (vector unsigned char)__a, (vector unsigned char)__b,
17458 (vector unsigned char)__c);
17459}
17460
17461static __inline__ vector unsigned char __ATTRS_o_ai
17462__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
17463 return __builtin_altivec_crypto_vpmsumb(__a, __b);
17464}
17465
17466static __inline__ vector unsigned short __ATTRS_o_ai
17467__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
17468 return __builtin_altivec_crypto_vpmsumh(__a, __b);
17469}
17470
17471static __inline__ vector unsigned int __ATTRS_o_ai
17472__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
17473 return __builtin_altivec_crypto_vpmsumw(__a, __b);
17474}
17475
17476static __inline__ vector unsigned long long __ATTRS_o_ai
17477__builtin_crypto_vpmsumb(vector unsigned long long __a,
17478 vector unsigned long long __b) {
17479 return __builtin_altivec_crypto_vpmsumd(__a, __b);
17480}
17481
17482static __inline__ vector signed char __ATTRS_o_ai
17483vec_vgbbd(vector signed char __a) {
17484 return (vector signed char)__builtin_altivec_vgbbd((vector unsigned char)__a);
17485}
17486
17487#define vec_pmsum_be __builtin_crypto_vpmsumb
17488#define vec_gb __builtin_altivec_vgbbd
17489
17490static __inline__ vector unsigned char __ATTRS_o_ai
17491vec_vgbbd(vector unsigned char __a) {
17492 return __builtin_altivec_vgbbd(__a);
17493}
17494
17495static __inline__ vector signed long long __ATTRS_o_ai
17496vec_gbb(vector signed long long __a) {
17497 return (vector signed long long)__builtin_altivec_vgbbd(
17498 (vector unsigned char)__a);
17499}
17500
17501static __inline__ vector unsigned long long __ATTRS_o_ai
17502vec_gbb(vector unsigned long long __a) {
17503 return (vector unsigned long long)__builtin_altivec_vgbbd(
17504 (vector unsigned char)__a);
17505}
17506
17507static __inline__ vector long long __ATTRS_o_ai
17508vec_vbpermq(vector signed char __a, vector signed char __b) {
17509 return (vector long long)__builtin_altivec_vbpermq((vector unsigned char)__a,
17510 (vector unsigned char)__b);
17511}
17512
17513static __inline__ vector long long __ATTRS_o_ai
17514vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
17515 return (vector long long)__builtin_altivec_vbpermq(__a, __b);
17516}
17517
17518#if defined(__powerpc64__) && defined(__SIZEOF_INT128__)
17519static __inline__ vector unsigned long long __ATTRS_o_ai
17520vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
17521 return __builtin_altivec_vbpermq((vector unsigned char)__a,
17522 (vector unsigned char)__b);
17523}
17524#endif
17525static __inline__ vector unsigned char __ATTRS_o_ai
17526vec_bperm(vector unsigned char __a, vector unsigned char __b) {
17527 return (vector unsigned char)__builtin_altivec_vbpermq(__a, __b);
17528}
17529#endif // __POWER8_VECTOR__
17530#ifdef __POWER9_VECTOR__
17531static __inline__ vector unsigned long long __ATTRS_o_ai
17532vec_bperm(vector unsigned long long __a, vector unsigned char __b) {
17533 return __builtin_altivec_vbpermd(__a, __b);
17534}
17535#endif
17536
17537
17538/* vec_reve */
17539
17540static __inline__ __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
17541 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17542 5, 4, 3, 2, 1, 0);
17543}
17544
17545static __inline__ __ATTRS_o_ai vector signed char
17546vec_reve(vector signed char __a) {
17547 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17548 5, 4, 3, 2, 1, 0);
17549}
17550
17551static __inline__ __ATTRS_o_ai vector unsigned char
17552vec_reve(vector unsigned char __a) {
17553 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17554 5, 4, 3, 2, 1, 0);
17555}
17556
17557static __inline__ __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
17558 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17559}
17560
17561static __inline__ __ATTRS_o_ai vector signed int
17562vec_reve(vector signed int __a) {
17563 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17564}
17565
17566static __inline__ __ATTRS_o_ai vector unsigned int
17567vec_reve(vector unsigned int __a) {
17568 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17569}
17570
17571static __inline__ __ATTRS_o_ai vector bool short
17572vec_reve(vector bool short __a) {
17573 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17574}
17575
17576static __inline__ __ATTRS_o_ai vector signed short
17577vec_reve(vector signed short __a) {
17578 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17579}
17580
17581static __inline__ __ATTRS_o_ai vector unsigned short
17582vec_reve(vector unsigned short __a) {
17583 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17584}
17585
17586static __inline__ __ATTRS_o_ai vector float vec_reve(vector float __a) {
17587 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17588}
17589
17590#ifdef __VSX__
17591static __inline__ __ATTRS_o_ai vector bool long long
17592vec_reve(vector bool long long __a) {
17593 return __builtin_shufflevector(__a, __a, 1, 0);
17594}
17595
17596static __inline__ __ATTRS_o_ai vector signed long long
17597vec_reve(vector signed long long __a) {
17598 return __builtin_shufflevector(__a, __a, 1, 0);
17599}
17600
17601static __inline__ __ATTRS_o_ai vector unsigned long long
17602vec_reve(vector unsigned long long __a) {
17603 return __builtin_shufflevector(__a, __a, 1, 0);
17604}
17605
17606static __inline__ __ATTRS_o_ai vector double vec_reve(vector double __a) {
17607 return __builtin_shufflevector(__a, __a, 1, 0);
17608}
17609#endif
17610
17611/* vec_revb */
17612static __inline__ vector bool char __ATTRS_o_ai
17613vec_revb(vector bool char __a) {
17614 return __a;
17615}
17616
17617static __inline__ vector signed char __ATTRS_o_ai
17618vec_revb(vector signed char __a) {
17619 return __a;
17620}
17621
17622static __inline__ vector unsigned char __ATTRS_o_ai
17623vec_revb(vector unsigned char __a) {
17624 return __a;
17625}
17626
17627static __inline__ vector bool short __ATTRS_o_ai
17628vec_revb(vector bool short __a) {
17629 vector unsigned char __indices =
17630 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17631 return vec_perm(__a, __a, __indices);
17632}
17633
17634static __inline__ vector signed short __ATTRS_o_ai
17635vec_revb(vector signed short __a) {
17636 vector unsigned char __indices =
17637 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17638 return vec_perm(__a, __a, __indices);
17639}
17640
17641static __inline__ vector unsigned short __ATTRS_o_ai
17642vec_revb(vector unsigned short __a) {
17643 vector unsigned char __indices =
17644 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17645 return vec_perm(__a, __a, __indices);
17646}
17647
17648static __inline__ vector bool int __ATTRS_o_ai
17649vec_revb(vector bool int __a) {
17650 vector unsigned char __indices =
17651 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17652 return vec_perm(__a, __a, __indices);
17653}
17654
17655static __inline__ vector signed int __ATTRS_o_ai
17656vec_revb(vector signed int __a) {
17657 vector unsigned char __indices =
17658 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17659 return vec_perm(__a, __a, __indices);
17660}
17661
17662static __inline__ vector unsigned int __ATTRS_o_ai
17663vec_revb(vector unsigned int __a) {
17664 vector unsigned char __indices =
17665 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17666 return vec_perm(__a, __a, __indices);
17667}
17668
17669static __inline__ vector float __ATTRS_o_ai
17670vec_revb(vector float __a) {
17671 vector unsigned char __indices =
17672 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17673 return vec_perm(__a, __a, __indices);
17674}
17675
17676#ifdef __VSX__
17677static __inline__ vector bool long long __ATTRS_o_ai
17678vec_revb(vector bool long long __a) {
17679 vector unsigned char __indices =
17680 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17681 return vec_perm(__a, __a, __indices);
17682}
17683
17684static __inline__ vector signed long long __ATTRS_o_ai
17685vec_revb(vector signed long long __a) {
17686 vector unsigned char __indices =
17687 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17688 return vec_perm(__a, __a, __indices);
17689}
17690
17691static __inline__ vector unsigned long long __ATTRS_o_ai
17692vec_revb(vector unsigned long long __a) {
17693 vector unsigned char __indices =
17694 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17695 return vec_perm(__a, __a, __indices);
17696}
17697
17698static __inline__ vector double __ATTRS_o_ai
17699vec_revb(vector double __a) {
17700 vector unsigned char __indices =
17701 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17702 return vec_perm(__a, __a, __indices);
17703}
17704#endif /* End __VSX__ */
17705
17706#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17707 defined(__SIZEOF_INT128__)
17708static __inline__ vector signed __int128 __ATTRS_o_ai
17709vec_revb(vector signed __int128 __a) {
17710 vector unsigned char __indices =
17711 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17712 return (vector signed __int128)vec_perm((vector signed int)__a,
17713 (vector signed int)__a,
17714 __indices);
17715}
17716
17717static __inline__ vector unsigned __int128 __ATTRS_o_ai
17718vec_revb(vector unsigned __int128 __a) {
17719 vector unsigned char __indices =
17720 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17721 return (vector unsigned __int128)vec_perm((vector signed int)__a,
17722 (vector signed int)__a,
17723 __indices);
17724}
17725#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
17726
17727/* vec_xl */
17728
17729#define vec_xld2 vec_xl
17730#define vec_xlw4 vec_xl
17731typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
17732typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
17733typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
17734typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
17735typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
17736typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
17737typedef vector float unaligned_vec_float __attribute__((aligned(1)));
17738
17739static __inline__ __ATTRS_o_ai vector signed char
17740vec_xl(ptrdiff_t __offset, const signed char *__ptr) {
17741 return *(unaligned_vec_schar *)(__ptr + __offset);
17742}
17743
17744static __inline__ __ATTRS_o_ai vector unsigned char
17745vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
17746 return *(unaligned_vec_uchar*)(__ptr + __offset);
17747}
17748
17749static __inline__ __ATTRS_o_ai vector signed short
17750vec_xl(ptrdiff_t __offset, const signed short *__ptr) {
17751 signed char *__addr = (signed char *)__ptr + __offset;
17752 return *(unaligned_vec_sshort *)__addr;
17753}
17754
17755static __inline__ __ATTRS_o_ai vector unsigned short
17756vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
17757 signed char *__addr = (signed char *)__ptr + __offset;
17758 return *(unaligned_vec_ushort *)__addr;
17759}
17760
17761static __inline__ __ATTRS_o_ai vector signed int
17762vec_xl(ptrdiff_t __offset, const signed int *__ptr) {
17763 signed char *__addr = (signed char *)__ptr + __offset;
17764 return *(unaligned_vec_sint *)__addr;
17765}
17766
17767static __inline__ __ATTRS_o_ai vector unsigned int
17768vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
17769 signed char *__addr = (signed char *)__ptr + __offset;
17770 return *(unaligned_vec_uint *)__addr;
17771}
17772
17773static __inline__ __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
17774 const float *__ptr) {
17775 signed char *__addr = (signed char *)__ptr + __offset;
17776 return *(unaligned_vec_float *)__addr;
17777}
17778
17779#ifdef __VSX__
17780typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
17781typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
17782typedef vector double unaligned_vec_double __attribute__((aligned(1)));
17783
17784static __inline__ __ATTRS_o_ai vector signed long long
17785vec_xl(ptrdiff_t __offset, const signed long long *__ptr) {
17786 signed char *__addr = (signed char *)__ptr + __offset;
17787 return *(unaligned_vec_sll *)__addr;
17788}
17789
17790static __inline__ __ATTRS_o_ai vector unsigned long long
17791vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
17792 signed char *__addr = (signed char *)__ptr + __offset;
17793 return *(unaligned_vec_ull *)__addr;
17794}
17795
17796static __inline__ __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
17797 const double *__ptr) {
17798 signed char *__addr = (signed char *)__ptr + __offset;
17799 return *(unaligned_vec_double *)__addr;
17800}
17801#endif
17802
17803#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17804 defined(__SIZEOF_INT128__)
17805typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
17806typedef vector unsigned __int128 unaligned_vec_ui128
17807 __attribute__((aligned(1)));
17808static __inline__ __ATTRS_o_ai vector signed __int128
17809vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) {
17810 signed char *__addr = (signed char *)__ptr + __offset;
17811 return *(unaligned_vec_si128 *)__addr;
17812}
17813
17814static __inline__ __ATTRS_o_ai vector unsigned __int128
17815vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
17816 signed char *__addr = (signed char *)__ptr + __offset;
17817 return *(unaligned_vec_ui128 *)__addr;
17818}
17819#endif
17820
17821/* vec_xl_be */
17822
17823#ifdef __LITTLE_ENDIAN__
17824#ifdef __VSX__
17825static __inline__ vector signed char __ATTRS_o_ai
17826vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) {
17827 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17828 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17829 13, 12, 11, 10, 9, 8);
17830}
17831
17832static __inline__ vector unsigned char __ATTRS_o_ai
17833vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) {
17834 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17835 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17836 13, 12, 11, 10, 9, 8);
17837}
17838
17839static __inline__ vector signed short __ATTRS_o_ai
17840vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) {
17841 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17842 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17843}
17844
17845static __inline__ vector unsigned short __ATTRS_o_ai
17846vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) {
17847 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17848 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17849}
17850
17851static __inline__ vector signed int __ATTRS_o_ai
17852vec_xl_be(signed long long __offset, const signed int *__ptr) {
17853 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17854}
17855
17856static __inline__ vector unsigned int __ATTRS_o_ai
17857vec_xl_be(signed long long __offset, const unsigned int *__ptr) {
17858 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17859}
17860
17861static __inline__ vector float __ATTRS_o_ai
17862vec_xl_be(signed long long __offset, const float *__ptr) {
17863 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17864}
17865
17866static __inline__ vector signed long long __ATTRS_o_ai
17867vec_xl_be(signed long long __offset, const signed long long *__ptr) {
17868 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17869}
17870
17871static __inline__ vector unsigned long long __ATTRS_o_ai
17872vec_xl_be(signed long long __offset, const unsigned long long *__ptr) {
17873 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17874}
17875
17876static __inline__ vector double __ATTRS_o_ai
17877vec_xl_be(signed long long __offset, const double *__ptr) {
17878 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17879}
17880
17881#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17882 defined(__SIZEOF_INT128__)
17883static __inline__ vector signed __int128 __ATTRS_o_ai
17884vec_xl_be(signed long long __offset, const signed __int128 *__ptr) {
17885 return vec_xl(__offset, __ptr);
17886}
17887
17888static __inline__ vector unsigned __int128 __ATTRS_o_ai
17889vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
17890 return vec_xl(__offset, __ptr);
17891}
17892#endif
17893#endif // __VSX__
17894#else // ! __LITTLE_ENDIAN__
17895#define vec_xl_be vec_xl
17896#endif
17897
17898#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
17899 defined(__SIZEOF_INT128__)
17900
17901/* vec_xl_sext */
17902
17903static __inline__ vector signed __int128 __ATTRS_o_ai
17904vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) {
17905 return (vector signed __int128)*(__pointer + __offset);
17906}
17907
17908static __inline__ vector signed __int128 __ATTRS_o_ai
17909vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) {
17910 return (vector signed __int128)*(__pointer + __offset);
17911}
17912
17913static __inline__ vector signed __int128 __ATTRS_o_ai
17914vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) {
17915 return (vector signed __int128)*(__pointer + __offset);
17916}
17917
17918static __inline__ vector signed __int128 __ATTRS_o_ai
17919vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) {
17920 return (vector signed __int128)*(__pointer + __offset);
17921}
17922
17923/* vec_xl_zext */
17924
17925static __inline__ vector unsigned __int128 __ATTRS_o_ai
17926vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) {
17927 return (vector unsigned __int128)*(__pointer + __offset);
17928}
17929
17930static __inline__ vector unsigned __int128 __ATTRS_o_ai
17931vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) {
17932 return (vector unsigned __int128)*(__pointer + __offset);
17933}
17934
17935static __inline__ vector unsigned __int128 __ATTRS_o_ai
17936vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) {
17937 return (vector unsigned __int128)*(__pointer + __offset);
17938}
17939
17940static __inline__ vector unsigned __int128 __ATTRS_o_ai
17941vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) {
17942 return (vector unsigned __int128)*(__pointer + __offset);
17943}
17944
17945#endif
17946
17947/* vec_xlds */
17948#ifdef __VSX__
17949static __inline__ vector signed long long __ATTRS_o_ai
17950vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) {
17951 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset);
17952 return (vector signed long long) *__addr;
17953}
17954
17955static __inline__ vector unsigned long long __ATTRS_o_ai
17956vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) {
17957 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset);
17958 return (unaligned_vec_ull) *__addr;
17959}
17960
17961static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset,
17962 const double *__ptr) {
17963 double *__addr = (double*)((signed char *)__ptr + __offset);
17964 return (unaligned_vec_double) *__addr;
17965}
17966
17967/* vec_load_splats */
17968static __inline__ vector signed int __ATTRS_o_ai
17969vec_load_splats(signed long long __offset, const signed int *__ptr) {
17970 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17971 return (vector signed int)*__addr;
17972}
17973
17974static __inline__ vector signed int __ATTRS_o_ai
17975vec_load_splats(unsigned long long __offset, const signed int *__ptr) {
17976 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17977 return (vector signed int)*__addr;
17978}
17979
17980static __inline__ vector unsigned int __ATTRS_o_ai
17981vec_load_splats(signed long long __offset, const unsigned int *__ptr) {
17982 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17983 return (vector unsigned int)*__addr;
17984}
17985
17986static __inline__ vector unsigned int __ATTRS_o_ai
17987vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) {
17988 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17989 return (vector unsigned int)*__addr;
17990}
17991
17992static __inline__ vector float __ATTRS_o_ai
17993vec_load_splats(signed long long __offset, const float *__ptr) {
17994 float *__addr = (float*)((signed char *)__ptr + __offset);
17995 return (vector float)*__addr;
17996}
17997
17998static __inline__ vector float __ATTRS_o_ai
17999vec_load_splats(unsigned long long __offset, const float *__ptr) {
18000 float *__addr = (float*)((signed char *)__ptr + __offset);
18001 return (vector float)*__addr;
18002}
18003#endif
18004
18005/* vec_xst */
18006
18007#define vec_xstd2 vec_xst
18008#define vec_xstw4 vec_xst
18009static __inline__ __ATTRS_o_ai void
18010vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) {
18011 *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
18012}
18013
18014static __inline__ __ATTRS_o_ai void
18015vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) {
18016 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
18017}
18018
18019static __inline__ __ATTRS_o_ai void
18020vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
18021 signed char *__addr = (signed char *)__ptr + __offset;
18022 *(unaligned_vec_sshort *)__addr = __vec;
18023}
18024
18025static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
18026 ptrdiff_t __offset,
18027 unsigned short *__ptr) {
18028 signed char *__addr = (signed char *)__ptr + __offset;
18029 *(unaligned_vec_ushort *)__addr = __vec;
18030}
18031
18032static __inline__ __ATTRS_o_ai void
18033vec_xst(vector signed int __vec, ptrdiff_t __offset, signed int *__ptr) {
18034 signed char *__addr = (signed char *)__ptr + __offset;
18035 *(unaligned_vec_sint *)__addr = __vec;
18036}
18037
18038static __inline__ __ATTRS_o_ai void
18039vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
18040 signed char *__addr = (signed char *)__ptr + __offset;
18041 *(unaligned_vec_uint *)__addr = __vec;
18042}
18043
18044static __inline__ __ATTRS_o_ai void vec_xst(vector float __vec,
18045 ptrdiff_t __offset, float *__ptr) {
18046 signed char *__addr = (signed char *)__ptr + __offset;
18047 *(unaligned_vec_float *)__addr = __vec;
18048}
18049
18050#ifdef __VSX__
18051static __inline__ __ATTRS_o_ai void vec_xst(vector signed long long __vec,
18052 ptrdiff_t __offset,
18053 signed long long *__ptr) {
18054 signed char *__addr = (signed char *)__ptr + __offset;
18055 *(unaligned_vec_sll *)__addr = __vec;
18056}
18057
18058static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
18059 ptrdiff_t __offset,
18060 unsigned long long *__ptr) {
18061 signed char *__addr = (signed char *)__ptr + __offset;
18062 *(unaligned_vec_ull *)__addr = __vec;
18063}
18064
18065static __inline__ __ATTRS_o_ai void vec_xst(vector double __vec,
18066 ptrdiff_t __offset, double *__ptr) {
18067 signed char *__addr = (signed char *)__ptr + __offset;
18068 *(unaligned_vec_double *)__addr = __vec;
18069}
18070#endif
18071
18072#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18073 defined(__SIZEOF_INT128__)
18074static __inline__ __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
18075 ptrdiff_t __offset,
18076 signed __int128 *__ptr) {
18077 signed char *__addr = (signed char *)__ptr + __offset;
18078 *(unaligned_vec_si128 *)__addr = __vec;
18079}
18080
18081static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
18082 ptrdiff_t __offset,
18083 unsigned __int128 *__ptr) {
18084 signed char *__addr = (signed char *)__ptr + __offset;
18085 *(unaligned_vec_ui128 *)__addr = __vec;
18086}
18087#endif
18088
18089/* vec_xst_trunc */
18090
18091#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
18092 defined(__SIZEOF_INT128__)
18093static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18094 ptrdiff_t __offset,
18095 signed char *__ptr) {
18096 *(__ptr + __offset) = (signed char)__vec[0];
18097}
18098
18099static __inline__ __ATTRS_o_ai void
18100vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
18101 unsigned char *__ptr) {
18102 *(__ptr + __offset) = (unsigned char)__vec[0];
18103}
18104
18105static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18106 ptrdiff_t __offset,
18107 signed short *__ptr) {
18108 *(__ptr + __offset) = (signed short)__vec[0];
18109}
18110
18111static __inline__ __ATTRS_o_ai void
18112vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
18113 unsigned short *__ptr) {
18114 *(__ptr + __offset) = (unsigned short)__vec[0];
18115}
18116
18117static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18118 ptrdiff_t __offset,
18119 signed int *__ptr) {
18120 *(__ptr + __offset) = (signed int)__vec[0];
18121}
18122
18123static __inline__ __ATTRS_o_ai void
18124vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
18125 unsigned int *__ptr) {
18126 *(__ptr + __offset) = (unsigned int)__vec[0];
18127}
18128
18129static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18130 ptrdiff_t __offset,
18131 signed long long *__ptr) {
18132 *(__ptr + __offset) = (signed long long)__vec[0];
18133}
18134
18135static __inline__ __ATTRS_o_ai void
18136vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
18137 unsigned long long *__ptr) {
18138 *(__ptr + __offset) = (unsigned long long)__vec[0];
18139}
18140#endif
18141
18142/* vec_xst_be */
18143
18144#ifdef __LITTLE_ENDIAN__
18145#ifdef __VSX__
18146static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
18147 signed long long __offset,
18148 signed char *__ptr) {
18149 vector signed char __tmp =
18150 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18151 13, 12, 11, 10, 9, 8);
18152 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18153 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18154}
18155
18156static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
18157 signed long long __offset,
18158 unsigned char *__ptr) {
18159 vector unsigned char __tmp =
18160 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18161 13, 12, 11, 10, 9, 8);
18162 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18163 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18164}
18165
18166static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
18167 signed long long __offset,
18168 signed short *__ptr) {
18169 vector signed short __tmp =
18170 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18171 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18172 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18173}
18174
18175static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
18176 signed long long __offset,
18177 unsigned short *__ptr) {
18178 vector unsigned short __tmp =
18179 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18180 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18181 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18182}
18183
18184static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
18185 signed long long __offset,
18186 signed int *__ptr) {
18187 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
18188}
18189
18190static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
18191 signed long long __offset,
18192 unsigned int *__ptr) {
18193 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18194}
18195
18196static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
18197 signed long long __offset,
18198 float *__ptr) {
18199 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18200}
18201
18202static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
18203 signed long long __offset,
18204 signed long long *__ptr) {
18205 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18206}
18207
18208static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
18209 signed long long __offset,
18210 unsigned long long *__ptr) {
18211 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18212}
18213
18214static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
18215 signed long long __offset,
18216 double *__ptr) {
18217 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18218}
18219
18220#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18221 defined(__SIZEOF_INT128__)
18222static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
18223 signed long long __offset,
18224 signed __int128 *__ptr) {
18225 vec_xst(__vec, __offset, __ptr);
18226}
18227
18228static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
18229 signed long long __offset,
18230 unsigned __int128 *__ptr) {
18231 vec_xst(__vec, __offset, __ptr);
18232}
18233#endif
18234#endif // VSX
18235#else // ! __LITTLE_ENDIAN__
18236#define vec_xst_be vec_xst
18237#endif
18238
18239#ifdef __POWER9_VECTOR__
18240#define vec_test_data_class(__a, __b) \
18241 _Generic( \
18242 (__a), vector float \
18243 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
18244 vector double \
18245 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
18246 (__b)))
18247
18248#endif /* #ifdef __POWER9_VECTOR__ */
18249
18250static vector float __ATTRS_o_ai vec_neg(vector float __a) {
18251 return -__a;
18252}
18253
18254#ifdef __VSX__
18255static vector double __ATTRS_o_ai vec_neg(vector double __a) {
18256 return -__a;
18257}
18258
18259#endif
18260
18261#ifdef __VSX__
18262static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
18263 return -__a;
18264}
18265#endif
18266
18267static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
18268 return -__a;
18269}
18270
18271static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
18272 return -__a;
18273}
18274
18275static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
18276 return -__a;
18277}
18278
18279static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
18280 return - vec_abs(__a);
18281}
18282
18283#ifdef __VSX__
18284static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
18285 return - vec_abs(__a);
18286}
18287
18288#endif
18289
18290#ifdef __POWER8_VECTOR__
18291static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
18292 return __builtin_altivec_vminsd(__a, -__a);
18293}
18294#endif
18295
18296static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
18297 return __builtin_altivec_vminsw(__a, -__a);
18298}
18299
18300static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
18301 return __builtin_altivec_vminsh(__a, -__a);
18302}
18303
18304static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
18305 return __builtin_altivec_vminsb(__a, -__a);
18306}
18307
18308static vector float __ATTRS_o_ai vec_recipdiv(vector float __a,
18309 vector float __b) {
18310 return __builtin_ppc_recipdivf(__a, __b);
18311}
18312
18313#ifdef __VSX__
18314static vector double __ATTRS_o_ai vec_recipdiv(vector double __a,
18315 vector double __b) {
18316 return __builtin_ppc_recipdivd(__a, __b);
18317}
18318#endif
18319
18320#ifdef __POWER10_VECTOR__
18321
18322/* vec_extractm */
18323
18324static __inline__ unsigned int __ATTRS_o_ai
18325vec_extractm(vector unsigned char __a) {
18326 return __builtin_altivec_vextractbm(__a);
18327}
18328
18329static __inline__ unsigned int __ATTRS_o_ai
18330vec_extractm(vector unsigned short __a) {
18331 return __builtin_altivec_vextracthm(__a);
18332}
18333
18334static __inline__ unsigned int __ATTRS_o_ai
18335vec_extractm(vector unsigned int __a) {
18336 return __builtin_altivec_vextractwm(__a);
18337}
18338
18339static __inline__ unsigned int __ATTRS_o_ai
18340vec_extractm(vector unsigned long long __a) {
18341 return __builtin_altivec_vextractdm(__a);
18342}
18343
18344#ifdef __SIZEOF_INT128__
18345static __inline__ unsigned int __ATTRS_o_ai
18346vec_extractm(vector unsigned __int128 __a) {
18347 return __builtin_altivec_vextractqm(__a);
18348}
18349#endif
18350
18351/* vec_expandm */
18352
18353static __inline__ vector unsigned char __ATTRS_o_ai
18354vec_expandm(vector unsigned char __a) {
18355 return __builtin_altivec_vexpandbm(__a);
18356}
18357
18358static __inline__ vector unsigned short __ATTRS_o_ai
18359vec_expandm(vector unsigned short __a) {
18360 return __builtin_altivec_vexpandhm(__a);
18361}
18362
18363static __inline__ vector unsigned int __ATTRS_o_ai
18364vec_expandm(vector unsigned int __a) {
18365 return __builtin_altivec_vexpandwm(__a);
18366}
18367
18368static __inline__ vector unsigned long long __ATTRS_o_ai
18369vec_expandm(vector unsigned long long __a) {
18370 return __builtin_altivec_vexpanddm(__a);
18371}
18372
18373#ifdef __SIZEOF_INT128__
18374static __inline__ vector unsigned __int128 __ATTRS_o_ai
18375vec_expandm(vector unsigned __int128 __a) {
18376 return __builtin_altivec_vexpandqm(__a);
18377}
18378#endif
18379
18380/* vec_cntm */
18381
18382#define vec_cntm(__a, __mp) \
18383 _Generic((__a), vector unsigned char \
18384 : __builtin_altivec_vcntmbb((vector unsigned char)(__a), \
18385 (unsigned char)(__mp)), \
18386 vector unsigned short \
18387 : __builtin_altivec_vcntmbh((vector unsigned short)(__a), \
18388 (unsigned char)(__mp)), \
18389 vector unsigned int \
18390 : __builtin_altivec_vcntmbw((vector unsigned int)(__a), \
18391 (unsigned char)(__mp)), \
18392 vector unsigned long long \
18393 : __builtin_altivec_vcntmbd((vector unsigned long long)(__a), \
18394 (unsigned char)(__mp)))
18395
18396/* vec_gen[b|h|w|d|q]m */
18397
18398static __inline__ vector unsigned char __ATTRS_o_ai
18399vec_genbm(unsigned long long __bm) {
18400 return __builtin_altivec_mtvsrbm(__bm);
18401}
18402
18403static __inline__ vector unsigned short __ATTRS_o_ai
18404vec_genhm(unsigned long long __bm) {
18405 return __builtin_altivec_mtvsrhm(__bm);
18406}
18407
18408static __inline__ vector unsigned int __ATTRS_o_ai
18409vec_genwm(unsigned long long __bm) {
18410 return __builtin_altivec_mtvsrwm(__bm);
18411}
18412
18413static __inline__ vector unsigned long long __ATTRS_o_ai
18414vec_gendm(unsigned long long __bm) {
18415 return __builtin_altivec_mtvsrdm(__bm);
18416}
18417
18418#ifdef __SIZEOF_INT128__
18419static __inline__ vector unsigned __int128 __ATTRS_o_ai
18420vec_genqm(unsigned long long __bm) {
18421 return __builtin_altivec_mtvsrqm(__bm);
18422}
18423#endif
18424
18425/* vec_pdep */
18426
18427static __inline__ vector unsigned long long __ATTRS_o_ai
18428vec_pdep(vector unsigned long long __a, vector unsigned long long __b) {
18429 return __builtin_altivec_vpdepd(__a, __b);
18430}
18431
18432/* vec_pext */
18433
18434static __inline__ vector unsigned long long __ATTRS_o_ai
18435vec_pext(vector unsigned long long __a, vector unsigned long long __b) {
18436 return __builtin_altivec_vpextd(__a, __b);
18437}
18438
18439/* vec_cfuge */
18440
18441static __inline__ vector unsigned long long __ATTRS_o_ai
18442vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) {
18443 return __builtin_altivec_vcfuged(__a, __b);
18444}
18445
18446/* vec_gnb */
18447
18448#define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b)
18449
18450/* vec_ternarylogic */
18451#ifdef __VSX__
18452#ifdef __SIZEOF_INT128__
18453#define vec_ternarylogic(__a, __b, __c, __imm) \
18454 _Generic((__a), vector unsigned char \
18455 : (vector unsigned char)__builtin_vsx_xxeval( \
18456 (vector unsigned long long)(__a), \
18457 (vector unsigned long long)(__b), \
18458 (vector unsigned long long)(__c), (__imm)), \
18459 vector unsigned short \
18460 : (vector unsigned short)__builtin_vsx_xxeval( \
18461 (vector unsigned long long)(__a), \
18462 (vector unsigned long long)(__b), \
18463 (vector unsigned long long)(__c), (__imm)), \
18464 vector unsigned int \
18465 : (vector unsigned int)__builtin_vsx_xxeval( \
18466 (vector unsigned long long)(__a), \
18467 (vector unsigned long long)(__b), \
18468 (vector unsigned long long)(__c), (__imm)), \
18469 vector unsigned long long \
18470 : (vector unsigned long long)__builtin_vsx_xxeval( \
18471 (vector unsigned long long)(__a), \
18472 (vector unsigned long long)(__b), \
18473 (vector unsigned long long)(__c), (__imm)), \
18474 vector unsigned __int128 \
18475 : (vector unsigned __int128)__builtin_vsx_xxeval( \
18476 (vector unsigned long long)(__a), \
18477 (vector unsigned long long)(__b), \
18478 (vector unsigned long long)(__c), (__imm)))
18479#else
18480#define vec_ternarylogic(__a, __b, __c, __imm) \
18481 _Generic((__a), vector unsigned char \
18482 : (vector unsigned char)__builtin_vsx_xxeval( \
18483 (vector unsigned long long)(__a), \
18484 (vector unsigned long long)(__b), \
18485 (vector unsigned long long)(__c), (__imm)), \
18486 vector unsigned short \
18487 : (vector unsigned short)__builtin_vsx_xxeval( \
18488 (vector unsigned long long)(__a), \
18489 (vector unsigned long long)(__b), \
18490 (vector unsigned long long)(__c), (__imm)), \
18491 vector unsigned int \
18492 : (vector unsigned int)__builtin_vsx_xxeval( \
18493 (vector unsigned long long)(__a), \
18494 (vector unsigned long long)(__b), \
18495 (vector unsigned long long)(__c), (__imm)), \
18496 vector unsigned long long \
18497 : (vector unsigned long long)__builtin_vsx_xxeval( \
18498 (vector unsigned long long)(__a), \
18499 (vector unsigned long long)(__b), \
18500 (vector unsigned long long)(__c), (__imm)))
18501#endif /* __SIZEOF_INT128__ */
18502#endif /* __VSX__ */
18503
18504/* vec_genpcvm */
18505
18506#ifdef __VSX__
18507#define vec_genpcvm(__a, __imm) \
18508 _Generic( \
18509 (__a), vector unsigned char \
18510 : __builtin_vsx_xxgenpcvbm((vector unsigned char)(__a), (int)(__imm)), \
18511 vector unsigned short \
18512 : __builtin_vsx_xxgenpcvhm((vector unsigned short)(__a), (int)(__imm)), \
18513 vector unsigned int \
18514 : __builtin_vsx_xxgenpcvwm((vector unsigned int)(__a), (int)(__imm)), \
18515 vector unsigned long long \
18516 : __builtin_vsx_xxgenpcvdm((vector unsigned long long)(__a), \
18517 (int)(__imm)))
18518#endif /* __VSX__ */
18519
18520/* vec_clr_first */
18521
18522static __inline__ vector signed char __ATTRS_o_ai
18523vec_clr_first(vector signed char __a, unsigned int __n) {
18524#ifdef __LITTLE_ENDIAN__
18525 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18526 __n);
18527#else
18528 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18529 __n);
18530#endif
18531}
18532
18533static __inline__ vector unsigned char __ATTRS_o_ai
18534vec_clr_first(vector unsigned char __a, unsigned int __n) {
18535#ifdef __LITTLE_ENDIAN__
18536 return (vector unsigned char)__builtin_altivec_vclrrb(
18537 (vector unsigned char)__a, __n);
18538#else
18539 return (vector unsigned char)__builtin_altivec_vclrlb(
18540 (vector unsigned char)__a, __n);
18541#endif
18542}
18543
18544/* vec_clr_last */
18545
18546static __inline__ vector signed char __ATTRS_o_ai
18547vec_clr_last(vector signed char __a, unsigned int __n) {
18548#ifdef __LITTLE_ENDIAN__
18549 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18550 __n);
18551#else
18552 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18553 __n);
18554#endif
18555}
18556
18557static __inline__ vector unsigned char __ATTRS_o_ai
18558vec_clr_last(vector unsigned char __a, unsigned int __n) {
18559#ifdef __LITTLE_ENDIAN__
18560 return (vector unsigned char)__builtin_altivec_vclrlb(
18561 (vector unsigned char)__a, __n);
18562#else
18563 return (vector unsigned char)__builtin_altivec_vclrrb(
18564 (vector unsigned char)__a, __n);
18565#endif
18566}
18567
18568/* vec_cntlzm */
18569
18570static __inline__ vector unsigned long long __ATTRS_o_ai
18571vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) {
18572 return __builtin_altivec_vclzdm(__a, __b);
18573}
18574
18575/* vec_cnttzm */
18576
18577static __inline__ vector unsigned long long __ATTRS_o_ai
18578vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) {
18579 return __builtin_altivec_vctzdm(__a, __b);
18580}
18581
18582/* vec_mod */
18583
18584static __inline__ vector signed int __ATTRS_o_ai
18585vec_mod(vector signed int __a, vector