clang 20.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 __VSX__
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/* vec_mulo */
6408
6409static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
6410 vector signed char __b) {
6411#ifdef __LITTLE_ENDIAN__
6412 return __builtin_altivec_vmulesb(__a, __b);
6413#else
6414 return __builtin_altivec_vmulosb(__a, __b);
6415#endif
6416}
6417
6418static __inline__ vector unsigned short __ATTRS_o_ai
6419vec_mulo(vector unsigned char __a, vector unsigned char __b) {
6420#ifdef __LITTLE_ENDIAN__
6421 return __builtin_altivec_vmuleub(__a, __b);
6422#else
6423 return __builtin_altivec_vmuloub(__a, __b);
6424#endif
6425}
6426
6427static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
6428 vector short __b) {
6429#ifdef __LITTLE_ENDIAN__
6430 return __builtin_altivec_vmulesh(__a, __b);
6431#else
6432 return __builtin_altivec_vmulosh(__a, __b);
6433#endif
6434}
6435
6436static __inline__ vector unsigned int __ATTRS_o_ai
6437vec_mulo(vector unsigned short __a, vector unsigned short __b) {
6438#ifdef __LITTLE_ENDIAN__
6439 return __builtin_altivec_vmuleuh(__a, __b);
6440#else
6441 return __builtin_altivec_vmulouh(__a, __b);
6442#endif
6443}
6444
6445#ifdef __POWER8_VECTOR__
6446static __inline__ vector signed long long __ATTRS_o_ai
6447vec_mulo(vector signed int __a, vector signed int __b) {
6448#ifdef __LITTLE_ENDIAN__
6449 return __builtin_altivec_vmulesw(__a, __b);
6450#else
6451 return __builtin_altivec_vmulosw(__a, __b);
6452#endif
6453}
6454
6455static __inline__ vector unsigned long long __ATTRS_o_ai
6456vec_mulo(vector unsigned int __a, vector unsigned int __b) {
6457#ifdef __LITTLE_ENDIAN__
6458 return __builtin_altivec_vmuleuw(__a, __b);
6459#else
6460 return __builtin_altivec_vmulouw(__a, __b);
6461#endif
6462}
6463#endif
6464
6465#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6466static __inline__ vector signed __int128 __ATTRS_o_ai
6467vec_mulo(vector signed long long __a, vector signed long long __b) {
6468#ifdef __LITTLE_ENDIAN__
6469 return __builtin_altivec_vmulesd(__a, __b);
6470#else
6471 return __builtin_altivec_vmulosd(__a, __b);
6472#endif
6473}
6474
6475static __inline__ vector unsigned __int128 __ATTRS_o_ai
6476vec_mulo(vector unsigned long long __a, vector unsigned long long __b) {
6477#ifdef __LITTLE_ENDIAN__
6478 return __builtin_altivec_vmuleud(__a, __b);
6479#else
6480 return __builtin_altivec_vmuloud(__a, __b);
6481#endif
6482}
6483#endif
6484
6485/* vec_vmulosb */
6486
6487static __inline__ vector short __attribute__((__always_inline__))
6488vec_vmulosb(vector signed char __a, vector signed char __b) {
6489#ifdef __LITTLE_ENDIAN__
6490 return __builtin_altivec_vmulesb(__a, __b);
6491#else
6492 return __builtin_altivec_vmulosb(__a, __b);
6493#endif
6494}
6495
6496/* vec_vmuloub */
6497
6498static __inline__ vector unsigned short __attribute__((__always_inline__))
6499vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
6500#ifdef __LITTLE_ENDIAN__
6501 return __builtin_altivec_vmuleub(__a, __b);
6502#else
6503 return __builtin_altivec_vmuloub(__a, __b);
6504#endif
6505}
6506
6507/* vec_vmulosh */
6508
6509static __inline__ vector int __attribute__((__always_inline__))
6510vec_vmulosh(vector short __a, vector short __b) {
6511#ifdef __LITTLE_ENDIAN__
6512 return __builtin_altivec_vmulesh(__a, __b);
6513#else
6514 return __builtin_altivec_vmulosh(__a, __b);
6515#endif
6516}
6517
6518/* vec_vmulouh */
6519
6520static __inline__ vector unsigned int __attribute__((__always_inline__))
6521vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
6522#ifdef __LITTLE_ENDIAN__
6523 return __builtin_altivec_vmuleuh(__a, __b);
6524#else
6525 return __builtin_altivec_vmulouh(__a, __b);
6526#endif
6527}
6528
6529/* vec_nand */
6530
6531#ifdef __POWER8_VECTOR__
6532static __inline__ vector signed char __ATTRS_o_ai
6533vec_nand(vector signed char __a, vector signed char __b) {
6534 return ~(__a & __b);
6535}
6536
6537static __inline__ vector signed char __ATTRS_o_ai
6538vec_nand(vector signed char __a, vector bool char __b) {
6539 return ~(__a & (vector signed char)__b);
6540}
6541
6542static __inline__ vector signed char __ATTRS_o_ai
6543vec_nand(vector bool char __a, vector signed char __b) {
6544 return (vector signed char)~(__a & (vector bool char)__b);
6545}
6546
6547static __inline__ vector unsigned char __ATTRS_o_ai
6548vec_nand(vector unsigned char __a, vector unsigned char __b) {
6549 return ~(__a & __b);
6550}
6551
6552static __inline__ vector unsigned char __ATTRS_o_ai
6553vec_nand(vector unsigned char __a, vector bool char __b) {
6554 return ~(__a & (vector unsigned char)__b);
6555}
6556
6557static __inline__ vector unsigned char __ATTRS_o_ai
6558vec_nand(vector bool char __a, vector unsigned char __b) {
6559 return (vector unsigned char)~(__a & (vector bool char)__b);
6560}
6561
6562static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
6563 vector bool char __b) {
6564 return ~(__a & __b);
6565}
6566
6567static __inline__ vector signed short __ATTRS_o_ai
6568vec_nand(vector signed short __a, vector signed short __b) {
6569 return ~(__a & __b);
6570}
6571
6572static __inline__ vector signed short __ATTRS_o_ai
6573vec_nand(vector signed short __a, vector bool short __b) {
6574 return ~(__a & (vector signed short)__b);
6575}
6576
6577static __inline__ vector signed short __ATTRS_o_ai
6578vec_nand(vector bool short __a, vector signed short __b) {
6579 return (vector signed short)~(__a & (vector bool short)__b);
6580}
6581
6582static __inline__ vector unsigned short __ATTRS_o_ai
6583vec_nand(vector unsigned short __a, vector unsigned short __b) {
6584 return ~(__a & __b);
6585}
6586
6587static __inline__ vector unsigned short __ATTRS_o_ai
6588vec_nand(vector unsigned short __a, vector bool short __b) {
6589 return ~(__a & (vector unsigned short)__b);
6590}
6591
6592static __inline__ vector bool short __ATTRS_o_ai
6593vec_nand(vector bool short __a, vector bool short __b) {
6594 return ~(__a & __b);
6595}
6596
6597static __inline__ vector signed int __ATTRS_o_ai
6598vec_nand(vector signed int __a, vector signed int __b) {
6599 return ~(__a & __b);
6600}
6601
6602static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
6603 vector bool int __b) {
6604 return ~(__a & (vector signed int)__b);
6605}
6606
6607static __inline__ vector signed int __ATTRS_o_ai
6608vec_nand(vector bool int __a, vector signed int __b) {
6609 return (vector signed int)~(__a & (vector bool int)__b);
6610}
6611
6612static __inline__ vector unsigned int __ATTRS_o_ai
6613vec_nand(vector unsigned int __a, vector unsigned int __b) {
6614 return ~(__a & __b);
6615}
6616
6617static __inline__ vector unsigned int __ATTRS_o_ai
6618vec_nand(vector unsigned int __a, vector bool int __b) {
6619 return ~(__a & (vector unsigned int)__b);
6620}
6621
6622static __inline__ vector unsigned int __ATTRS_o_ai
6623vec_nand(vector bool int __a, vector unsigned int __b) {
6624 return (vector unsigned int)~(__a & (vector bool int)__b);
6625}
6626
6627static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
6628 vector bool int __b) {
6629 return ~(__a & __b);
6630}
6631
6632static __inline__ vector float __ATTRS_o_ai
6633vec_nand(vector float __a, vector float __b) {
6634 return (vector float)(~((vector unsigned int)__a &
6635 (vector unsigned int)__b));
6636}
6637
6638static __inline__ vector signed long long __ATTRS_o_ai
6639vec_nand(vector signed long long __a, vector signed long long __b) {
6640 return ~(__a & __b);
6641}
6642
6643static __inline__ vector signed long long __ATTRS_o_ai
6644vec_nand(vector signed long long __a, vector bool long long __b) {
6645 return ~(__a & (vector signed long long)__b);
6646}
6647
6648static __inline__ vector signed long long __ATTRS_o_ai
6649vec_nand(vector bool long long __a, vector signed long long __b) {
6650 return (vector signed long long)~(__a & (vector bool long long)__b);
6651}
6652
6653static __inline__ vector unsigned long long __ATTRS_o_ai
6654vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
6655 return ~(__a & __b);
6656}
6657
6658static __inline__ vector unsigned long long __ATTRS_o_ai
6659vec_nand(vector unsigned long long __a, vector bool long long __b) {
6660 return ~(__a & (vector unsigned long long)__b);
6661}
6662
6663static __inline__ vector unsigned long long __ATTRS_o_ai
6664vec_nand(vector bool long long __a, vector unsigned long long __b) {
6665 return (vector unsigned long long)~(__a & (vector bool long long)__b);
6666}
6667
6668static __inline__ vector bool long long __ATTRS_o_ai
6669vec_nand(vector bool long long __a, vector bool long long __b) {
6670 return ~(__a & __b);
6671}
6672
6673static __inline__ vector double __ATTRS_o_ai
6674vec_nand(vector double __a, vector double __b) {
6675 return (vector double)(~((vector unsigned long long)__a &
6676 (vector unsigned long long)__b));
6677}
6678
6679#endif
6680
6681/* vec_nmadd */
6682
6683#ifdef __VSX__
6684static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6685 vector float __b,
6686 vector float __c) {
6687 return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6688}
6689
6690static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6691 vector double __b,
6692 vector double __c) {
6693 return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6694}
6695#endif
6696
6697/* vec_nmsub */
6698
6699static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6700 vector float __b,
6701 vector float __c) {
6702#ifdef __VSX__
6703 return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6704#else
6705 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6706#endif
6707}
6708
6709#ifdef __VSX__
6710static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6711 vector double __b,
6712 vector double __c) {
6713 return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6714}
6715#endif
6716
6717/* vec_vnmsubfp */
6718
6719static __inline__ vector float __attribute__((__always_inline__))
6720vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6721 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6722}
6723
6724/* vec_nor */
6725
6726#define __builtin_altivec_vnor vec_nor
6727
6728static __inline__ vector signed char __ATTRS_o_ai
6729vec_nor(vector signed char __a, vector signed char __b) {
6730 return ~(__a | __b);
6731}
6732
6733static __inline__ vector unsigned char __ATTRS_o_ai
6734vec_nor(vector unsigned char __a, vector unsigned char __b) {
6735 return ~(__a | __b);
6736}
6737
6738static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6739 vector bool char __b) {
6740 return ~(__a | __b);
6741}
6742
6743static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6744 vector short __b) {
6745 return ~(__a | __b);
6746}
6747
6748static __inline__ vector unsigned short __ATTRS_o_ai
6749vec_nor(vector unsigned short __a, vector unsigned short __b) {
6750 return ~(__a | __b);
6751}
6752
6753static __inline__ vector bool short __ATTRS_o_ai
6754vec_nor(vector bool short __a, vector bool short __b) {
6755 return ~(__a | __b);
6756}
6757
6758static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6759 vector int __b) {
6760 return ~(__a | __b);
6761}
6762
6763static __inline__ vector unsigned int __ATTRS_o_ai
6764vec_nor(vector unsigned int __a, vector unsigned int __b) {
6765 return ~(__a | __b);
6766}
6767
6768static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6769 vector bool int __b) {
6770 return ~(__a | __b);
6771}
6772
6773static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6774 vector float __b) {
6775 vector unsigned int __res =
6776 ~((vector unsigned int)__a | (vector unsigned int)__b);
6777 return (vector float)__res;
6778}
6779
6780#ifdef __VSX__
6781static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6782 vector double __b) {
6783 vector unsigned long long __res =
6784 ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6785 return (vector double)__res;
6786}
6787#endif
6788
6789/* vec_vnor */
6790
6791static __inline__ vector signed char __ATTRS_o_ai
6792vec_vnor(vector signed char __a, vector signed char __b) {
6793 return ~(__a | __b);
6794}
6795
6796static __inline__ vector unsigned char __ATTRS_o_ai
6797vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6798 return ~(__a | __b);
6799}
6800
6801static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6802 vector bool char __b) {
6803 return ~(__a | __b);
6804}
6805
6806static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6807 vector short __b) {
6808 return ~(__a | __b);
6809}
6810
6811static __inline__ vector unsigned short __ATTRS_o_ai
6812vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6813 return ~(__a | __b);
6814}
6815
6816static __inline__ vector bool short __ATTRS_o_ai
6817vec_vnor(vector bool short __a, vector bool short __b) {
6818 return ~(__a | __b);
6819}
6820
6821static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6822 vector int __b) {
6823 return ~(__a | __b);
6824}
6825
6826static __inline__ vector unsigned int __ATTRS_o_ai
6827vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6828 return ~(__a | __b);
6829}
6830
6831static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6832 vector bool int __b) {
6833 return ~(__a | __b);
6834}
6835
6836static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6837 vector float __b) {
6838 vector unsigned int __res =
6839 ~((vector unsigned int)__a | (vector unsigned int)__b);
6840 return (vector float)__res;
6841}
6842
6843#ifdef __VSX__
6844static __inline__ vector signed long long __ATTRS_o_ai
6845vec_nor(vector signed long long __a, vector signed long long __b) {
6846 return ~(__a | __b);
6847}
6848
6849static __inline__ vector unsigned long long __ATTRS_o_ai
6850vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6851 return ~(__a | __b);
6852}
6853
6854static __inline__ vector bool long long __ATTRS_o_ai
6855vec_nor(vector bool long long __a, vector bool long long __b) {
6856 return ~(__a | __b);
6857}
6858#endif
6859
6860/* vec_or */
6861
6862#define __builtin_altivec_vor vec_or
6863
6864static __inline__ vector signed char __ATTRS_o_ai
6865vec_or(vector signed char __a, vector signed char __b) {
6866 return __a | __b;
6867}
6868
6869static __inline__ vector signed char __ATTRS_o_ai
6870vec_or(vector bool char __a, vector signed char __b) {
6871 return (vector signed char)__a | __b;
6872}
6873
6874static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6875 vector bool char __b) {
6876 return __a | (vector signed char)__b;
6877}
6878
6879static __inline__ vector unsigned char __ATTRS_o_ai
6880vec_or(vector unsigned char __a, vector unsigned char __b) {
6881 return __a | __b;
6882}
6883
6884static __inline__ vector unsigned char __ATTRS_o_ai
6885vec_or(vector bool char __a, vector unsigned char __b) {
6886 return (vector unsigned char)__a | __b;
6887}
6888
6889static __inline__ vector unsigned char __ATTRS_o_ai
6890vec_or(vector unsigned char __a, vector bool char __b) {
6891 return __a | (vector unsigned char)__b;
6892}
6893
6894static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6895 vector bool char __b) {
6896 return __a | __b;
6897}
6898
6899static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6900 vector short __b) {
6901 return __a | __b;
6902}
6903
6904static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6905 vector short __b) {
6906 return (vector short)__a | __b;
6907}
6908
6909static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6910 vector bool short __b) {
6911 return __a | (vector short)__b;
6912}
6913
6914static __inline__ vector unsigned short __ATTRS_o_ai
6915vec_or(vector unsigned short __a, vector unsigned short __b) {
6916 return __a | __b;
6917}
6918
6919static __inline__ vector unsigned short __ATTRS_o_ai
6920vec_or(vector bool short __a, vector unsigned short __b) {
6921 return (vector unsigned short)__a | __b;
6922}
6923
6924static __inline__ vector unsigned short __ATTRS_o_ai
6925vec_or(vector unsigned short __a, vector bool short __b) {
6926 return __a | (vector unsigned short)__b;
6927}
6928
6929static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6930 vector bool short __b) {
6931 return __a | __b;
6932}
6933
6934static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6935 vector int __b) {
6936 return __a | __b;
6937}
6938
6939static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6940 vector int __b) {
6941 return (vector int)__a | __b;
6942}
6943
6944static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6945 vector bool int __b) {
6946 return __a | (vector int)__b;
6947}
6948
6949static __inline__ vector unsigned int __ATTRS_o_ai
6950vec_or(vector unsigned int __a, vector unsigned int __b) {
6951 return __a | __b;
6952}
6953
6954static __inline__ vector unsigned int __ATTRS_o_ai
6955vec_or(vector bool int __a, vector unsigned int __b) {
6956 return (vector unsigned int)__a | __b;
6957}
6958
6959static __inline__ vector unsigned int __ATTRS_o_ai
6960vec_or(vector unsigned int __a, vector bool int __b) {
6961 return __a | (vector unsigned int)__b;
6962}
6963
6964static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6965 vector bool int __b) {
6966 return __a | __b;
6967}
6968
6969static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6970 vector float __b) {
6971 vector unsigned int __res =
6972 (vector unsigned int)__a | (vector unsigned int)__b;
6973 return (vector float)__res;
6974}
6975
6976static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6977 vector float __b) {
6978 vector unsigned int __res =
6979 (vector unsigned int)__a | (vector unsigned int)__b;
6980 return (vector float)__res;
6981}
6982
6983static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6984 vector bool int __b) {
6985 vector unsigned int __res =
6986 (vector unsigned int)__a | (vector unsigned int)__b;
6987 return (vector float)__res;
6988}
6989
6990#ifdef __VSX__
6991static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6992 vector double __b) {
6993 return (vector double)((vector unsigned long long)__a |
6994 (vector unsigned long long)__b);
6995}
6996
6997static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6998 vector bool long long __b) {
6999 return (vector double)((vector unsigned long long)__a |
7000 (vector unsigned long long)__b);
7001}
7002
7003static __inline__ vector double __ATTRS_o_ai vec_or(vector double __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 signed long long __ATTRS_o_ai
7010vec_or(vector signed long long __a, vector signed long long __b) {
7011 return __a | __b;
7012}
7013
7014static __inline__ vector signed long long __ATTRS_o_ai
7015vec_or(vector bool long long __a, vector signed long long __b) {
7016 return (vector signed long long)__a | __b;
7017}
7018
7019static __inline__ vector signed long long __ATTRS_o_ai
7020vec_or(vector signed long long __a, vector bool long long __b) {
7021 return __a | (vector signed long long)__b;
7022}
7023
7024static __inline__ vector unsigned long long __ATTRS_o_ai
7025vec_or(vector unsigned long long __a, vector unsigned long long __b) {
7026 return __a | __b;
7027}
7028
7029static __inline__ vector unsigned long long __ATTRS_o_ai
7030vec_or(vector bool long long __a, vector unsigned long long __b) {
7031 return (vector unsigned long long)__a | __b;
7032}
7033
7034static __inline__ vector unsigned long long __ATTRS_o_ai
7035vec_or(vector unsigned long long __a, vector bool long long __b) {
7036 return __a | (vector unsigned long long)__b;
7037}
7038
7039static __inline__ vector bool long long __ATTRS_o_ai
7040vec_or(vector bool long long __a, vector bool long long __b) {
7041 return __a | __b;
7042}
7043#endif
7044
7045#ifdef __POWER8_VECTOR__
7046static __inline__ vector signed char __ATTRS_o_ai
7047vec_orc(vector signed char __a, vector signed char __b) {
7048 return __a | ~__b;
7049}
7050
7051static __inline__ vector signed char __ATTRS_o_ai
7052vec_orc(vector signed char __a, vector bool char __b) {
7053 return __a | (vector signed char)~__b;
7054}
7055
7056static __inline__ vector signed char __ATTRS_o_ai
7057vec_orc(vector bool char __a, vector signed char __b) {
7058 return (vector signed char)(__a | (vector bool char)~__b);
7059}
7060
7061static __inline__ vector unsigned char __ATTRS_o_ai
7062vec_orc(vector unsigned char __a, vector unsigned char __b) {
7063 return __a | ~__b;
7064}
7065
7066static __inline__ vector unsigned char __ATTRS_o_ai
7067vec_orc(vector unsigned char __a, vector bool char __b) {
7068 return __a | (vector unsigned char)~__b;
7069}
7070
7071static __inline__ vector unsigned char __ATTRS_o_ai
7072vec_orc(vector bool char __a, vector unsigned char __b) {
7073 return (vector unsigned char)(__a | (vector bool char)~__b);
7074}
7075
7076static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
7077 vector bool char __b) {
7078 return __a | ~__b;
7079}
7080
7081static __inline__ vector signed short __ATTRS_o_ai
7082vec_orc(vector signed short __a, vector signed short __b) {
7083 return __a | ~__b;
7084}
7085
7086static __inline__ vector signed short __ATTRS_o_ai
7087vec_orc(vector signed short __a, vector bool short __b) {
7088 return __a | (vector signed short)~__b;
7089}
7090
7091static __inline__ vector signed short __ATTRS_o_ai
7092vec_orc(vector bool short __a, vector signed short __b) {
7093 return (vector signed short)(__a | (vector bool short)~__b);
7094}
7095
7096static __inline__ vector unsigned short __ATTRS_o_ai
7097vec_orc(vector unsigned short __a, vector unsigned short __b) {
7098 return __a | ~__b;
7099}
7100
7101static __inline__ vector unsigned short __ATTRS_o_ai
7102vec_orc(vector unsigned short __a, vector bool short __b) {
7103 return __a | (vector unsigned short)~__b;
7104}
7105
7106static __inline__ vector unsigned short __ATTRS_o_ai
7107vec_orc(vector bool short __a, vector unsigned short __b) {
7108 return (vector unsigned short)(__a | (vector bool short)~__b);
7109}
7110
7111static __inline__ vector bool short __ATTRS_o_ai
7112vec_orc(vector bool short __a, vector bool short __b) {
7113 return __a | ~__b;
7114}
7115
7116static __inline__ vector signed int __ATTRS_o_ai
7117vec_orc(vector signed int __a, vector signed int __b) {
7118 return __a | ~__b;
7119}
7120
7121static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
7122 vector bool int __b) {
7123 return __a | (vector signed int)~__b;
7124}
7125
7126static __inline__ vector signed int __ATTRS_o_ai
7127vec_orc(vector bool int __a, vector signed int __b) {
7128 return (vector signed int)(__a | (vector bool int)~__b);
7129}
7130
7131static __inline__ vector unsigned int __ATTRS_o_ai
7132vec_orc(vector unsigned int __a, vector unsigned int __b) {
7133 return __a | ~__b;
7134}
7135
7136static __inline__ vector unsigned int __ATTRS_o_ai
7137vec_orc(vector unsigned int __a, vector bool int __b) {
7138 return __a | (vector unsigned int)~__b;
7139}
7140
7141static __inline__ vector unsigned int __ATTRS_o_ai
7142vec_orc(vector bool int __a, vector unsigned int __b) {
7143 return (vector unsigned int)(__a | (vector bool int)~__b);
7144}
7145
7146static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
7147 vector bool int __b) {
7148 return __a | ~__b;
7149}
7150
7151static __inline__ vector float __ATTRS_o_ai
7152vec_orc(vector bool int __a, vector float __b) {
7153 return (vector float)(__a | ~(vector bool int)__b);
7154}
7155
7156static __inline__ vector float __ATTRS_o_ai
7157vec_orc(vector float __a, vector bool int __b) {
7158 return (vector float)((vector bool int)__a | ~__b);
7159}
7160
7161static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a,
7162 vector float __b) {
7163 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b);
7164}
7165
7166static __inline__ vector signed long long __ATTRS_o_ai
7167vec_orc(vector signed long long __a, vector signed long long __b) {
7168 return __a | ~__b;
7169}
7170
7171static __inline__ vector signed long long __ATTRS_o_ai
7172vec_orc(vector signed long long __a, vector bool long long __b) {
7173 return __a | (vector signed long long)~__b;
7174}
7175
7176static __inline__ vector signed long long __ATTRS_o_ai
7177vec_orc(vector bool long long __a, vector signed long long __b) {
7178 return (vector signed long long)(__a | (vector bool long long)~__b);
7179}
7180
7181static __inline__ vector unsigned long long __ATTRS_o_ai
7182vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
7183 return __a | ~__b;
7184}
7185
7186static __inline__ vector unsigned long long __ATTRS_o_ai
7187vec_orc(vector unsigned long long __a, vector bool long long __b) {
7188 return __a | (vector unsigned long long)~__b;
7189}
7190
7191static __inline__ vector unsigned long long __ATTRS_o_ai
7192vec_orc(vector bool long long __a, vector unsigned long long __b) {
7193 return (vector unsigned long long)(__a | (vector bool long long)~__b);
7194}
7195
7196static __inline__ vector bool long long __ATTRS_o_ai
7197vec_orc(vector bool long long __a, vector bool long long __b) {
7198 return __a | ~__b;
7199}
7200
7201static __inline__ vector double __ATTRS_o_ai
7202vec_orc(vector double __a, vector bool long long __b) {
7203 return (vector double)((vector bool long long)__a | ~__b);
7204}
7205
7206static __inline__ vector double __ATTRS_o_ai
7207vec_orc(vector bool long long __a, vector double __b) {
7208 return (vector double)(__a | ~(vector bool long long)__b);
7209}
7210
7211static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a,
7212 vector double __b) {
7213 return (vector double)((vector unsigned long long)__a |
7214 ~(vector unsigned long long)__b);
7215}
7216#endif
7217
7218/* vec_vor */
7219
7220static __inline__ vector signed char __ATTRS_o_ai
7221vec_vor(vector signed char __a, vector signed char __b) {
7222 return __a | __b;
7223}
7224
7225static __inline__ vector signed char __ATTRS_o_ai
7226vec_vor(vector bool char __a, vector signed char __b) {
7227 return (vector signed char)__a | __b;
7228}
7229
7230static __inline__ vector signed char __ATTRS_o_ai
7231vec_vor(vector signed char __a, vector bool char __b) {
7232 return __a | (vector signed char)__b;
7233}
7234
7235static __inline__ vector unsigned char __ATTRS_o_ai
7236vec_vor(vector unsigned char __a, vector unsigned char __b) {
7237 return __a | __b;
7238}
7239
7240static __inline__ vector unsigned char __ATTRS_o_ai
7241vec_vor(vector bool char __a, vector unsigned char __b) {
7242 return (vector unsigned char)__a | __b;
7243}
7244
7245static __inline__ vector unsigned char __ATTRS_o_ai
7246vec_vor(vector unsigned char __a, vector bool char __b) {
7247 return __a | (vector unsigned char)__b;
7248}
7249
7250static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
7251 vector bool char __b) {
7252 return __a | __b;
7253}
7254
7255static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7256 vector short __b) {
7257 return __a | __b;
7258}
7259
7260static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
7261 vector short __b) {
7262 return (vector short)__a | __b;
7263}
7264
7265static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7266 vector bool short __b) {
7267 return __a | (vector short)__b;
7268}
7269
7270static __inline__ vector unsigned short __ATTRS_o_ai
7271vec_vor(vector unsigned short __a, vector unsigned short __b) {
7272 return __a | __b;
7273}
7274
7275static __inline__ vector unsigned short __ATTRS_o_ai
7276vec_vor(vector bool short __a, vector unsigned short __b) {
7277 return (vector unsigned short)__a | __b;
7278}
7279
7280static __inline__ vector unsigned short __ATTRS_o_ai
7281vec_vor(vector unsigned short __a, vector bool short __b) {
7282 return __a | (vector unsigned short)__b;
7283}
7284
7285static __inline__ vector bool short __ATTRS_o_ai
7286vec_vor(vector bool short __a, vector bool short __b) {
7287 return __a | __b;
7288}
7289
7290static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7291 vector int __b) {
7292 return __a | __b;
7293}
7294
7295static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
7296 vector int __b) {
7297 return (vector int)__a | __b;
7298}
7299
7300static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7301 vector bool int __b) {
7302 return __a | (vector int)__b;
7303}
7304
7305static __inline__ vector unsigned int __ATTRS_o_ai
7306vec_vor(vector unsigned int __a, vector unsigned int __b) {
7307 return __a | __b;
7308}
7309
7310static __inline__ vector unsigned int __ATTRS_o_ai
7311vec_vor(vector bool int __a, vector unsigned int __b) {
7312 return (vector unsigned int)__a | __b;
7313}
7314
7315static __inline__ vector unsigned int __ATTRS_o_ai
7316vec_vor(vector unsigned int __a, vector bool int __b) {
7317 return __a | (vector unsigned int)__b;
7318}
7319
7320static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
7321 vector bool int __b) {
7322 return __a | __b;
7323}
7324
7325static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7326 vector float __b) {
7327 vector unsigned int __res =
7328 (vector unsigned int)__a | (vector unsigned int)__b;
7329 return (vector float)__res;
7330}
7331
7332static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
7333 vector float __b) {
7334 vector unsigned int __res =
7335 (vector unsigned int)__a | (vector unsigned int)__b;
7336 return (vector float)__res;
7337}
7338
7339static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7340 vector bool int __b) {
7341 vector unsigned int __res =
7342 (vector unsigned int)__a | (vector unsigned int)__b;
7343 return (vector float)__res;
7344}
7345
7346#ifdef __VSX__
7347static __inline__ vector signed long long __ATTRS_o_ai
7348vec_vor(vector signed long long __a, vector signed long long __b) {
7349 return __a | __b;
7350}
7351
7352static __inline__ vector signed long long __ATTRS_o_ai
7353vec_vor(vector bool long long __a, vector signed long long __b) {
7354 return (vector signed long long)__a | __b;
7355}
7356
7357static __inline__ vector signed long long __ATTRS_o_ai
7358vec_vor(vector signed long long __a, vector bool long long __b) {
7359 return __a | (vector signed long long)__b;
7360}
7361
7362static __inline__ vector unsigned long long __ATTRS_o_ai
7363vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
7364 return __a | __b;
7365}
7366
7367static __inline__ vector unsigned long long __ATTRS_o_ai
7368vec_vor(vector bool long long __a, vector unsigned long long __b) {
7369 return (vector unsigned long long)__a | __b;
7370}
7371
7372static __inline__ vector unsigned long long __ATTRS_o_ai
7373vec_vor(vector unsigned long long __a, vector bool long long __b) {
7374 return __a | (vector unsigned long long)__b;
7375}
7376
7377static __inline__ vector bool long long __ATTRS_o_ai
7378vec_vor(vector bool long long __a, vector bool long long __b) {
7379 return __a | __b;
7380}
7381#endif
7382
7383/* vec_pack */
7384
7385/* The various vector pack instructions have a big-endian bias, so for
7386 little endian we must handle reversed element numbering. */
7387
7388static __inline__ vector signed char __ATTRS_o_ai
7389vec_pack(vector signed short __a, vector signed short __b) {
7390#ifdef __LITTLE_ENDIAN__
7391 return (vector signed char)vec_perm(
7392 __a, __b,
7393 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7394 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7395#else
7396 return (vector signed char)vec_perm(
7397 __a, __b,
7398 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7399 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7400#endif
7401}
7402
7403static __inline__ vector unsigned char __ATTRS_o_ai
7404vec_pack(vector unsigned short __a, vector unsigned short __b) {
7405#ifdef __LITTLE_ENDIAN__
7406 return (vector unsigned char)vec_perm(
7407 __a, __b,
7408 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7409 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7410#else
7411 return (vector unsigned char)vec_perm(
7412 __a, __b,
7413 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7414 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7415#endif
7416}
7417
7418static __inline__ vector bool char __ATTRS_o_ai
7419vec_pack(vector bool short __a, vector bool short __b) {
7420#ifdef __LITTLE_ENDIAN__
7421 return (vector bool char)vec_perm(
7422 __a, __b,
7423 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7424 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7425#else
7426 return (vector bool char)vec_perm(
7427 __a, __b,
7428 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7429 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7430#endif
7431}
7432
7433static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
7434 vector int __b) {
7435#ifdef __LITTLE_ENDIAN__
7436 return (vector short)vec_perm(
7437 __a, __b,
7438 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7439 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7440#else
7441 return (vector short)vec_perm(
7442 __a, __b,
7443 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7444 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7445#endif
7446}
7447
7448static __inline__ vector unsigned short __ATTRS_o_ai
7449vec_pack(vector unsigned int __a, vector unsigned int __b) {
7450#ifdef __LITTLE_ENDIAN__
7451 return (vector unsigned short)vec_perm(
7452 __a, __b,
7453 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7454 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7455#else
7456 return (vector unsigned short)vec_perm(
7457 __a, __b,
7458 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7459 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7460#endif
7461}
7462
7463static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
7464 vector bool int __b) {
7465#ifdef __LITTLE_ENDIAN__
7466 return (vector bool short)vec_perm(
7467 __a, __b,
7468 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7469 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7470#else
7471 return (vector bool short)vec_perm(
7472 __a, __b,
7473 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7474 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7475#endif
7476}
7477
7478#ifdef __VSX__
7479static __inline__ vector signed int __ATTRS_o_ai
7480vec_pack(vector signed long long __a, vector signed long long __b) {
7481#ifdef __LITTLE_ENDIAN__
7482 return (vector signed int)vec_perm(
7483 __a, __b,
7484 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7485 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7486#else
7487 return (vector signed int)vec_perm(
7488 __a, __b,
7489 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7490 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7491#endif
7492}
7493static __inline__ vector unsigned int __ATTRS_o_ai
7494vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
7495#ifdef __LITTLE_ENDIAN__
7496 return (vector unsigned int)vec_perm(
7497 __a, __b,
7498 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7499 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7500#else
7501 return (vector unsigned int)vec_perm(
7502 __a, __b,
7503 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7504 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7505#endif
7506}
7507
7508static __inline__ vector bool int __ATTRS_o_ai
7509vec_pack(vector bool long long __a, vector bool long long __b) {
7510#ifdef __LITTLE_ENDIAN__
7511 return (vector bool int)vec_perm(
7512 __a, __b,
7513 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7514 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7515#else
7516 return (vector bool int)vec_perm(
7517 __a, __b,
7518 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7519 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7520#endif
7521}
7522
7523static __inline__ vector float __ATTRS_o_ai
7524vec_pack(vector double __a, vector double __b) {
7525 return (vector float) (__a[0], __a[1], __b[0], __b[1]);
7526}
7527#endif
7528
7529#ifdef __POWER9_VECTOR__
7530static __inline__ vector unsigned short __ATTRS_o_ai
7531vec_pack_to_short_fp32(vector float __a, vector float __b) {
7532 vector float __resa = __builtin_vsx_xvcvsphp(__a);
7533 vector float __resb = __builtin_vsx_xvcvsphp(__b);
7534#ifdef __LITTLE_ENDIAN__
7535 return (vector unsigned short)vec_mergee(__resa, __resb);
7536#else
7537 return (vector unsigned short)vec_mergeo(__resa, __resb);
7538#endif
7539}
7540
7541#endif
7542/* vec_vpkuhum */
7543
7544#define __builtin_altivec_vpkuhum vec_vpkuhum
7545
7546static __inline__ vector signed char __ATTRS_o_ai
7547vec_vpkuhum(vector signed short __a, vector signed short __b) {
7548#ifdef __LITTLE_ENDIAN__
7549 return (vector signed char)vec_perm(
7550 __a, __b,
7551 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7552 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7553#else
7554 return (vector signed char)vec_perm(
7555 __a, __b,
7556 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7557 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7558#endif
7559}
7560
7561static __inline__ vector unsigned char __ATTRS_o_ai
7562vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
7563#ifdef __LITTLE_ENDIAN__
7564 return (vector unsigned char)vec_perm(
7565 __a, __b,
7566 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7567 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7568#else
7569 return (vector unsigned char)vec_perm(
7570 __a, __b,
7571 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7572 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7573#endif
7574}
7575
7576static __inline__ vector bool char __ATTRS_o_ai
7577vec_vpkuhum(vector bool short __a, vector bool short __b) {
7578#ifdef __LITTLE_ENDIAN__
7579 return (vector bool char)vec_perm(
7580 __a, __b,
7581 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7582 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7583#else
7584 return (vector bool char)vec_perm(
7585 __a, __b,
7586 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7587 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7588#endif
7589}
7590
7591/* vec_vpkuwum */
7592
7593#define __builtin_altivec_vpkuwum vec_vpkuwum
7594
7595static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
7596 vector int __b) {
7597#ifdef __LITTLE_ENDIAN__
7598 return (vector short)vec_perm(
7599 __a, __b,
7600 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7601 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7602#else
7603 return (vector short)vec_perm(
7604 __a, __b,
7605 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7606 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7607#endif
7608}
7609
7610static __inline__ vector unsigned short __ATTRS_o_ai
7611vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
7612#ifdef __LITTLE_ENDIAN__
7613 return (vector unsigned short)vec_perm(
7614 __a, __b,
7615 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7616 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7617#else
7618 return (vector unsigned short)vec_perm(
7619 __a, __b,
7620 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7621 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7622#endif
7623}
7624
7625static __inline__ vector bool short __ATTRS_o_ai
7626vec_vpkuwum(vector bool int __a, vector bool int __b) {
7627#ifdef __LITTLE_ENDIAN__
7628 return (vector bool short)vec_perm(
7629 __a, __b,
7630 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7631 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7632#else
7633 return (vector bool short)vec_perm(
7634 __a, __b,
7635 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7636 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7637#endif
7638}
7639
7640/* vec_vpkudum */
7641
7642#ifdef __POWER8_VECTOR__
7643#define __builtin_altivec_vpkudum vec_vpkudum
7644
7645static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
7646 vector long long __b) {
7647#ifdef __LITTLE_ENDIAN__
7648 return (vector int)vec_perm(
7649 __a, __b,
7650 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7651 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7652#else
7653 return (vector int)vec_perm(
7654 __a, __b,
7655 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7656 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7657#endif
7658}
7659
7660static __inline__ vector unsigned int __ATTRS_o_ai
7661vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
7662#ifdef __LITTLE_ENDIAN__
7663 return (vector unsigned int)vec_perm(
7664 __a, __b,
7665 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7666 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7667#else
7668 return (vector unsigned int)vec_perm(
7669 __a, __b,
7670 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7671 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7672#endif
7673}
7674
7675static __inline__ vector bool int __ATTRS_o_ai
7676vec_vpkudum(vector bool long long __a, vector bool long long __b) {
7677#ifdef __LITTLE_ENDIAN__
7678 return (vector bool int)vec_perm(
7679 (vector long long)__a, (vector long long)__b,
7680 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7681 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7682#else
7683 return (vector bool int)vec_perm(
7684 (vector long long)__a, (vector long long)__b,
7685 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7686 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7687#endif
7688}
7689#endif
7690
7691/* vec_packpx */
7692
7693static __inline__ vector pixel __attribute__((__always_inline__))
7694vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7695#ifdef __LITTLE_ENDIAN__
7696 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7697#else
7698 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7699#endif
7700}
7701
7702/* vec_vpkpx */
7703
7704static __inline__ vector pixel __attribute__((__always_inline__))
7705vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7706#ifdef __LITTLE_ENDIAN__
7707 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7708#else
7709 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7710#endif
7711}
7712
7713/* vec_packs */
7714
7715static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7716 vector short __b) {
7717#ifdef __LITTLE_ENDIAN__
7718 return __builtin_altivec_vpkshss(__b, __a);
7719#else
7720 return __builtin_altivec_vpkshss(__a, __b);
7721#endif
7722}
7723
7724static __inline__ vector unsigned char __ATTRS_o_ai
7725vec_packs(vector unsigned short __a, vector unsigned short __b) {
7726#ifdef __LITTLE_ENDIAN__
7727 return __builtin_altivec_vpkuhus(__b, __a);
7728#else
7729 return __builtin_altivec_vpkuhus(__a, __b);
7730#endif
7731}
7732
7733static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7734 vector int __b) {
7735#ifdef __LITTLE_ENDIAN__
7736 return __builtin_altivec_vpkswss(__b, __a);
7737#else
7738 return __builtin_altivec_vpkswss(__a, __b);
7739#endif
7740}
7741
7742static __inline__ vector unsigned short __ATTRS_o_ai
7743vec_packs(vector unsigned int __a, vector unsigned int __b) {
7744#ifdef __LITTLE_ENDIAN__
7745 return __builtin_altivec_vpkuwus(__b, __a);
7746#else
7747 return __builtin_altivec_vpkuwus(__a, __b);
7748#endif
7749}
7750
7751#ifdef __POWER8_VECTOR__
7752static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7753 vector long long __b) {
7754#ifdef __LITTLE_ENDIAN__
7755 return __builtin_altivec_vpksdss(__b, __a);
7756#else
7757 return __builtin_altivec_vpksdss(__a, __b);
7758#endif
7759}
7760
7761static __inline__ vector unsigned int __ATTRS_o_ai
7762vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7763#ifdef __LITTLE_ENDIAN__
7764 return __builtin_altivec_vpkudus(__b, __a);
7765#else
7766 return __builtin_altivec_vpkudus(__a, __b);
7767#endif
7768}
7769#endif
7770
7771/* vec_vpkshss */
7772
7773static __inline__ vector signed char __attribute__((__always_inline__))
7774vec_vpkshss(vector short __a, vector short __b) {
7775#ifdef __LITTLE_ENDIAN__
7776 return __builtin_altivec_vpkshss(__b, __a);
7777#else
7778 return __builtin_altivec_vpkshss(__a, __b);
7779#endif
7780}
7781
7782/* vec_vpksdss */
7783
7784#ifdef __POWER8_VECTOR__
7785static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7786 vector long long __b) {
7787#ifdef __LITTLE_ENDIAN__
7788 return __builtin_altivec_vpksdss(__b, __a);
7789#else
7790 return __builtin_altivec_vpksdss(__a, __b);
7791#endif
7792}
7793#endif
7794
7795/* vec_vpkuhus */
7796
7797static __inline__ vector unsigned char __attribute__((__always_inline__))
7798vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7799#ifdef __LITTLE_ENDIAN__
7800 return __builtin_altivec_vpkuhus(__b, __a);
7801#else
7802 return __builtin_altivec_vpkuhus(__a, __b);
7803#endif
7804}
7805
7806/* vec_vpkudus */
7807
7808#ifdef __POWER8_VECTOR__
7809static __inline__ vector unsigned int __attribute__((__always_inline__))
7810vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7811#ifdef __LITTLE_ENDIAN__
7812 return __builtin_altivec_vpkudus(__b, __a);
7813#else
7814 return __builtin_altivec_vpkudus(__a, __b);
7815#endif
7816}
7817#endif
7818
7819/* vec_vpkswss */
7820
7821static __inline__ vector signed short __attribute__((__always_inline__))
7822vec_vpkswss(vector int __a, vector int __b) {
7823#ifdef __LITTLE_ENDIAN__
7824 return __builtin_altivec_vpkswss(__b, __a);
7825#else
7826 return __builtin_altivec_vpkswss(__a, __b);
7827#endif
7828}
7829
7830/* vec_vpkuwus */
7831
7832static __inline__ vector unsigned short __attribute__((__always_inline__))
7833vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7834#ifdef __LITTLE_ENDIAN__
7835 return __builtin_altivec_vpkuwus(__b, __a);
7836#else
7837 return __builtin_altivec_vpkuwus(__a, __b);
7838#endif
7839}
7840
7841/* vec_packsu */
7842
7843static __inline__ vector unsigned char __ATTRS_o_ai
7844vec_packsu(vector short __a, vector short __b) {
7845#ifdef __LITTLE_ENDIAN__
7846 return __builtin_altivec_vpkshus(__b, __a);
7847#else
7848 return __builtin_altivec_vpkshus(__a, __b);
7849#endif
7850}
7851
7852static __inline__ vector unsigned char __ATTRS_o_ai
7853vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7854#ifdef __LITTLE_ENDIAN__
7855 return __builtin_altivec_vpkuhus(__b, __a);
7856#else
7857 return __builtin_altivec_vpkuhus(__a, __b);
7858#endif
7859}
7860
7861static __inline__ vector unsigned short __ATTRS_o_ai
7862vec_packsu(vector int __a, vector int __b) {
7863#ifdef __LITTLE_ENDIAN__
7864 return __builtin_altivec_vpkswus(__b, __a);
7865#else
7866 return __builtin_altivec_vpkswus(__a, __b);
7867#endif
7868}
7869
7870static __inline__ vector unsigned short __ATTRS_o_ai
7871vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7872#ifdef __LITTLE_ENDIAN__
7873 return __builtin_altivec_vpkuwus(__b, __a);
7874#else
7875 return __builtin_altivec_vpkuwus(__a, __b);
7876#endif
7877}
7878
7879#ifdef __POWER8_VECTOR__
7880static __inline__ vector unsigned int __ATTRS_o_ai
7881vec_packsu(vector long long __a, vector long long __b) {
7882#ifdef __LITTLE_ENDIAN__
7883 return __builtin_altivec_vpksdus(__b, __a);
7884#else
7885 return __builtin_altivec_vpksdus(__a, __b);
7886#endif
7887}
7888
7889static __inline__ vector unsigned int __ATTRS_o_ai
7890vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7891#ifdef __LITTLE_ENDIAN__
7892 return __builtin_altivec_vpkudus(__b, __a);
7893#else
7894 return __builtin_altivec_vpkudus(__a, __b);
7895#endif
7896}
7897#endif
7898
7899/* vec_vpkshus */
7900
7901static __inline__ vector unsigned char __ATTRS_o_ai
7902vec_vpkshus(vector short __a, vector short __b) {
7903#ifdef __LITTLE_ENDIAN__
7904 return __builtin_altivec_vpkshus(__b, __a);
7905#else
7906 return __builtin_altivec_vpkshus(__a, __b);
7907#endif
7908}
7909
7910static __inline__ vector unsigned char __ATTRS_o_ai
7911vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7912#ifdef __LITTLE_ENDIAN__
7913 return __builtin_altivec_vpkuhus(__b, __a);
7914#else
7915 return __builtin_altivec_vpkuhus(__a, __b);
7916#endif
7917}
7918
7919/* vec_vpkswus */
7920
7921static __inline__ vector unsigned short __ATTRS_o_ai
7922vec_vpkswus(vector int __a, vector int __b) {
7923#ifdef __LITTLE_ENDIAN__
7924 return __builtin_altivec_vpkswus(__b, __a);
7925#else
7926 return __builtin_altivec_vpkswus(__a, __b);
7927#endif
7928}
7929
7930static __inline__ vector unsigned short __ATTRS_o_ai
7931vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7932#ifdef __LITTLE_ENDIAN__
7933 return __builtin_altivec_vpkuwus(__b, __a);
7934#else
7935 return __builtin_altivec_vpkuwus(__a, __b);
7936#endif
7937}
7938
7939/* vec_vpksdus */
7940
7941#ifdef __POWER8_VECTOR__
7942static __inline__ vector unsigned int __ATTRS_o_ai
7943vec_vpksdus(vector long long __a, vector long long __b) {
7944#ifdef __LITTLE_ENDIAN__
7945 return __builtin_altivec_vpksdus(__b, __a);
7946#else
7947 return __builtin_altivec_vpksdus(__a, __b);
7948#endif
7949}
7950#endif
7951
7952/* vec_perm */
7953
7954// The vperm instruction is defined architecturally with a big-endian bias.
7955// For little endian, we swap the input operands and invert the permute
7956// control vector. Only the rightmost 5 bits matter, so we could use
7957// a vector of all 31s instead of all 255s to perform the inversion.
7958// However, when the PCV is not a constant, using 255 has an advantage
7959// in that the vec_xor can be recognized as a vec_nor (and for P8 and
7960// later, possibly a vec_nand).
7961
7962static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7963 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7964#ifdef __LITTLE_ENDIAN__
7965 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7966 255, 255, 255, 255, 255, 255, 255, 255};
7967 __d = vec_xor(__c, __d);
7968 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7969 (vector int)__a, __d);
7970#else
7971 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7972 (vector int)__b, __c);
7973#endif
7974}
7975
7976static __inline__ vector unsigned char __ATTRS_o_ai
7977vec_perm(vector unsigned char __a, vector unsigned char __b,
7978 vector unsigned char __c) {
7979#ifdef __LITTLE_ENDIAN__
7980 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7981 255, 255, 255, 255, 255, 255, 255, 255};
7982 __d = vec_xor(__c, __d);
7983 return (vector unsigned char)__builtin_altivec_vperm_4si(
7984 (vector int)__b, (vector int)__a, __d);
7985#else
7986 return (vector unsigned char)__builtin_altivec_vperm_4si(
7987 (vector int)__a, (vector int)__b, __c);
7988#endif
7989}
7990
7991static __inline__ vector bool char __ATTRS_o_ai
7992vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7993#ifdef __LITTLE_ENDIAN__
7994 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7995 255, 255, 255, 255, 255, 255, 255, 255};
7996 __d = vec_xor(__c, __d);
7997 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7998 (vector int)__a, __d);
7999#else
8000 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
8001 (vector int)__b, __c);
8002#endif
8003}
8004
8005static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
8006 vector signed short __b,
8007 vector unsigned char __c) {
8008#ifdef __LITTLE_ENDIAN__
8009 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8010 255, 255, 255, 255, 255, 255, 255, 255};
8011 __d = vec_xor(__c, __d);
8012 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
8013 (vector int)__a, __d);
8014#else
8015 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
8016 (vector int)__b, __c);
8017#endif
8018}
8019
8020static __inline__ vector unsigned short __ATTRS_o_ai
8021vec_perm(vector unsigned short __a, vector unsigned short __b,
8022 vector unsigned char __c) {
8023#ifdef __LITTLE_ENDIAN__
8024 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8025 255, 255, 255, 255, 255, 255, 255, 255};
8026 __d = vec_xor(__c, __d);
8027 return (vector unsigned short)__builtin_altivec_vperm_4si(
8028 (vector int)__b, (vector int)__a, __d);
8029#else
8030 return (vector unsigned short)__builtin_altivec_vperm_4si(
8031 (vector int)__a, (vector int)__b, __c);
8032#endif
8033}
8034
8035static __inline__ vector bool short __ATTRS_o_ai vec_perm(
8036 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8037#ifdef __LITTLE_ENDIAN__
8038 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8039 255, 255, 255, 255, 255, 255, 255, 255};
8040 __d = vec_xor(__c, __d);
8041 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
8042 (vector int)__a, __d);
8043#else
8044 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
8045 (vector int)__b, __c);
8046#endif
8047}
8048
8049static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
8050 vector pixel __b,
8051 vector unsigned char __c) {
8052#ifdef __LITTLE_ENDIAN__
8053 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8054 255, 255, 255, 255, 255, 255, 255, 255};
8055 __d = vec_xor(__c, __d);
8056 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
8057 (vector int)__a, __d);
8058#else
8059 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
8060 (vector int)__b, __c);
8061#endif
8062}
8063
8064static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
8065 vector signed int __b,
8066 vector unsigned char __c) {
8067#ifdef __LITTLE_ENDIAN__
8068 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8069 255, 255, 255, 255, 255, 255, 255, 255};
8070 __d = vec_xor(__c, __d);
8071 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
8072#else
8073 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
8074#endif
8075}
8076
8077static __inline__ vector unsigned int __ATTRS_o_ai
8078vec_perm(vector unsigned int __a, vector unsigned int __b,
8079 vector unsigned char __c) {
8080#ifdef __LITTLE_ENDIAN__
8081 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8082 255, 255, 255, 255, 255, 255, 255, 255};
8083 __d = vec_xor(__c, __d);
8084 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
8085 (vector int)__a, __d);
8086#else
8087 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
8088 (vector int)__b, __c);
8089#endif
8090}
8091
8092static __inline__ vector bool int __ATTRS_o_ai
8093vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8094#ifdef __LITTLE_ENDIAN__
8095 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8096 255, 255, 255, 255, 255, 255, 255, 255};
8097 __d = vec_xor(__c, __d);
8098 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
8099 (vector int)__a, __d);
8100#else
8101 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
8102 (vector int)__b, __c);
8103#endif
8104}
8105
8106static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
8107 vector float __b,
8108 vector unsigned char __c) {
8109#ifdef __LITTLE_ENDIAN__
8110 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8111 255, 255, 255, 255, 255, 255, 255, 255};
8112 __d = vec_xor(__c, __d);
8113 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
8114 (vector int)__a, __d);
8115#else
8116 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
8117 (vector int)__b, __c);
8118#endif
8119}
8120
8121#ifdef __VSX__
8122static __inline__ vector long long __ATTRS_o_ai
8123vec_perm(vector signed long long __a, vector signed long long __b,
8124 vector unsigned char __c) {
8125#ifdef __LITTLE_ENDIAN__
8126 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8127 255, 255, 255, 255, 255, 255, 255, 255};
8128 __d = vec_xor(__c, __d);
8129 return (vector signed long long)__builtin_altivec_vperm_4si(
8130 (vector int)__b, (vector int)__a, __d);
8131#else
8132 return (vector signed long long)__builtin_altivec_vperm_4si(
8133 (vector int)__a, (vector int)__b, __c);
8134#endif
8135}
8136
8137static __inline__ vector unsigned long long __ATTRS_o_ai
8138vec_perm(vector unsigned long long __a, vector unsigned long long __b,
8139 vector unsigned char __c) {
8140#ifdef __LITTLE_ENDIAN__
8141 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8142 255, 255, 255, 255, 255, 255, 255, 255};
8143 __d = vec_xor(__c, __d);
8144 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8145 (vector int)__b, (vector int)__a, __d);
8146#else
8147 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8148 (vector int)__a, (vector int)__b, __c);
8149#endif
8150}
8151
8152static __inline__ vector bool long long __ATTRS_o_ai
8153vec_perm(vector bool long long __a, vector bool long long __b,
8154 vector unsigned char __c) {
8155#ifdef __LITTLE_ENDIAN__
8156 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8157 255, 255, 255, 255, 255, 255, 255, 255};
8158 __d = vec_xor(__c, __d);
8159 return (vector bool long long)__builtin_altivec_vperm_4si(
8160 (vector int)__b, (vector int)__a, __d);
8161#else
8162 return (vector bool long long)__builtin_altivec_vperm_4si(
8163 (vector int)__a, (vector int)__b, __c);
8164#endif
8165}
8166
8167static __inline__ vector double __ATTRS_o_ai
8168vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
8169#ifdef __LITTLE_ENDIAN__
8170 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8171 255, 255, 255, 255, 255, 255, 255, 255};
8172 __d = vec_xor(__c, __d);
8173 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
8174 (vector int)__a, __d);
8175#else
8176 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
8177 (vector int)__b, __c);
8178#endif
8179}
8180#endif
8181
8182/* vec_vperm */
8183
8184static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
8185 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8186 return vec_perm(__a, __b, __c);
8187}
8188
8189static __inline__ vector unsigned char __ATTRS_o_ai
8190vec_vperm(vector unsigned char __a, vector unsigned char __b,
8191 vector unsigned char __c) {
8192 return vec_perm(__a, __b, __c);
8193}
8194
8195static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
8196 vector bool char __a, vector bool char __b, vector unsigned char __c) {
8197 return vec_perm(__a, __b, __c);
8198}
8199
8200static __inline__ vector short __ATTRS_o_ai
8201vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
8202 return vec_perm(__a, __b, __c);
8203}
8204
8205static __inline__ vector unsigned short __ATTRS_o_ai
8206vec_vperm(vector unsigned short __a, vector unsigned short __b,
8207 vector unsigned char __c) {
8208 return vec_perm(__a, __b, __c);
8209}
8210
8211static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
8212 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8213 return vec_perm(__a, __b, __c);
8214}
8215
8216static __inline__ vector pixel __ATTRS_o_ai
8217vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
8218 return vec_perm(__a, __b, __c);
8219}
8220
8221static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
8222 vector int __b,
8223 vector unsigned char __c) {
8224 return vec_perm(__a, __b, __c);
8225}
8226
8227static __inline__ vector unsigned int __ATTRS_o_ai
8228vec_vperm(vector unsigned int __a, vector unsigned int __b,
8229 vector unsigned char __c) {
8230 return vec_perm(__a, __b, __c);
8231}
8232
8233static __inline__ vector bool int __ATTRS_o_ai
8234vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8235 return vec_perm(__a, __b, __c);
8236}
8237
8238static __inline__ vector float __ATTRS_o_ai
8239vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
8240 return vec_perm(__a, __b, __c);
8241}
8242
8243#ifdef __VSX__
8244static __inline__ vector long long __ATTRS_o_ai vec_vperm(
8245 vector long long __a, vector long long __b, vector unsigned char __c) {
8246 return vec_perm(__a, __b, __c);
8247}
8248
8249static __inline__ vector unsigned long long __ATTRS_o_ai
8250vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
8251 vector unsigned char __c) {
8252 return vec_perm(__a, __b, __c);
8253}
8254
8255static __inline__ vector double __ATTRS_o_ai
8256vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
8257 return vec_perm(__a, __b, __c);
8258}
8259#endif
8260
8261/* vec_re */
8262
8263static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
8264#ifdef __VSX__
8265 return __builtin_vsx_xvresp(__a);
8266#else
8267 return __builtin_altivec_vrefp(__a);
8268#endif
8269}
8270
8271#ifdef __VSX__
8272static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
8273 return __builtin_vsx_xvredp(__a);
8274}
8275#endif
8276
8277/* vec_vrefp */
8278
8279static __inline__ vector float __attribute__((__always_inline__))
8280vec_vrefp(vector float __a) {
8281 return __builtin_altivec_vrefp(__a);
8282}
8283
8284/* vec_rl */
8285
8286static __inline__ vector signed char __ATTRS_o_ai
8287vec_rl(vector signed char __a, vector unsigned char __b) {
8288 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8289}
8290
8291static __inline__ vector unsigned char __ATTRS_o_ai
8292vec_rl(vector unsigned char __a, vector unsigned char __b) {
8293 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8294}
8295
8296static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
8297 vector unsigned short __b) {
8298 return __builtin_altivec_vrlh(__a, __b);
8299}
8300
8301static __inline__ vector unsigned short __ATTRS_o_ai
8302vec_rl(vector unsigned short __a, vector unsigned short __b) {
8303 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8304}
8305
8306static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
8307 vector unsigned int __b) {
8308 return __builtin_altivec_vrlw(__a, __b);
8309}
8310
8311static __inline__ vector unsigned int __ATTRS_o_ai
8312vec_rl(vector unsigned int __a, vector unsigned int __b) {
8313 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8314}
8315
8316#ifdef __POWER8_VECTOR__
8317static __inline__ vector signed long long __ATTRS_o_ai
8318vec_rl(vector signed long long __a, vector unsigned long long __b) {
8319 return __builtin_altivec_vrld(__a, __b);
8320}
8321
8322static __inline__ vector unsigned long long __ATTRS_o_ai
8323vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
8324 return (vector unsigned long long)__builtin_altivec_vrld(
8325 (vector long long)__a, __b);
8326}
8327#endif
8328
8329#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8330static __inline__ vector signed __int128 __ATTRS_o_ai
8331vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) {
8332 return (vector signed __int128)(((vector unsigned __int128)__b
8333 << (vector unsigned __int128)__a) |
8334 ((vector unsigned __int128)__b >>
8335 ((__CHAR_BIT__ *
8336 sizeof(vector unsigned __int128)) -
8337 (vector unsigned __int128)__a)));
8338}
8339
8340static __inline__ vector unsigned __int128 __ATTRS_o_ai
8341vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
8342 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a));
8343}
8344#endif
8345
8346/* vec_rlmi */
8347#ifdef __POWER9_VECTOR__
8348static __inline__ vector unsigned int __ATTRS_o_ai
8349vec_rlmi(vector unsigned int __a, vector unsigned int __b,
8350 vector unsigned int __c) {
8351 return __builtin_altivec_vrlwmi(__a, __c, __b);
8352}
8353
8354static __inline__ vector unsigned long long __ATTRS_o_ai
8355vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
8356 vector unsigned long long __c) {
8357 return __builtin_altivec_vrldmi(__a, __c, __b);
8358}
8359#endif
8360
8361#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8362static __inline__ vector unsigned __int128 __ATTRS_o_ai
8363vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b,
8364 vector unsigned __int128 __c) {
8365 return __builtin_altivec_vrlqmi(__a, __c, __b);
8366}
8367
8368static __inline__ vector signed __int128 __ATTRS_o_ai
8369vec_rlmi(vector signed __int128 __a, vector signed __int128 __b,
8370 vector signed __int128 __c) {
8371 return (vector signed __int128)__builtin_altivec_vrlqmi(
8372 (vector unsigned __int128)__a, (vector unsigned __int128)__c,
8373 (vector unsigned __int128)__b);
8374}
8375#endif
8376
8377/* vec_rlnm */
8378#ifdef __POWER9_VECTOR__
8379static __inline__ vector unsigned int __ATTRS_o_ai
8380vec_rlnm(vector unsigned int __a, vector unsigned int __b,
8381 vector unsigned int __c) {
8382 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
8383 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
8384}
8385
8386static __inline__ vector unsigned long long __ATTRS_o_ai
8387vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
8388 vector unsigned long long __c) {
8389 vector unsigned long long OneByte = { 0x8, 0x8 };
8390 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
8391}
8392#endif
8393
8394#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8395static __inline__ vector unsigned __int128 __ATTRS_o_ai
8396vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b,
8397 vector unsigned __int128 __c) {
8398 // Merge __b and __c using an appropriate shuffle.
8399 vector unsigned char TmpB = (vector unsigned char)__b;
8400 vector unsigned char TmpC = (vector unsigned char)__c;
8401 vector unsigned char MaskAndShift =
8402#ifdef __LITTLE_ENDIAN__
8403 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8404 1, -1, -1, -1, -1, -1);
8405#else
8406 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8407 -1, -1, -1, -1, -1, -1, -1);
8408#endif
8409 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8410}
8411
8412static __inline__ vector signed __int128 __ATTRS_o_ai
8413vec_rlnm(vector signed __int128 __a, vector signed __int128 __b,
8414 vector signed __int128 __c) {
8415 // Merge __b and __c using an appropriate shuffle.
8416 vector unsigned char TmpB = (vector unsigned char)__b;
8417 vector unsigned char TmpC = (vector unsigned char)__c;
8418 vector unsigned char MaskAndShift =
8419#ifdef __LITTLE_ENDIAN__
8420 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8421 1, -1, -1, -1, -1, -1);
8422#else
8423 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8424 -1, -1, -1, -1, -1, -1, -1);
8425#endif
8426 return (vector signed __int128)__builtin_altivec_vrlqnm(
8427 (vector unsigned __int128)__a, (vector unsigned __int128)MaskAndShift);
8428}
8429#endif
8430
8431/* vec_vrlb */
8432
8433static __inline__ vector signed char __ATTRS_o_ai
8434vec_vrlb(vector signed char __a, vector unsigned char __b) {
8435 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8436}
8437
8438static __inline__ vector unsigned char __ATTRS_o_ai
8439vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
8440 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8441}
8442
8443/* vec_vrlh */
8444
8445static __inline__ vector short __ATTRS_o_ai
8446vec_vrlh(vector short __a, vector unsigned short __b) {
8447 return __builtin_altivec_vrlh(__a, __b);
8448}
8449
8450static __inline__ vector unsigned short __ATTRS_o_ai
8451vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
8452 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8453}
8454
8455/* vec_vrlw */
8456
8457static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
8458 vector unsigned int __b) {
8459 return __builtin_altivec_vrlw(__a, __b);
8460}
8461
8462static __inline__ vector unsigned int __ATTRS_o_ai
8463vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
8464 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8465}
8466
8467/* vec_round */
8468
8469static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
8470 return __builtin_altivec_vrfin(__a);
8471}
8472
8473#ifdef __VSX__
8474#ifdef __XL_COMPAT_ALTIVEC__
8475static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a);
8476static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8477 double __fpscr = __builtin_readflm();
8478 __builtin_setrnd(0);
8479 vector double __rounded = vec_rint(__a);
8480 __builtin_setflm(__fpscr);
8481 return __rounded;
8482}
8483#else
8484static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8485 return __builtin_vsx_xvrdpi(__a);
8486}
8487#endif
8488
8489/* vec_rint */
8490
8491static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
8492 return __builtin_vsx_xvrspic(__a);
8493}
8494
8495static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
8496 return __builtin_vsx_xvrdpic(__a);
8497}
8498
8499/* vec_roundc */
8500
8501static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) {
8502 return __builtin_vsx_xvrspic(__a);
8503}
8504
8505static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) {
8506 return __builtin_vsx_xvrdpic(__a);
8507}
8508
8509/* vec_nearbyint */
8510
8511static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
8512 return __builtin_vsx_xvrspi(__a);
8513}
8514
8515static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
8516 return __builtin_vsx_xvrdpi(__a);
8517}
8518#endif
8519
8520/* vec_vrfin */
8521
8522static __inline__ vector float __attribute__((__always_inline__))
8523vec_vrfin(vector float __a) {
8524 return __builtin_altivec_vrfin(__a);
8525}
8526
8527/* vec_sqrt */
8528
8529#ifdef __VSX__
8530static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
8531 return __builtin_vsx_xvsqrtsp(__a);
8532}
8533
8534static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
8535 return __builtin_vsx_xvsqrtdp(__a);
8536}
8537#endif
8538
8539/* vec_rsqrte */
8540
8541static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
8542#ifdef __VSX__
8543 return __builtin_vsx_xvrsqrtesp(__a);
8544#else
8545 return __builtin_altivec_vrsqrtefp(__a);
8546#endif
8547}
8548
8549#ifdef __VSX__
8550static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
8551 return __builtin_vsx_xvrsqrtedp(__a);
8552}
8553#endif
8554
8555static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) {
8556 return __builtin_ppc_rsqrtf(__a);
8557}
8558
8559#ifdef __VSX__
8560static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) {
8561 return __builtin_ppc_rsqrtd(__a);
8562}
8563#endif
8564
8565/* vec_vrsqrtefp */
8566
8567static __inline__ __vector float __attribute__((__always_inline__))
8568vec_vrsqrtefp(vector float __a) {
8569 return __builtin_altivec_vrsqrtefp(__a);
8570}
8571
8572/* vec_xvtsqrt */
8573
8574#ifdef __VSX__
8575static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) {
8576 return __builtin_vsx_xvtsqrtdp(__a);
8577}
8578
8579static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) {
8580 return __builtin_vsx_xvtsqrtsp(__a);
8581}
8582#endif
8583
8584/* vec_sel */
8585
8586#define __builtin_altivec_vsel_4si vec_sel
8587
8588static __inline__ vector signed char __ATTRS_o_ai vec_sel(
8589 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8590 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8591}
8592
8593static __inline__ vector signed char __ATTRS_o_ai
8594vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
8595 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8596}
8597
8598static __inline__ vector unsigned char __ATTRS_o_ai
8599vec_sel(vector unsigned char __a, vector unsigned char __b,
8600 vector unsigned char __c) {
8601 return (__a & ~__c) | (__b & __c);
8602}
8603
8604static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
8605 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8606 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8607}
8608
8609static __inline__ vector bool char __ATTRS_o_ai
8610vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8611 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8612}
8613
8614static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
8615 vector bool char __b,
8616 vector bool char __c) {
8617 return (__a & ~__c) | (__b & __c);
8618}
8619
8620static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8621 vector short __b,
8622 vector unsigned short __c) {
8623 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8624}
8625
8626static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8627 vector short __b,
8628 vector bool short __c) {
8629 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8630}
8631
8632static __inline__ vector unsigned short __ATTRS_o_ai
8633vec_sel(vector unsigned short __a, vector unsigned short __b,
8634 vector unsigned short __c) {
8635 return (__a & ~__c) | (__b & __c);
8636}
8637
8638static __inline__ vector unsigned short __ATTRS_o_ai
8639vec_sel(vector unsigned short __a, vector unsigned short __b,
8640 vector bool short __c) {
8641 return (__a & ~(vector unsigned short)__c) |
8642 (__b & (vector unsigned short)__c);
8643}
8644
8645static __inline__ vector bool short __ATTRS_o_ai vec_sel(
8646 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8647 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8648}
8649
8650static __inline__ vector bool short __ATTRS_o_ai
8651vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
8652 return (__a & ~__c) | (__b & __c);
8653}
8654
8655static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8656 vector int __b,
8657 vector unsigned int __c) {
8658 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8659}
8660
8661static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8662 vector int __b,
8663 vector bool int __c) {
8664 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8665}
8666
8667static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
8668 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8669 return (__a & ~__c) | (__b & __c);
8670}
8671
8672static __inline__ vector unsigned int __ATTRS_o_ai
8673vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8674 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8675}
8676
8677static __inline__ vector bool int __ATTRS_o_ai
8678vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8679 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8680}
8681
8682static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
8683 vector bool int __b,
8684 vector bool int __c) {
8685 return (__a & ~__c) | (__b & __c);
8686}
8687
8688static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8689 vector float __b,
8690 vector unsigned int __c) {
8691 vector int __res = ((vector int)__a & ~(vector int)__c) |
8692 ((vector int)__b & (vector int)__c);
8693 return (vector float)__res;
8694}
8695
8696static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8697 vector float __b,
8698 vector bool int __c) {
8699 vector int __res = ((vector int)__a & ~(vector int)__c) |
8700 ((vector int)__b & (vector int)__c);
8701 return (vector float)__res;
8702}
8703
8704#ifdef __VSX__
8705static __inline__ vector double __ATTRS_o_ai
8706vec_sel(vector double __a, vector double __b, vector bool long long __c) {
8707 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8708 ((vector long long)__b & (vector long long)__c);
8709 return (vector double)__res;
8710}
8711
8712static __inline__ vector double __ATTRS_o_ai
8713vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
8714 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8715 ((vector long long)__b & (vector long long)__c);
8716 return (vector double)__res;
8717}
8718
8719static __inline__ vector bool long long __ATTRS_o_ai
8720vec_sel(vector bool long long __a, vector bool long long __b,
8721 vector bool long long __c) {
8722 return (__a & ~__c) | (__b & __c);
8723}
8724
8725static __inline__ vector bool long long __ATTRS_o_ai
8726vec_sel(vector bool long long __a, vector bool long long __b,
8727 vector unsigned long long __c) {
8728 return (__a & ~(vector bool long long)__c) |
8729 (__b & (vector bool long long)__c);
8730}
8731
8732static __inline__ vector signed long long __ATTRS_o_ai
8733vec_sel(vector signed long long __a, vector signed long long __b,
8734 vector bool long long __c) {
8735 return (__a & ~(vector signed long long)__c) |
8736 (__b & (vector signed long long)__c);
8737}
8738
8739static __inline__ vector signed long long __ATTRS_o_ai
8740vec_sel(vector signed long long __a, vector signed long long __b,
8741 vector unsigned long long __c) {
8742 return (__a & ~(vector signed long long)__c) |
8743 (__b & (vector signed long long)__c);
8744}
8745
8746static __inline__ vector unsigned long long __ATTRS_o_ai
8747vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8748 vector bool long long __c) {
8749 return (__a & ~(vector unsigned long long)__c) |
8750 (__b & (vector unsigned long long)__c);
8751}
8752
8753static __inline__ vector unsigned long long __ATTRS_o_ai
8754vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8755 vector unsigned long long __c) {
8756 return (__a & ~__c) | (__b & __c);
8757}
8758#endif
8759
8760/* vec_vsel */
8761
8762static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
8763 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8764 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8765}
8766
8767static __inline__ vector signed char __ATTRS_o_ai
8768vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
8769 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8770}
8771
8772static __inline__ vector unsigned char __ATTRS_o_ai
8773vec_vsel(vector unsigned char __a, vector unsigned char __b,
8774 vector unsigned char __c) {
8775 return (__a & ~__c) | (__b & __c);
8776}
8777
8778static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
8779 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8780 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8781}
8782
8783static __inline__ vector bool char __ATTRS_o_ai
8784vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8785 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8786}
8787
8788static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
8789 vector bool char __b,
8790 vector bool char __c) {
8791 return (__a & ~__c) | (__b & __c);
8792}
8793
8794static __inline__ vector short __ATTRS_o_ai
8795vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
8796 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8797}
8798
8799static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
8800 vector short __b,
8801 vector bool short __c) {
8802 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8803}
8804
8805static __inline__ vector unsigned short __ATTRS_o_ai
8806vec_vsel(vector unsigned short __a, vector unsigned short __b,
8807 vector unsigned short __c) {
8808 return (__a & ~__c) | (__b & __c);
8809}
8810
8811static __inline__ vector unsigned short __ATTRS_o_ai
8812vec_vsel(vector unsigned short __a, vector unsigned short __b,
8813 vector bool short __c) {
8814 return (__a & ~(vector unsigned short)__c) |
8815 (__b & (vector unsigned short)__c);
8816}
8817
8818static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
8819 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8820 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8821}
8822
8823static __inline__ vector bool short __ATTRS_o_ai
8824vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
8825 return (__a & ~__c) | (__b & __c);
8826}
8827
8828static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8829 vector int __b,
8830 vector unsigned int __c) {
8831 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8832}
8833
8834static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8835 vector int __b,
8836 vector bool int __c) {
8837 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8838}
8839
8840static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8841 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8842 return (__a & ~__c) | (__b & __c);
8843}
8844
8845static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8846 vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8847 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8848}
8849
8850static __inline__ vector bool int __ATTRS_o_ai
8851vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8852 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8853}
8854
8855static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8856 vector bool int __b,
8857 vector bool int __c) {
8858 return (__a & ~__c) | (__b & __c);
8859}
8860
8861static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8862 vector float __b,
8863 vector unsigned int __c) {
8864 vector int __res = ((vector int)__a & ~(vector int)__c) |
8865 ((vector int)__b & (vector int)__c);
8866 return (vector float)__res;
8867}
8868
8869static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8870 vector float __b,
8871 vector bool int __c) {
8872 vector int __res = ((vector int)__a & ~(vector int)__c) |
8873 ((vector int)__b & (vector int)__c);
8874 return (vector float)__res;
8875}
8876
8877/* vec_sl */
8878
8879// vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8880// than the length of __a.
8881static __inline__ vector unsigned char __ATTRS_o_ai
8882vec_sl(vector unsigned char __a, vector unsigned char __b) {
8883 return __a << (__b %
8884 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8885}
8886
8887static __inline__ vector signed char __ATTRS_o_ai
8888vec_sl(vector signed char __a, vector unsigned char __b) {
8889 return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8890}
8891
8892static __inline__ vector unsigned short __ATTRS_o_ai
8893vec_sl(vector unsigned short __a, vector unsigned short __b) {
8894 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8895 __CHAR_BIT__));
8896}
8897
8898static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8899 vector unsigned short __b) {
8900 return (vector short)vec_sl((vector unsigned short)__a, __b);
8901}
8902
8903static __inline__ vector unsigned int __ATTRS_o_ai
8904vec_sl(vector unsigned int __a, vector unsigned int __b) {
8905 return __a << (__b %
8906 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8907}
8908
8909static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8910 vector unsigned int __b) {
8911 return (vector int)vec_sl((vector unsigned int)__a, __b);
8912}
8913
8914#ifdef __POWER8_VECTOR__
8915static __inline__ vector unsigned long long __ATTRS_o_ai
8916vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8917 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8918 __CHAR_BIT__));
8919}
8920
8921static __inline__ vector long long __ATTRS_o_ai
8922vec_sl(vector long long __a, vector unsigned long long __b) {
8923 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8924}
8925#elif defined(__VSX__)
8926static __inline__ vector unsigned char __ATTRS_o_ai
8927vec_vspltb(vector unsigned char __a, unsigned char __b);
8928static __inline__ vector unsigned long long __ATTRS_o_ai
8929vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8930 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
8931
8932 // Big endian element one (the right doubleword) can be left shifted as-is.
8933 // The other element needs to be swapped into the right doubleword and
8934 // shifted. Then the right doublewords of the two result vectors are merged.
8935 vector signed long long __rightelt =
8936 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8937 (vector signed int)__b);
8938#ifdef __LITTLE_ENDIAN__
8939 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8940 (vector signed int)__rightelt,
8941 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8942#else
8943 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8944 (vector signed int)__rightelt,
8945 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8946#endif
8947 __a = __builtin_shufflevector(__a, __a, 1, 0);
8948 __b = __builtin_shufflevector(__b, __b, 1, 0);
8949 vector signed long long __leftelt =
8950 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8951 (vector signed int)__b);
8952#ifdef __LITTLE_ENDIAN__
8953 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8954 (vector signed int)__leftelt,
8955 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8956 return (vector unsigned long long)__builtin_shufflevector(__rightelt,
8957 __leftelt, 0, 2);
8958#else
8959 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8960 (vector signed int)__leftelt,
8961 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8962 return (vector unsigned long long)__builtin_shufflevector(__leftelt,
8963 __rightelt, 1, 3);
8964#endif
8965}
8966
8967static __inline__ vector long long __ATTRS_o_ai
8968vec_sl(vector long long __a, vector unsigned long long __b) {
8969 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8970}
8971#endif /* __VSX__ */
8972
8973/* vec_vslb */
8974
8975#define __builtin_altivec_vslb vec_vslb
8976
8977static __inline__ vector signed char __ATTRS_o_ai
8978vec_vslb(vector signed char __a, vector unsigned char __b) {
8979 return vec_sl(__a, __b);
8980}
8981
8982static __inline__ vector unsigned char __ATTRS_o_ai
8983vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8984 return vec_sl(__a, __b);
8985}
8986
8987/* vec_vslh */
8988
8989#define __builtin_altivec_vslh vec_vslh
8990
8991static __inline__ vector short __ATTRS_o_ai
8992vec_vslh(vector short __a, vector unsigned short __b) {
8993 return vec_sl(__a, __b);
8994}
8995
8996static __inline__ vector unsigned short __ATTRS_o_ai
8997vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8998 return vec_sl(__a, __b);
8999}
9000
9001/* vec_vslw */
9002
9003#define __builtin_altivec_vslw vec_vslw
9004
9005static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
9006 vector unsigned int __b) {
9007 return vec_sl(__a, __b);
9008}
9009
9010static __inline__ vector unsigned int __ATTRS_o_ai
9011vec_vslw(vector unsigned int __a, vector unsigned int __b) {
9012 return vec_sl(__a, __b);
9013}
9014
9015/* vec_sld */
9016
9017#define __builtin_altivec_vsldoi_4si vec_sld
9018
9019static __inline__ vector signed char __ATTRS_o_ai vec_sld(
9020 vector signed char __a, vector signed char __b, unsigned const int __c) {
9021 unsigned char __d = __c & 0x0F;
9022#ifdef __LITTLE_ENDIAN__
9023 return vec_perm(
9024 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9025 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9026 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9027 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9028#else
9029 return vec_perm(
9030 __a, __b,
9031 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9032 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9033 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9034#endif
9035}
9036
9037static __inline__ vector unsigned char __ATTRS_o_ai
9038vec_sld(vector unsigned char __a, vector unsigned char __b,
9039 unsigned const int __c) {
9040 unsigned char __d = __c & 0x0F;
9041#ifdef __LITTLE_ENDIAN__
9042 return vec_perm(
9043 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9044 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9045 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9046 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9047#else
9048 return vec_perm(
9049 __a, __b,
9050 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9051 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9052 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9053#endif
9054}
9055
9056static __inline__ vector bool char __ATTRS_o_ai
9057vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
9058 unsigned char __d = __c & 0x0F;
9059#ifdef __LITTLE_ENDIAN__
9060 return vec_perm(
9061 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9062 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9063 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9064 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9065#else
9066 return vec_perm(
9067 __a, __b,
9068 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9069 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9070 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9071#endif
9072}
9073
9074static __inline__ vector signed short __ATTRS_o_ai vec_sld(
9075 vector signed short __a, vector signed short __b, unsigned const int __c) {
9076 unsigned char __d = __c & 0x0F;
9077#ifdef __LITTLE_ENDIAN__
9078 return vec_perm(
9079 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9080 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9081 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9082 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9083#else
9084 return vec_perm(
9085 __a, __b,
9086 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9087 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9088 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9089#endif
9090}
9091
9092static __inline__ vector unsigned short __ATTRS_o_ai
9093vec_sld(vector unsigned short __a, vector unsigned short __b,
9094 unsigned const int __c) {
9095 unsigned char __d = __c & 0x0F;
9096#ifdef __LITTLE_ENDIAN__
9097 return vec_perm(
9098 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9099 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9100 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9101 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9102#else
9103 return vec_perm(
9104 __a, __b,
9105 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9106 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9107 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9108#endif
9109}
9110
9111static __inline__ vector bool short __ATTRS_o_ai
9112vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
9113 unsigned char __d = __c & 0x0F;
9114#ifdef __LITTLE_ENDIAN__
9115 return vec_perm(
9116 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9117 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9118 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9119 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9120#else
9121 return vec_perm(
9122 __a, __b,
9123 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9124 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9125 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9126#endif
9127}
9128
9129static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
9130 vector pixel __b,
9131 unsigned const int __c) {
9132 unsigned char __d = __c & 0x0F;
9133#ifdef __LITTLE_ENDIAN__
9134 return vec_perm(
9135 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9136 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9137 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9138 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9139#else
9140 return vec_perm(
9141 __a, __b,
9142 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9143 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9144 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9145#endif
9146}
9147
9148static __inline__ vector signed int __ATTRS_o_ai
9149vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
9150 unsigned char __d = __c & 0x0F;
9151#ifdef __LITTLE_ENDIAN__
9152 return vec_perm(
9153 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9154 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9155 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9156 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9157#else
9158 return vec_perm(
9159 __a, __b,
9160 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9161 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9162 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9163#endif
9164}
9165
9166static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
9167 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9168 unsigned char __d = __c & 0x0F;
9169#ifdef __LITTLE_ENDIAN__
9170 return vec_perm(
9171 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9172 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9173 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9174 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9175#else
9176 return vec_perm(
9177 __a, __b,
9178 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9179 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9180 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9181#endif
9182}
9183
9184static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
9185 vector bool int __b,
9186 unsigned const int __c) {
9187 unsigned char __d = __c & 0x0F;
9188#ifdef __LITTLE_ENDIAN__
9189 return vec_perm(
9190 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9191 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9192 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9193 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9194#else
9195 return vec_perm(
9196 __a, __b,
9197 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9198 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9199 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9200#endif
9201}
9202
9203static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
9204 vector float __b,
9205 unsigned const int __c) {
9206 unsigned char __d = __c & 0x0F;
9207#ifdef __LITTLE_ENDIAN__
9208 return vec_perm(
9209 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9210 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9211 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9212 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9213#else
9214 return vec_perm(
9215 __a, __b,
9216 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9217 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9218 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9219#endif
9220}
9221
9222#ifdef __VSX__
9223static __inline__ vector bool long long __ATTRS_o_ai
9224vec_sld(vector bool long long __a, vector bool long long __b,
9225 unsigned const int __c) {
9226 unsigned char __d = __c & 0x0F;
9227#ifdef __LITTLE_ENDIAN__
9228 return vec_perm(
9229 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9230 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9231 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9232 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9233#else
9234 return vec_perm(
9235 __a, __b,
9236 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9237 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9238 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9239#endif
9240}
9241
9242static __inline__ vector signed long long __ATTRS_o_ai
9243vec_sld(vector signed long long __a, vector signed long long __b,
9244 unsigned const int __c) {
9245 unsigned char __d = __c & 0x0F;
9246#ifdef __LITTLE_ENDIAN__
9247 return vec_perm(
9248 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9249 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9250 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9251 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9252#else
9253 return vec_perm(
9254 __a, __b,
9255 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9256 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9257 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9258#endif
9259}
9260
9261static __inline__ vector unsigned long long __ATTRS_o_ai
9262vec_sld(vector unsigned long long __a, vector unsigned long long __b,
9263 unsigned const int __c) {
9264 unsigned char __d = __c & 0x0F;
9265#ifdef __LITTLE_ENDIAN__
9266 return vec_perm(
9267 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9268 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9269 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9270 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9271#else
9272 return vec_perm(
9273 __a, __b,
9274 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9275 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9276 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9277#endif
9278}
9279
9280static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
9281 vector double __b,
9282 unsigned const int __c) {
9283 unsigned char __d = __c & 0x0F;
9284#ifdef __LITTLE_ENDIAN__
9285 return vec_perm(
9286 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9287 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9288 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9289 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9290#else
9291 return vec_perm(
9292 __a, __b,
9293 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9294 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9295 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9296#endif
9297}
9298#endif
9299
9300/* vec_sldw */
9301static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
9302 vector signed char __a, vector signed char __b, unsigned const int __c) {
9303 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9304}
9305
9306static __inline__ vector unsigned char __ATTRS_o_ai
9307vec_sldw(vector unsigned char __a, vector unsigned char __b,
9308 unsigned const int __c) {
9309 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9310}
9311
9312static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
9313 vector signed short __a, vector signed short __b, unsigned const int __c) {
9314 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9315}
9316
9317static __inline__ vector unsigned short __ATTRS_o_ai
9318vec_sldw(vector unsigned short __a, vector unsigned short __b,
9319 unsigned const int __c) {
9320 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9321}
9322
9323static __inline__ vector signed int __ATTRS_o_ai
9324vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
9325 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9326}
9327
9328static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
9329 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9330 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9331}
9332
9333static __inline__ vector float __ATTRS_o_ai vec_sldw(
9334 vector float __a, vector float __b, unsigned const int __c) {
9335 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9336}
9337
9338#ifdef __VSX__
9339static __inline__ vector signed long long __ATTRS_o_ai
9340vec_sldw(vector signed long long __a, vector signed long long __b,
9341 unsigned const int __c) {
9342 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9343}
9344
9345static __inline__ vector unsigned long long __ATTRS_o_ai
9346vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
9347 unsigned const int __c) {
9348 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9349}
9350
9351static __inline__ vector double __ATTRS_o_ai vec_sldw(
9352 vector double __a, vector double __b, unsigned const int __c) {
9353 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9354}
9355#endif
9356
9357#ifdef __POWER9_VECTOR__
9358/* vec_slv */
9359static __inline__ vector unsigned char __ATTRS_o_ai
9360vec_slv(vector unsigned char __a, vector unsigned char __b) {
9361 return __builtin_altivec_vslv(__a, __b);
9362}
9363
9364/* vec_srv */
9365static __inline__ vector unsigned char __ATTRS_o_ai
9366vec_srv(vector unsigned char __a, vector unsigned char __b) {
9367 return __builtin_altivec_vsrv(__a, __b);
9368}
9369#endif
9370
9371/* vec_vsldoi */
9372
9373static __inline__ vector signed char __ATTRS_o_ai
9374vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
9375 unsigned char __d = __c & 0x0F;
9376#ifdef __LITTLE_ENDIAN__
9377 return vec_perm(
9378 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9379 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9380 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9381 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9382#else
9383 return vec_perm(
9384 __a, __b,
9385 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9386 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9387 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9388#endif
9389}
9390
9391static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
9392 vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
9393 unsigned char __d = __c & 0x0F;
9394#ifdef __LITTLE_ENDIAN__
9395 return vec_perm(
9396 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9397 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9398 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9399 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9400#else
9401 return vec_perm(
9402 __a, __b,
9403 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9404 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9405 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9406#endif
9407}
9408
9409static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
9410 vector short __b,
9411 unsigned char __c) {
9412 unsigned char __d = __c & 0x0F;
9413#ifdef __LITTLE_ENDIAN__
9414 return vec_perm(
9415 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9416 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9417 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9418 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9419#else
9420 return vec_perm(
9421 __a, __b,
9422 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9423 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9424 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9425#endif
9426}
9427
9428static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
9429 vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
9430 unsigned char __d = __c & 0x0F;
9431#ifdef __LITTLE_ENDIAN__
9432 return vec_perm(
9433 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9434 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9435 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9436 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9437#else
9438 return vec_perm(
9439 __a, __b,
9440 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9441 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9442 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9443#endif
9444}
9445
9446static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
9447 vector pixel __b,
9448 unsigned char __c) {
9449 unsigned char __d = __c & 0x0F;
9450#ifdef __LITTLE_ENDIAN__
9451 return vec_perm(
9452 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9453 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9454 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9455 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9456#else
9457 return vec_perm(
9458 __a, __b,
9459 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9460 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9461 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9462#endif
9463}
9464
9465static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
9466 vector int __b,
9467 unsigned char __c) {
9468 unsigned char __d = __c & 0x0F;
9469#ifdef __LITTLE_ENDIAN__
9470 return vec_perm(
9471 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9472 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9473 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9474 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9475#else
9476 return vec_perm(
9477 __a, __b,
9478 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9479 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9480 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9481#endif
9482}
9483
9484static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
9485 vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
9486 unsigned char __d = __c & 0x0F;
9487#ifdef __LITTLE_ENDIAN__
9488 return vec_perm(
9489 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9490 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9491 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9492 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9493#else
9494 return vec_perm(
9495 __a, __b,
9496 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9497 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9498 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9499#endif
9500}
9501
9502static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
9503 vector float __b,
9504 unsigned char __c) {
9505 unsigned char __d = __c & 0x0F;
9506#ifdef __LITTLE_ENDIAN__
9507 return vec_perm(
9508 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9509 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9510 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9511 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9512#else
9513 return vec_perm(
9514 __a, __b,
9515 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9516 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9517 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9518#endif
9519}
9520
9521/* vec_sll */
9522
9523static __inline__ vector signed char __ATTRS_o_ai
9524vec_sll(vector signed char __a, vector unsigned char __b) {
9525 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9526 (vector int)__b);
9527}
9528
9529static __inline__ vector signed char __ATTRS_o_ai
9530vec_sll(vector signed char __a, vector unsigned short __b) {
9531 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9532 (vector int)__b);
9533}
9534
9535static __inline__ vector signed char __ATTRS_o_ai
9536vec_sll(vector signed char __a, vector unsigned int __b) {
9537 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9538 (vector int)__b);
9539}
9540
9541static __inline__ vector unsigned char __ATTRS_o_ai
9542vec_sll(vector unsigned char __a, vector unsigned char __b) {
9543 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9544 (vector int)__b);
9545}
9546
9547static __inline__ vector unsigned char __ATTRS_o_ai
9548vec_sll(vector unsigned char __a, vector unsigned short __b) {
9549 return (vector unsigned 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 int __b) {
9555 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9556 (vector int)__b);
9557}
9558
9559static __inline__ vector bool char __ATTRS_o_ai
9560vec_sll(vector bool char __a, vector unsigned char __b) {
9561 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9562 (vector int)__b);
9563}
9564
9565static __inline__ vector bool char __ATTRS_o_ai
9566vec_sll(vector bool char __a, vector unsigned short __b) {
9567 return (vector bool 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 int __b) {
9573 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9574 (vector int)__b);
9575}
9576
9577static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9578 vector unsigned char __b) {
9579 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9580}
9581
9582static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9583 vector unsigned short __b) {
9584 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9585}
9586
9587static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9588 vector unsigned int __b) {
9589 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9590}
9591
9592static __inline__ vector unsigned short __ATTRS_o_ai
9593vec_sll(vector unsigned short __a, vector unsigned char __b) {
9594 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9595 (vector int)__b);
9596}
9597
9598static __inline__ vector unsigned short __ATTRS_o_ai
9599vec_sll(vector unsigned short __a, vector unsigned short __b) {
9600 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9601 (vector int)__b);
9602}
9603
9604static __inline__ vector unsigned short __ATTRS_o_ai
9605vec_sll(vector unsigned short __a, vector unsigned int __b) {
9606 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9607 (vector int)__b);
9608}
9609
9610static __inline__ vector bool short __ATTRS_o_ai
9611vec_sll(vector bool short __a, vector unsigned char __b) {
9612 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9613 (vector int)__b);
9614}
9615
9616static __inline__ vector bool short __ATTRS_o_ai
9617vec_sll(vector bool short __a, vector unsigned short __b) {
9618 return (vector bool 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 int __b) {
9624 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9625 (vector int)__b);
9626}
9627
9628static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9629 vector unsigned char __b) {
9630 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9631}
9632
9633static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9634 vector unsigned short __b) {
9635 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9636}
9637
9638static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9639 vector unsigned int __b) {
9640 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9641}
9642
9643static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9644 vector unsigned char __b) {
9645 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9646}
9647
9648static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9649 vector unsigned short __b) {
9650 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9651}
9652
9653static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9654 vector unsigned int __b) {
9655 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9656}
9657
9658static __inline__ vector unsigned int __ATTRS_o_ai
9659vec_sll(vector unsigned int __a, vector unsigned char __b) {
9660 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9661 (vector int)__b);
9662}
9663
9664static __inline__ vector unsigned int __ATTRS_o_ai
9665vec_sll(vector unsigned int __a, vector unsigned short __b) {
9666 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9667 (vector int)__b);
9668}
9669
9670static __inline__ vector unsigned int __ATTRS_o_ai
9671vec_sll(vector unsigned int __a, vector unsigned int __b) {
9672 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9673 (vector int)__b);
9674}
9675
9676static __inline__ vector bool int __ATTRS_o_ai
9677vec_sll(vector bool int __a, vector unsigned char __b) {
9678 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9679 (vector int)__b);
9680}
9681
9682static __inline__ vector bool int __ATTRS_o_ai
9683vec_sll(vector bool int __a, vector unsigned short __b) {
9684 return (vector bool 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 int __b) {
9690 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9691 (vector int)__b);
9692}
9693
9694#ifdef __VSX__
9695static __inline__ vector signed long long __ATTRS_o_ai
9696vec_sll(vector signed long long __a, vector unsigned char __b) {
9697 return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
9698 (vector int)__b);
9699}
9700
9701static __inline__ vector unsigned long long __ATTRS_o_ai
9702vec_sll(vector unsigned long long __a, vector unsigned char __b) {
9703 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
9704 (vector int)__b);
9705}
9706#endif
9707
9708/* vec_vsl */
9709
9710static __inline__ vector signed char __ATTRS_o_ai
9711vec_vsl(vector signed char __a, vector unsigned char __b) {
9712 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9713 (vector int)__b);
9714}
9715
9716static __inline__ vector signed char __ATTRS_o_ai
9717vec_vsl(vector signed char __a, vector unsigned short __b) {
9718 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9719 (vector int)__b);
9720}
9721
9722static __inline__ vector signed char __ATTRS_o_ai
9723vec_vsl(vector signed char __a, vector unsigned int __b) {
9724 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9725 (vector int)__b);
9726}
9727
9728static __inline__ vector unsigned char __ATTRS_o_ai
9729vec_vsl(vector unsigned char __a, vector unsigned char __b) {
9730 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9731 (vector int)__b);
9732}
9733
9734static __inline__ vector unsigned char __ATTRS_o_ai
9735vec_vsl(vector unsigned char __a, vector unsigned short __b) {
9736 return (vector unsigned 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 int __b) {
9742 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9743 (vector int)__b);
9744}
9745
9746static __inline__ vector bool char __ATTRS_o_ai
9747vec_vsl(vector bool char __a, vector unsigned char __b) {
9748 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9749 (vector int)__b);
9750}
9751
9752static __inline__ vector bool char __ATTRS_o_ai
9753vec_vsl(vector bool char __a, vector unsigned short __b) {
9754 return (vector bool 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 int __b) {
9760 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9761 (vector int)__b);
9762}
9763
9764static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9765 vector unsigned char __b) {
9766 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9767}
9768
9769static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9770 vector unsigned short __b) {
9771 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9772}
9773
9774static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9775 vector unsigned int __b) {
9776 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9777}
9778
9779static __inline__ vector unsigned short __ATTRS_o_ai
9780vec_vsl(vector unsigned short __a, vector unsigned char __b) {
9781 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9782 (vector int)__b);
9783}
9784
9785static __inline__ vector unsigned short __ATTRS_o_ai
9786vec_vsl(vector unsigned short __a, vector unsigned short __b) {
9787 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9788 (vector int)__b);
9789}
9790
9791static __inline__ vector unsigned short __ATTRS_o_ai
9792vec_vsl(vector unsigned short __a, vector unsigned int __b) {
9793 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9794 (vector int)__b);
9795}
9796
9797static __inline__ vector bool short __ATTRS_o_ai
9798vec_vsl(vector bool short __a, vector unsigned char __b) {
9799 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9800 (vector int)__b);
9801}
9802
9803static __inline__ vector bool short __ATTRS_o_ai
9804vec_vsl(vector bool short __a, vector unsigned short __b) {
9805 return (vector bool 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 int __b) {
9811 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9812 (vector int)__b);
9813}
9814
9815static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9816 vector unsigned char __b) {
9817 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9818}
9819
9820static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9821 vector unsigned short __b) {
9822 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9823}
9824
9825static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9826 vector unsigned int __b) {
9827 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9828}
9829
9830static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9831 vector unsigned char __b) {
9832 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9833}
9834
9835static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9836 vector unsigned short __b) {
9837 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9838}
9839
9840static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9841 vector unsigned int __b) {
9842 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9843}
9844
9845static __inline__ vector unsigned int __ATTRS_o_ai
9846vec_vsl(vector unsigned int __a, vector unsigned char __b) {
9847 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9848 (vector int)__b);
9849}
9850
9851static __inline__ vector unsigned int __ATTRS_o_ai
9852vec_vsl(vector unsigned int __a, vector unsigned short __b) {
9853 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9854 (vector int)__b);
9855}
9856
9857static __inline__ vector unsigned int __ATTRS_o_ai
9858vec_vsl(vector unsigned int __a, vector unsigned int __b) {
9859 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9860 (vector int)__b);
9861}
9862
9863static __inline__ vector bool int __ATTRS_o_ai
9864vec_vsl(vector bool int __a, vector unsigned char __b) {
9865 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9866 (vector int)__b);
9867}
9868
9869static __inline__ vector bool int __ATTRS_o_ai
9870vec_vsl(vector bool int __a, vector unsigned short __b) {
9871 return (vector bool 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 int __b) {
9877 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9878 (vector int)__b);
9879}
9880
9881/* vec_slo */
9882
9883static __inline__ vector signed char __ATTRS_o_ai
9884vec_slo(vector signed char __a, vector signed char __b) {
9885 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9886 (vector int)__b);
9887}
9888
9889static __inline__ vector signed char __ATTRS_o_ai
9890vec_slo(vector signed char __a, vector unsigned char __b) {
9891 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9892 (vector int)__b);
9893}
9894
9895static __inline__ vector unsigned char __ATTRS_o_ai
9896vec_slo(vector unsigned char __a, vector signed char __b) {
9897 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9898 (vector int)__b);
9899}
9900
9901static __inline__ vector unsigned char __ATTRS_o_ai
9902vec_slo(vector unsigned char __a, vector unsigned char __b) {
9903 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9904 (vector int)__b);
9905}
9906
9907static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9908 vector signed char __b) {
9909 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9910}
9911
9912static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9913 vector unsigned char __b) {
9914 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9915}
9916
9917static __inline__ vector unsigned short __ATTRS_o_ai
9918vec_slo(vector unsigned short __a, vector signed char __b) {
9919 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9920 (vector int)__b);
9921}
9922
9923static __inline__ vector unsigned short __ATTRS_o_ai
9924vec_slo(vector unsigned short __a, vector unsigned char __b) {
9925 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9926 (vector int)__b);
9927}
9928
9929static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9930 vector signed char __b) {
9931 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9932}
9933
9934static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9935 vector unsigned char __b) {
9936 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9937}
9938
9939static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9940 vector signed char __b) {
9941 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9942}
9943
9944static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9945 vector unsigned char __b) {
9946 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9947}
9948
9949static __inline__ vector unsigned int __ATTRS_o_ai
9950vec_slo(vector unsigned int __a, vector signed char __b) {
9951 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9952 (vector int)__b);
9953}
9954
9955static __inline__ vector unsigned int __ATTRS_o_ai
9956vec_slo(vector unsigned int __a, vector unsigned char __b) {
9957 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9958 (vector int)__b);
9959}
9960
9961static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9962 vector signed char __b) {
9963 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9964}
9965
9966static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9967 vector unsigned char __b) {
9968 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9969}
9970
9971#ifdef __VSX__
9972static __inline__ vector signed long long __ATTRS_o_ai
9973vec_slo(vector signed long long __a, vector signed char __b) {
9974 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9975 (vector int)__b);
9976}
9977
9978static __inline__ vector signed long long __ATTRS_o_ai
9979vec_slo(vector signed long long __a, vector unsigned char __b) {
9980 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9981 (vector int)__b);
9982}
9983
9984static __inline__ vector unsigned long long __ATTRS_o_ai
9985vec_slo(vector unsigned long long __a, vector signed char __b) {
9986 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9987 (vector int)__b);
9988}
9989
9990static __inline__ vector unsigned long long __ATTRS_o_ai
9991vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9992 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9993 (vector int)__b);
9994}
9995#endif
9996
9997/* vec_vslo */
9998
9999static __inline__ vector signed char __ATTRS_o_ai
10000vec_vslo(vector signed char __a, vector signed char __b) {
10001 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10002 (vector int)__b);
10003}
10004
10005static __inline__ vector signed char __ATTRS_o_ai
10006vec_vslo(vector signed char __a, vector unsigned char __b) {
10007 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10008 (vector int)__b);
10009}
10010
10011static __inline__ vector unsigned char __ATTRS_o_ai
10012vec_vslo(vector unsigned char __a, vector signed char __b) {
10013 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10014 (vector int)__b);
10015}
10016
10017static __inline__ vector unsigned char __ATTRS_o_ai
10018vec_vslo(vector unsigned char __a, vector unsigned char __b) {
10019 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10020 (vector int)__b);
10021}
10022
10023static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10024 vector signed char __b) {
10025 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10026}
10027
10028static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10029 vector unsigned char __b) {
10030 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10031}
10032
10033static __inline__ vector unsigned short __ATTRS_o_ai
10034vec_vslo(vector unsigned short __a, vector signed char __b) {
10035 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10036 (vector int)__b);
10037}
10038
10039static __inline__ vector unsigned short __ATTRS_o_ai
10040vec_vslo(vector unsigned short __a, vector unsigned char __b) {
10041 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10042 (vector int)__b);
10043}
10044
10045static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10046 vector signed char __b) {
10047 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10048}
10049
10050static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10051 vector unsigned char __b) {
10052 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10053}
10054
10055static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10056 vector signed char __b) {
10057 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10058}
10059
10060static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10061 vector unsigned char __b) {
10062 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10063}
10064
10065static __inline__ vector unsigned int __ATTRS_o_ai
10066vec_vslo(vector unsigned int __a, vector signed char __b) {
10067 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10068 (vector int)__b);
10069}
10070
10071static __inline__ vector unsigned int __ATTRS_o_ai
10072vec_vslo(vector unsigned int __a, vector unsigned char __b) {
10073 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10074 (vector int)__b);
10075}
10076
10077static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10078 vector signed char __b) {
10079 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10080}
10081
10082static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10083 vector unsigned char __b) {
10084 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10085}
10086
10087/* vec_splat */
10088
10089static __inline__ vector signed char __ATTRS_o_ai
10090vec_splat(vector signed char __a, unsigned const int __b) {
10091 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10092}
10093
10094static __inline__ vector unsigned char __ATTRS_o_ai
10095vec_splat(vector unsigned char __a, unsigned const int __b) {
10096 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10097}
10098
10099static __inline__ vector bool char __ATTRS_o_ai
10100vec_splat(vector bool char __a, unsigned const int __b) {
10101 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10102}
10103
10104static __inline__ vector signed short __ATTRS_o_ai
10105vec_splat(vector signed short __a, unsigned const int __b) {
10106 unsigned char b0 = (__b & 0x07) * 2;
10107 unsigned char b1 = b0 + 1;
10108 return vec_perm(__a, __a,
10109 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10110 b0, b1, b0, b1, b0, b1));
10111}
10112
10113static __inline__ vector unsigned short __ATTRS_o_ai
10114vec_splat(vector unsigned short __a, unsigned const int __b) {
10115 unsigned char b0 = (__b & 0x07) * 2;
10116 unsigned char b1 = b0 + 1;
10117 return vec_perm(__a, __a,
10118 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10119 b0, b1, b0, b1, b0, b1));
10120}
10121
10122static __inline__ vector bool short __ATTRS_o_ai
10123vec_splat(vector bool short __a, unsigned const int __b) {
10124 unsigned char b0 = (__b & 0x07) * 2;
10125 unsigned char b1 = b0 + 1;
10126 return vec_perm(__a, __a,
10127 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10128 b0, b1, b0, b1, b0, b1));
10129}
10130
10131static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
10132 unsigned const int __b) {
10133 unsigned char b0 = (__b & 0x07) * 2;
10134 unsigned char b1 = b0 + 1;
10135 return vec_perm(__a, __a,
10136 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10137 b0, b1, b0, b1, b0, b1));
10138}
10139
10140static __inline__ vector signed int __ATTRS_o_ai
10141vec_splat(vector signed int __a, unsigned const int __b) {
10142 unsigned char b0 = (__b & 0x03) * 4;
10143 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10144 return vec_perm(__a, __a,
10145 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10146 b2, b3, b0, b1, b2, b3));
10147}
10148
10149static __inline__ vector unsigned int __ATTRS_o_ai
10150vec_splat(vector unsigned int __a, unsigned const int __b) {
10151 unsigned char b0 = (__b & 0x03) * 4;
10152 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10153 return vec_perm(__a, __a,
10154 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10155 b2, b3, b0, b1, b2, b3));
10156}
10157
10158static __inline__ vector bool int __ATTRS_o_ai
10159vec_splat(vector bool int __a, unsigned const int __b) {
10160 unsigned char b0 = (__b & 0x03) * 4;
10161 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10162 return vec_perm(__a, __a,
10163 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10164 b2, b3, b0, b1, b2, b3));
10165}
10166
10167static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
10168 unsigned const int __b) {
10169 unsigned char b0 = (__b & 0x03) * 4;
10170 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10171 return vec_perm(__a, __a,
10172 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10173 b2, b3, b0, b1, b2, b3));
10174}
10175
10176#ifdef __VSX__
10177static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
10178 unsigned const int __b) {
10179 unsigned char b0 = (__b & 0x01) * 8;
10180 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10181 b6 = b0 + 6, b7 = b0 + 7;
10182 return vec_perm(__a, __a,
10183 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10184 b2, b3, b4, b5, b6, b7));
10185}
10186static __inline__ vector bool long long __ATTRS_o_ai
10187vec_splat(vector bool long long __a, unsigned const int __b) {
10188 unsigned char b0 = (__b & 0x01) * 8;
10189 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10190 b6 = b0 + 6, b7 = b0 + 7;
10191 return vec_perm(__a, __a,
10192 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10193 b2, b3, b4, b5, b6, b7));
10194}
10195static __inline__ vector signed long long __ATTRS_o_ai
10196vec_splat(vector signed long long __a, unsigned const int __b) {
10197 unsigned char b0 = (__b & 0x01) * 8;
10198 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10199 b6 = b0 + 6, b7 = b0 + 7;
10200 return vec_perm(__a, __a,
10201 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10202 b2, b3, b4, b5, b6, b7));
10203}
10204static __inline__ vector unsigned long long __ATTRS_o_ai
10205vec_splat(vector unsigned long long __a, unsigned const int __b) {
10206 unsigned char b0 = (__b & 0x01) * 8;
10207 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10208 b6 = b0 + 6, b7 = b0 + 7;
10209 return vec_perm(__a, __a,
10210 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10211 b2, b3, b4, b5, b6, b7));
10212}
10213#endif
10214
10215/* vec_vspltb */
10216
10217#define __builtin_altivec_vspltb vec_vspltb
10218
10219static __inline__ vector signed char __ATTRS_o_ai
10220vec_vspltb(vector signed char __a, unsigned char __b) {
10221 return vec_perm(__a, __a, (vector unsigned char)(__b));
10222}
10223
10224static __inline__ vector unsigned char __ATTRS_o_ai
10225vec_vspltb(vector unsigned char __a, unsigned char __b) {
10226 return vec_perm(__a, __a, (vector unsigned char)(__b));
10227}
10228
10229static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
10230 unsigned char __b) {
10231 return vec_perm(__a, __a, (vector unsigned char)(__b));
10232}
10233
10234/* vec_vsplth */
10235
10236#define __builtin_altivec_vsplth vec_vsplth
10237
10238static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
10239 unsigned char __b) {
10240 __b *= 2;
10241 unsigned char b1 = __b + 1;
10242 return vec_perm(__a, __a,
10243 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10244 __b, b1, __b, b1, __b, b1, __b, b1));
10245}
10246
10247static __inline__ vector unsigned short __ATTRS_o_ai
10248vec_vsplth(vector unsigned short __a, unsigned char __b) {
10249 __b *= 2;
10250 unsigned char b1 = __b + 1;
10251 return vec_perm(__a, __a,
10252 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10253 __b, b1, __b, b1, __b, b1, __b, b1));
10254}
10255
10256static __inline__ vector bool short __ATTRS_o_ai
10257vec_vsplth(vector bool short __a, unsigned char __b) {
10258 __b *= 2;
10259 unsigned char b1 = __b + 1;
10260 return vec_perm(__a, __a,
10261 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10262 __b, b1, __b, b1, __b, b1, __b, b1));
10263}
10264
10265static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
10266 unsigned char __b) {
10267 __b *= 2;
10268 unsigned char b1 = __b + 1;
10269 return vec_perm(__a, __a,
10270 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10271 __b, b1, __b, b1, __b, b1, __b, b1));
10272}
10273
10274/* vec_vspltw */
10275
10276#define __builtin_altivec_vspltw vec_vspltw
10277
10278static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
10279 unsigned char __b) {
10280 __b *= 4;
10281 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10282 return vec_perm(__a, __a,
10283 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10284 b1, b2, b3, __b, b1, b2, b3));
10285}
10286
10287static __inline__ vector unsigned int __ATTRS_o_ai
10288vec_vspltw(vector unsigned int __a, unsigned char __b) {
10289 __b *= 4;
10290 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10291 return vec_perm(__a, __a,
10292 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10293 b1, b2, b3, __b, b1, b2, b3));
10294}
10295
10296static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
10297 unsigned char __b) {
10298 __b *= 4;
10299 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10300 return vec_perm(__a, __a,
10301 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10302 b1, b2, b3, __b, b1, b2, b3));
10303}
10304
10305static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
10306 unsigned char __b) {
10307 __b *= 4;
10308 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10309 return vec_perm(__a, __a,
10310 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10311 b1, b2, b3, __b, b1, b2, b3));
10312}
10313
10314/* vec_splat_s8 */
10315
10316#define __builtin_altivec_vspltisb vec_splat_s8
10317
10318// FIXME: parameter should be treated as 5-bit signed literal
10319static __inline__ vector signed char __ATTRS_o_ai
10320vec_splat_s8(signed char __a) {
10321 return (vector signed char)(__a);
10322}
10323
10324/* vec_vspltisb */
10325
10326// FIXME: parameter should be treated as 5-bit signed literal
10327static __inline__ vector signed char __ATTRS_o_ai
10328vec_vspltisb(signed char __a) {
10329 return (vector signed char)(__a);
10330}
10331
10332/* vec_splat_s16 */
10333
10334#define __builtin_altivec_vspltish vec_splat_s16
10335
10336// FIXME: parameter should be treated as 5-bit signed literal
10337static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
10338 return (vector short)(__a);
10339}
10340
10341/* vec_vspltish */
10342
10343// FIXME: parameter should be treated as 5-bit signed literal
10344static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
10345 return (vector short)(__a);
10346}
10347
10348/* vec_splat_s32 */
10349
10350#define __builtin_altivec_vspltisw vec_splat_s32
10351
10352// FIXME: parameter should be treated as 5-bit signed literal
10353static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
10354 return (vector int)(__a);
10355}
10356
10357/* vec_vspltisw */
10358
10359// FIXME: parameter should be treated as 5-bit signed literal
10360static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
10361 return (vector int)(__a);
10362}
10363
10364/* vec_splat_u8 */
10365
10366// FIXME: parameter should be treated as 5-bit signed literal
10367static __inline__ vector unsigned char __ATTRS_o_ai
10368vec_splat_u8(unsigned char __a) {
10369 return (vector unsigned char)(__a);
10370}
10371
10372/* vec_splat_u16 */
10373
10374// FIXME: parameter should be treated as 5-bit signed literal
10375static __inline__ vector unsigned short __ATTRS_o_ai
10376vec_splat_u16(signed char __a) {
10377 return (vector unsigned short)(__a);
10378}
10379
10380/* vec_splat_u32 */
10381
10382// FIXME: parameter should be treated as 5-bit signed literal
10383static __inline__ vector unsigned int __ATTRS_o_ai
10384vec_splat_u32(signed char __a) {
10385 return (vector unsigned int)(__a);
10386}
10387
10388/* vec_sr */
10389
10390// vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
10391// than the length of __a.
10392static __inline__ vector unsigned char __ATTRS_o_ai
10393vec_sr(vector unsigned char __a, vector unsigned char __b) {
10394 return __a >>
10395 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
10396}
10397
10398static __inline__ vector signed char __ATTRS_o_ai
10399vec_sr(vector signed char __a, vector unsigned char __b) {
10400 return (vector signed char)vec_sr((vector unsigned char)__a, __b);
10401}
10402
10403static __inline__ vector unsigned short __ATTRS_o_ai
10404vec_sr(vector unsigned short __a, vector unsigned short __b) {
10405 return __a >>
10406 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
10407}
10408
10409static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
10410 vector unsigned short __b) {
10411 return (vector short)vec_sr((vector unsigned short)__a, __b);
10412}
10413
10414static __inline__ vector unsigned int __ATTRS_o_ai
10415vec_sr(vector unsigned int __a, vector unsigned int __b) {
10416 return __a >>
10417 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
10418}
10419
10420static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
10421 vector unsigned int __b) {
10422 return (vector int)vec_sr((vector unsigned int)__a, __b);
10423}
10424
10425#ifdef __POWER8_VECTOR__
10426static __inline__ vector unsigned long long __ATTRS_o_ai
10427vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10428 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
10429 __CHAR_BIT__));
10430}
10431
10432static __inline__ vector long long __ATTRS_o_ai
10433vec_sr(vector long long __a, vector unsigned long long __b) {
10434 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10435}
10436#elif defined(__VSX__)
10437static __inline__ vector unsigned long long __ATTRS_o_ai
10438vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10439 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10440
10441 // Big endian element zero (the left doubleword) can be right shifted as-is.
10442 // However the shift amount must be in the right doubleword.
10443 // The other element needs to be swapped into the left doubleword and
10444 // shifted. Then the left doublewords of the two result vectors are merged.
10445 vector unsigned long long __swapshift =
10446 __builtin_shufflevector(__b, __b, 1, 0);
10447 vector unsigned long long __leftelt =
10448 (vector unsigned long long)__builtin_altivec_vsro(
10449 (vector signed int)__a, (vector signed int)__swapshift);
10450#ifdef __LITTLE_ENDIAN__
10451 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10452 (vector signed int)__leftelt,
10453 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0));
10454#else
10455 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10456 (vector signed int)__leftelt,
10457 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15));
10458#endif
10459 __a = __builtin_shufflevector(__a, __a, 1, 0);
10460 vector unsigned long long __rightelt =
10461 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a,
10462 (vector signed int)__b);
10463#ifdef __LITTLE_ENDIAN__
10464 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10465 (vector signed int)__rightelt,
10466 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
10467 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3);
10468#else
10469 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10470 (vector signed int)__rightelt,
10471 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
10472 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2);
10473#endif
10474}
10475
10476static __inline__ vector long long __ATTRS_o_ai
10477vec_sr(vector long long __a, vector unsigned long long __b) {
10478 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10479}
10480#endif /* __VSX__ */
10481
10482/* vec_vsrb */
10483
10484#define __builtin_altivec_vsrb vec_vsrb
10485
10486static __inline__ vector signed char __ATTRS_o_ai
10487vec_vsrb(vector signed char __a, vector unsigned char __b) {
10488 return vec_sr(__a, __b);
10489}
10490
10491static __inline__ vector unsigned char __ATTRS_o_ai
10492vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
10493 return vec_sr(__a, __b);
10494}
10495
10496/* vec_vsrh */
10497
10498#define __builtin_altivec_vsrh vec_vsrh
10499
10500static __inline__ vector short __ATTRS_o_ai
10501vec_vsrh(vector short __a, vector unsigned short __b) {
10502 return vec_sr(__a, __b);
10503}
10504
10505static __inline__ vector unsigned short __ATTRS_o_ai
10506vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
10507 return vec_sr(__a, __b);
10508}
10509
10510/* vec_vsrw */
10511
10512#define __builtin_altivec_vsrw vec_vsrw
10513
10514static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
10515 vector unsigned int __b) {
10516 return vec_sr(__a, __b);
10517}
10518
10519static __inline__ vector unsigned int __ATTRS_o_ai
10520vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
10521 return vec_sr(__a, __b);
10522}
10523
10524/* vec_sra */
10525
10526static __inline__ vector signed char __ATTRS_o_ai
10527vec_sra(vector signed char __a, vector unsigned char __b) {
10528 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10529}
10530
10531static __inline__ vector unsigned char __ATTRS_o_ai
10532vec_sra(vector unsigned char __a, vector unsigned char __b) {
10533 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10534}
10535
10536static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
10537 vector unsigned short __b) {
10538 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10539}
10540
10541static __inline__ vector unsigned short __ATTRS_o_ai
10542vec_sra(vector unsigned short __a, vector unsigned short __b) {
10543 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10544}
10545
10546static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
10547 vector unsigned int __b) {
10548 return __builtin_altivec_vsraw(__a, __b);
10549}
10550
10551static __inline__ vector unsigned int __ATTRS_o_ai
10552vec_sra(vector unsigned int __a, vector unsigned int __b) {
10553 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10554}
10555
10556#ifdef __POWER8_VECTOR__
10557static __inline__ vector signed long long __ATTRS_o_ai
10558vec_sra(vector signed long long __a, vector unsigned long long __b) {
10559 return __a >> __b;
10560}
10561
10562static __inline__ vector unsigned long long __ATTRS_o_ai
10563vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10564 return (vector unsigned long long)((vector signed long long)__a >> __b);
10565}
10566#elif defined(__VSX__)
10567static __inline__ vector signed long long __ATTRS_o_ai
10568vec_sra(vector signed long long __a, vector unsigned long long __b) {
10569 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10570 return __a >> __b;
10571}
10572
10573static __inline__ vector unsigned long long __ATTRS_o_ai
10574vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10575 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10576 return (vector unsigned long long)((vector signed long long)__a >> __b);
10577}
10578#endif /* __VSX__ */
10579
10580/* vec_vsrab */
10581
10582static __inline__ vector signed char __ATTRS_o_ai
10583vec_vsrab(vector signed char __a, vector unsigned char __b) {
10584 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10585}
10586
10587static __inline__ vector unsigned char __ATTRS_o_ai
10588vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
10589 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10590}
10591
10592/* vec_vsrah */
10593
10594static __inline__ vector short __ATTRS_o_ai
10595vec_vsrah(vector short __a, vector unsigned short __b) {
10596 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10597}
10598
10599static __inline__ vector unsigned short __ATTRS_o_ai
10600vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
10601 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10602}
10603
10604/* vec_vsraw */
10605
10606static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
10607 vector unsigned int __b) {
10608 return __builtin_altivec_vsraw(__a, __b);
10609}
10610
10611static __inline__ vector unsigned int __ATTRS_o_ai
10612vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
10613 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10614}
10615
10616/* vec_srl */
10617
10618static __inline__ vector signed char __ATTRS_o_ai
10619vec_srl(vector signed char __a, vector unsigned char __b) {
10620 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10621 (vector int)__b);
10622}
10623
10624static __inline__ vector signed char __ATTRS_o_ai
10625vec_srl(vector signed char __a, vector unsigned short __b) {
10626 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10627 (vector int)__b);
10628}
10629
10630static __inline__ vector signed char __ATTRS_o_ai
10631vec_srl(vector signed char __a, vector unsigned int __b) {
10632 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10633 (vector int)__b);
10634}
10635
10636static __inline__ vector unsigned char __ATTRS_o_ai
10637vec_srl(vector unsigned char __a, vector unsigned char __b) {
10638 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10639 (vector int)__b);
10640}
10641
10642static __inline__ vector unsigned char __ATTRS_o_ai
10643vec_srl(vector unsigned char __a, vector unsigned short __b) {
10644 return (vector unsigned 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 int __b) {
10650 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10651 (vector int)__b);
10652}
10653
10654static __inline__ vector bool char __ATTRS_o_ai
10655vec_srl(vector bool char __a, vector unsigned char __b) {
10656 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10657 (vector int)__b);
10658}
10659
10660static __inline__ vector bool char __ATTRS_o_ai
10661vec_srl(vector bool char __a, vector unsigned short __b) {
10662 return (vector bool 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 int __b) {
10668 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10669 (vector int)__b);
10670}
10671
10672static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10673 vector unsigned char __b) {
10674 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10675}
10676
10677static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10678 vector unsigned short __b) {
10679 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10680}
10681
10682static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10683 vector unsigned int __b) {
10684 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10685}
10686
10687static __inline__ vector unsigned short __ATTRS_o_ai
10688vec_srl(vector unsigned short __a, vector unsigned char __b) {
10689 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10690 (vector int)__b);
10691}
10692
10693static __inline__ vector unsigned short __ATTRS_o_ai
10694vec_srl(vector unsigned short __a, vector unsigned short __b) {
10695 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10696 (vector int)__b);
10697}
10698
10699static __inline__ vector unsigned short __ATTRS_o_ai
10700vec_srl(vector unsigned short __a, vector unsigned int __b) {
10701 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10702 (vector int)__b);
10703}
10704
10705static __inline__ vector bool short __ATTRS_o_ai
10706vec_srl(vector bool short __a, vector unsigned char __b) {
10707 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10708 (vector int)__b);
10709}
10710
10711static __inline__ vector bool short __ATTRS_o_ai
10712vec_srl(vector bool short __a, vector unsigned short __b) {
10713 return (vector bool 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 int __b) {
10719 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10720 (vector int)__b);
10721}
10722
10723static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10724 vector unsigned char __b) {
10725 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10726}
10727
10728static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10729 vector unsigned short __b) {
10730 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10731}
10732
10733static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10734 vector unsigned int __b) {
10735 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10736}
10737
10738static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10739 vector unsigned char __b) {
10740 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10741}
10742
10743static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10744 vector unsigned short __b) {
10745 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10746}
10747
10748static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10749 vector unsigned int __b) {
10750 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10751}
10752
10753static __inline__ vector unsigned int __ATTRS_o_ai
10754vec_srl(vector unsigned int __a, vector unsigned char __b) {
10755 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10756 (vector int)__b);
10757}
10758
10759static __inline__ vector unsigned int __ATTRS_o_ai
10760vec_srl(vector unsigned int __a, vector unsigned short __b) {
10761 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10762 (vector int)__b);
10763}
10764
10765static __inline__ vector unsigned int __ATTRS_o_ai
10766vec_srl(vector unsigned int __a, vector unsigned int __b) {
10767 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10768 (vector int)__b);
10769}
10770
10771static __inline__ vector bool int __ATTRS_o_ai
10772vec_srl(vector bool int __a, vector unsigned char __b) {
10773 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10774 (vector int)__b);
10775}
10776
10777static __inline__ vector bool int __ATTRS_o_ai
10778vec_srl(vector bool int __a, vector unsigned short __b) {
10779 return (vector bool 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 int __b) {
10785 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10786 (vector int)__b);
10787}
10788
10789#ifdef __VSX__
10790static __inline__ vector signed long long __ATTRS_o_ai
10791vec_srl(vector signed long long __a, vector unsigned char __b) {
10792 return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
10793 (vector int)__b);
10794}
10795
10796static __inline__ vector unsigned long long __ATTRS_o_ai
10797vec_srl(vector unsigned long long __a, vector unsigned char __b) {
10798 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
10799 (vector int)__b);
10800}
10801#endif
10802
10803/* vec_vsr */
10804
10805static __inline__ vector signed char __ATTRS_o_ai
10806vec_vsr(vector signed char __a, vector unsigned char __b) {
10807 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10808 (vector int)__b);
10809}
10810
10811static __inline__ vector signed char __ATTRS_o_ai
10812vec_vsr(vector signed char __a, vector unsigned short __b) {
10813 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10814 (vector int)__b);
10815}
10816
10817static __inline__ vector signed char __ATTRS_o_ai
10818vec_vsr(vector signed char __a, vector unsigned int __b) {
10819 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10820 (vector int)__b);
10821}
10822
10823static __inline__ vector unsigned char __ATTRS_o_ai
10824vec_vsr(vector unsigned char __a, vector unsigned char __b) {
10825 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10826 (vector int)__b);
10827}
10828
10829static __inline__ vector unsigned char __ATTRS_o_ai
10830vec_vsr(vector unsigned char __a, vector unsigned short __b) {
10831 return (vector unsigned 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 int __b) {
10837 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10838 (vector int)__b);
10839}
10840
10841static __inline__ vector bool char __ATTRS_o_ai
10842vec_vsr(vector bool char __a, vector unsigned char __b) {
10843 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10844 (vector int)__b);
10845}
10846
10847static __inline__ vector bool char __ATTRS_o_ai
10848vec_vsr(vector bool char __a, vector unsigned short __b) {
10849 return (vector bool 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 int __b) {
10855 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10856 (vector int)__b);
10857}
10858
10859static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10860 vector unsigned char __b) {
10861 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10862}
10863
10864static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10865 vector unsigned short __b) {
10866 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10867}
10868
10869static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10870 vector unsigned int __b) {
10871 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10872}
10873
10874static __inline__ vector unsigned short __ATTRS_o_ai
10875vec_vsr(vector unsigned short __a, vector unsigned char __b) {
10876 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10877 (vector int)__b);
10878}
10879
10880static __inline__ vector unsigned short __ATTRS_o_ai
10881vec_vsr(vector unsigned short __a, vector unsigned short __b) {
10882 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10883 (vector int)__b);
10884}
10885
10886static __inline__ vector unsigned short __ATTRS_o_ai
10887vec_vsr(vector unsigned short __a, vector unsigned int __b) {
10888 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10889 (vector int)__b);
10890}
10891
10892static __inline__ vector bool short __ATTRS_o_ai
10893vec_vsr(vector bool short __a, vector unsigned char __b) {
10894 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10895 (vector int)__b);
10896}
10897
10898static __inline__ vector bool short __ATTRS_o_ai
10899vec_vsr(vector bool short __a, vector unsigned short __b) {
10900 return (vector bool 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 int __b) {
10906 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10907 (vector int)__b);
10908}
10909
10910static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10911 vector unsigned char __b) {
10912 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10913}
10914
10915static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10916 vector unsigned short __b) {
10917 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10918}
10919
10920static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10921 vector unsigned int __b) {
10922 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10923}
10924
10925static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10926 vector unsigned char __b) {
10927 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10928}
10929
10930static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10931 vector unsigned short __b) {
10932 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10933}
10934
10935static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10936 vector unsigned int __b) {
10937 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10938}
10939
10940static __inline__ vector unsigned int __ATTRS_o_ai
10941vec_vsr(vector unsigned int __a, vector unsigned char __b) {
10942 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10943 (vector int)__b);
10944}
10945
10946static __inline__ vector unsigned int __ATTRS_o_ai
10947vec_vsr(vector unsigned int __a, vector unsigned short __b) {
10948 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10949 (vector int)__b);
10950}
10951
10952static __inline__ vector unsigned int __ATTRS_o_ai
10953vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10954 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10955 (vector int)__b);
10956}
10957
10958static __inline__ vector bool int __ATTRS_o_ai
10959vec_vsr(vector bool int __a, vector unsigned char __b) {
10960 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10961 (vector int)__b);
10962}
10963
10964static __inline__ vector bool int __ATTRS_o_ai
10965vec_vsr(vector bool int __a, vector unsigned short __b) {
10966 return (vector bool 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 int __b) {
10972 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10973 (vector int)__b);
10974}
10975
10976/* vec_sro */
10977
10978static __inline__ vector signed char __ATTRS_o_ai
10979vec_sro(vector signed char __a, vector signed char __b) {
10980 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10981 (vector int)__b);
10982}
10983
10984static __inline__ vector signed char __ATTRS_o_ai
10985vec_sro(vector signed char __a, vector unsigned char __b) {
10986 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10987 (vector int)__b);
10988}
10989
10990static __inline__ vector unsigned char __ATTRS_o_ai
10991vec_sro(vector unsigned char __a, vector signed char __b) {
10992 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10993 (vector int)__b);
10994}
10995
10996static __inline__ vector unsigned char __ATTRS_o_ai
10997vec_sro(vector unsigned char __a, vector unsigned char __b) {
10998 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10999 (vector int)__b);
11000}
11001
11002static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11003 vector signed char __b) {
11004 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11005}
11006
11007static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11008 vector unsigned char __b) {
11009 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11010}
11011
11012static __inline__ vector unsigned short __ATTRS_o_ai
11013vec_sro(vector unsigned short __a, vector signed char __b) {
11014 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11015 (vector int)__b);
11016}
11017
11018static __inline__ vector unsigned short __ATTRS_o_ai
11019vec_sro(vector unsigned short __a, vector unsigned char __b) {
11020 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11021 (vector int)__b);
11022}
11023
11024static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11025 vector signed char __b) {
11026 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11027}
11028
11029static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11030 vector unsigned char __b) {
11031 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11032}
11033
11034static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11035 vector signed char __b) {
11036 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11037}
11038
11039static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11040 vector unsigned char __b) {
11041 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11042}
11043
11044static __inline__ vector unsigned int __ATTRS_o_ai
11045vec_sro(vector unsigned int __a, vector signed char __b) {
11046 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11047 (vector int)__b);
11048}
11049
11050static __inline__ vector unsigned int __ATTRS_o_ai
11051vec_sro(vector unsigned int __a, vector unsigned char __b) {
11052 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11053 (vector int)__b);
11054}
11055
11056static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11057 vector signed char __b) {
11058 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11059}
11060
11061static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11062 vector unsigned char __b) {
11063 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11064}
11065
11066#ifdef __VSX__
11067static __inline__ vector signed long long __ATTRS_o_ai
11068vec_sro(vector signed long long __a, vector signed char __b) {
11069 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11070 (vector int)__b);
11071}
11072
11073static __inline__ vector signed long long __ATTRS_o_ai
11074vec_sro(vector signed long long __a, vector unsigned char __b) {
11075 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11076 (vector int)__b);
11077}
11078
11079static __inline__ vector unsigned long long __ATTRS_o_ai
11080vec_sro(vector unsigned long long __a, vector signed char __b) {
11081 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11082 (vector int)__b);
11083}
11084
11085static __inline__ vector unsigned long long __ATTRS_o_ai
11086vec_sro(vector unsigned long long __a, vector unsigned char __b) {
11087 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11088 (vector int)__b);
11089}
11090#endif
11091
11092/* vec_vsro */
11093
11094static __inline__ vector signed char __ATTRS_o_ai
11095vec_vsro(vector signed char __a, vector signed char __b) {
11096 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11097 (vector int)__b);
11098}
11099
11100static __inline__ vector signed char __ATTRS_o_ai
11101vec_vsro(vector signed char __a, vector unsigned char __b) {
11102 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11103 (vector int)__b);
11104}
11105
11106static __inline__ vector unsigned char __ATTRS_o_ai
11107vec_vsro(vector unsigned char __a, vector signed char __b) {
11108 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11109 (vector int)__b);
11110}
11111
11112static __inline__ vector unsigned char __ATTRS_o_ai
11113vec_vsro(vector unsigned char __a, vector unsigned char __b) {
11114 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11115 (vector int)__b);
11116}
11117
11118static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11119 vector signed char __b) {
11120 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11121}
11122
11123static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11124 vector unsigned char __b) {
11125 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11126}
11127
11128static __inline__ vector unsigned short __ATTRS_o_ai
11129vec_vsro(vector unsigned short __a, vector signed char __b) {
11130 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11131 (vector int)__b);
11132}
11133
11134static __inline__ vector unsigned short __ATTRS_o_ai
11135vec_vsro(vector unsigned short __a, vector unsigned char __b) {
11136 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11137 (vector int)__b);
11138}
11139
11140static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11141 vector signed char __b) {
11142 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11143}
11144
11145static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11146 vector unsigned char __b) {
11147 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11148}
11149
11150static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11151 vector signed char __b) {
11152 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11153}
11154
11155static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11156 vector unsigned char __b) {
11157 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11158}
11159
11160static __inline__ vector unsigned int __ATTRS_o_ai
11161vec_vsro(vector unsigned int __a, vector signed char __b) {
11162 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11163 (vector int)__b);
11164}
11165
11166static __inline__ vector unsigned int __ATTRS_o_ai
11167vec_vsro(vector unsigned int __a, vector unsigned char __b) {
11168 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11169 (vector int)__b);
11170}
11171
11172static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11173 vector signed char __b) {
11174 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11175}
11176
11177static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11178 vector unsigned char __b) {
11179 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11180}
11181
11182/* vec_st */
11183
11184static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11185 vector signed char *__c) {
11186 __builtin_altivec_stvx((vector int)__a, __b, __c);
11187}
11188
11189static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11190 signed char *__c) {
11191 __builtin_altivec_stvx((vector int)__a, __b, __c);
11192}
11193
11194static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11195 vector unsigned char *__c) {
11196 __builtin_altivec_stvx((vector int)__a, __b, __c);
11197}
11198
11199static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11200 unsigned char *__c) {
11201 __builtin_altivec_stvx((vector int)__a, __b, __c);
11202}
11203
11204static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11205 signed char *__c) {
11206 __builtin_altivec_stvx((vector int)__a, __b, __c);
11207}
11208
11209static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11210 unsigned char *__c) {
11211 __builtin_altivec_stvx((vector int)__a, __b, __c);
11212}
11213
11214static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11215 vector bool char *__c) {
11216 __builtin_altivec_stvx((vector int)__a, __b, __c);
11217}
11218
11219static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11220 vector short *__c) {
11221 __builtin_altivec_stvx((vector int)__a, __b, __c);
11222}
11223
11224static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11225 short *__c) {
11226 __builtin_altivec_stvx((vector int)__a, __b, __c);
11227}
11228
11229static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11230 vector unsigned short *__c) {
11231 __builtin_altivec_stvx((vector int)__a, __b, __c);
11232}
11233
11234static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11235 unsigned short *__c) {
11236 __builtin_altivec_stvx((vector int)__a, __b, __c);
11237}
11238
11239static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11240 short *__c) {
11241 __builtin_altivec_stvx((vector int)__a, __b, __c);
11242}
11243
11244static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11245 unsigned short *__c) {
11246 __builtin_altivec_stvx((vector int)__a, __b, __c);
11247}
11248
11249static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11250 vector bool short *__c) {
11251 __builtin_altivec_stvx((vector int)__a, __b, __c);
11252}
11253
11254static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11255 short *__c) {
11256 __builtin_altivec_stvx((vector int)__a, __b, __c);
11257}
11258
11259static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11260 unsigned short *__c) {
11261 __builtin_altivec_stvx((vector int)__a, __b, __c);
11262}
11263
11264static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11265 vector pixel *__c) {
11266 __builtin_altivec_stvx((vector int)__a, __b, __c);
11267}
11268
11269static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b,
11270 vector int *__c) {
11271 __builtin_altivec_stvx(__a, __b, __c);
11272}
11273
11274static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) {
11275 __builtin_altivec_stvx(__a, __b, __c);
11276}
11277
11278static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11279 vector unsigned int *__c) {
11280 __builtin_altivec_stvx((vector int)__a, __b, __c);
11281}
11282
11283static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11284 unsigned int *__c) {
11285 __builtin_altivec_stvx((vector int)__a, __b, __c);
11286}
11287
11288static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11289 int *__c) {
11290 __builtin_altivec_stvx((vector int)__a, __b, __c);
11291}
11292
11293static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11294 unsigned int *__c) {
11295 __builtin_altivec_stvx((vector int)__a, __b, __c);
11296}
11297
11298static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11299 vector bool int *__c) {
11300 __builtin_altivec_stvx((vector int)__a, __b, __c);
11301}
11302
11303static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11304 vector float *__c) {
11305 __builtin_altivec_stvx((vector int)__a, __b, __c);
11306}
11307
11308static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11309 float *__c) {
11310 __builtin_altivec_stvx((vector int)__a, __b, __c);
11311}
11312
11313/* vec_stvx */
11314
11315static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11316 vector signed char *__c) {
11317 __builtin_altivec_stvx((vector int)__a, __b, __c);
11318}
11319
11320static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11321 signed char *__c) {
11322 __builtin_altivec_stvx((vector int)__a, __b, __c);
11323}
11324
11325static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11326 vector unsigned char *__c) {
11327 __builtin_altivec_stvx((vector int)__a, __b, __c);
11328}
11329
11330static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11331 unsigned char *__c) {
11332 __builtin_altivec_stvx((vector int)__a, __b, __c);
11333}
11334
11335static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11336 signed char *__c) {
11337 __builtin_altivec_stvx((vector int)__a, __b, __c);
11338}
11339
11340static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11341 unsigned char *__c) {
11342 __builtin_altivec_stvx((vector int)__a, __b, __c);
11343}
11344
11345static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11346 vector bool char *__c) {
11347 __builtin_altivec_stvx((vector int)__a, __b, __c);
11348}
11349
11350static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11351 vector short *__c) {
11352 __builtin_altivec_stvx((vector int)__a, __b, __c);
11353}
11354
11355static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11356 short *__c) {
11357 __builtin_altivec_stvx((vector int)__a, __b, __c);
11358}
11359
11360static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11361 vector unsigned short *__c) {
11362 __builtin_altivec_stvx((vector int)__a, __b, __c);
11363}
11364
11365static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11366 unsigned short *__c) {
11367 __builtin_altivec_stvx((vector int)__a, __b, __c);
11368}
11369
11370static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11371 short *__c) {
11372 __builtin_altivec_stvx((vector int)__a, __b, __c);
11373}
11374
11375static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11376 unsigned short *__c) {
11377 __builtin_altivec_stvx((vector int)__a, __b, __c);
11378}
11379
11380static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11381 vector bool short *__c) {
11382 __builtin_altivec_stvx((vector int)__a, __b, __c);
11383}
11384
11385static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11386 short *__c) {
11387 __builtin_altivec_stvx((vector int)__a, __b, __c);
11388}
11389
11390static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11391 unsigned short *__c) {
11392 __builtin_altivec_stvx((vector int)__a, __b, __c);
11393}
11394
11395static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11396 vector pixel *__c) {
11397 __builtin_altivec_stvx((vector int)__a, __b, __c);
11398}
11399
11400static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11401 vector int *__c) {
11402 __builtin_altivec_stvx(__a, __b, __c);
11403}
11404
11405static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11406 int *__c) {
11407 __builtin_altivec_stvx(__a, __b, __c);
11408}
11409
11410static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11411 vector unsigned int *__c) {
11412 __builtin_altivec_stvx((vector int)__a, __b, __c);
11413}
11414
11415static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11416 unsigned int *__c) {
11417 __builtin_altivec_stvx((vector int)__a, __b, __c);
11418}
11419
11420static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11421 int *__c) {
11422 __builtin_altivec_stvx((vector int)__a, __b, __c);
11423}
11424
11425static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11426 unsigned int *__c) {
11427 __builtin_altivec_stvx((vector int)__a, __b, __c);
11428}
11429
11430static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11431 vector bool int *__c) {
11432 __builtin_altivec_stvx((vector int)__a, __b, __c);
11433}
11434
11435static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11436 vector float *__c) {
11437 __builtin_altivec_stvx((vector int)__a, __b, __c);
11438}
11439
11440static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11441 float *__c) {
11442 __builtin_altivec_stvx((vector int)__a, __b, __c);
11443}
11444
11445/* vec_ste */
11446
11447static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b,
11448 signed char *__c) {
11449 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11450}
11451
11452static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b,
11453 unsigned char *__c) {
11454 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11455}
11456
11457static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11458 signed char *__c) {
11459 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11460}
11461
11462static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11463 unsigned char *__c) {
11464 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11465}
11466
11467static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b,
11468 short *__c) {
11469 __builtin_altivec_stvehx(__a, __b, __c);
11470}
11471
11472static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b,
11473 unsigned short *__c) {
11474 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11475}
11476
11477static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11478 short *__c) {
11479 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11480}
11481
11482static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11483 unsigned short *__c) {
11484 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11485}
11486
11487static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11488 short *__c) {
11489 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11490}
11491
11492static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11493 unsigned short *__c) {
11494 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11495}
11496
11497static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) {
11498 __builtin_altivec_stvewx(__a, __b, __c);
11499}
11500
11501static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b,
11502 unsigned int *__c) {
11503 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11504}
11505
11506static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11507 int *__c) {
11508 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11509}
11510
11511static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11512 unsigned int *__c) {
11513 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11514}
11515
11516static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b,
11517 float *__c) {
11518 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11519}
11520
11521/* vec_stvebx */
11522
11523static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b,
11524 signed char *__c) {
11525 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11526}
11527
11528static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
11529 long __b, unsigned char *__c) {
11530 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11531}
11532
11533static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11534 signed char *__c) {
11535 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11536}
11537
11538static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11539 unsigned char *__c) {
11540 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11541}
11542
11543/* vec_stvehx */
11544
11545static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b,
11546 short *__c) {
11547 __builtin_altivec_stvehx(__a, __b, __c);
11548}
11549
11550static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
11551 long __b, unsigned short *__c) {
11552 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11553}
11554
11555static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11556 short *__c) {
11557 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11558}
11559
11560static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11561 unsigned short *__c) {
11562 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11563}
11564
11565static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11566 short *__c) {
11567 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11568}
11569
11570static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11571 unsigned short *__c) {
11572 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11573}
11574
11575/* vec_stvewx */
11576
11577static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b,
11578 int *__c) {
11579 __builtin_altivec_stvewx(__a, __b, __c);
11580}
11581
11582static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b,
11583 unsigned int *__c) {
11584 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11585}
11586
11587static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11588 int *__c) {
11589 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11590}
11591
11592static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11593 unsigned int *__c) {
11594 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11595}
11596
11597static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b,
11598 float *__c) {
11599 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11600}
11601
11602/* vec_stl */
11603
11604static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11605 vector signed char *__c) {
11606 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11607}
11608
11609static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11610 signed char *__c) {
11611 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11612}
11613
11614static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11615 vector unsigned char *__c) {
11616 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11617}
11618
11619static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11620 unsigned char *__c) {
11621 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11622}
11623
11624static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11625 signed char *__c) {
11626 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11627}
11628
11629static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11630 unsigned char *__c) {
11631 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11632}
11633
11634static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11635 vector bool char *__c) {
11636 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11637}
11638
11639static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11640 vector short *__c) {
11641 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11642}
11643
11644static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11645 short *__c) {
11646 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11647}
11648
11649static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11650 vector unsigned short *__c) {
11651 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11652}
11653
11654static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11655 unsigned short *__c) {
11656 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11657}
11658
11659static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11660 short *__c) {
11661 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11662}
11663
11664static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11665 unsigned short *__c) {
11666 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11667}
11668
11669static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11670 vector bool short *__c) {
11671 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11672}
11673
11674static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11675 short *__c) {
11676 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11677}
11678
11679static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11680 unsigned short *__c) {
11681 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11682}
11683
11684static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11685 vector pixel *__c) {
11686 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11687}
11688
11689static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
11690 vector int *__c) {
11691 __builtin_altivec_stvxl(__a, __b, __c);
11692}
11693
11694static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
11695 __builtin_altivec_stvxl(__a, __b, __c);
11696}
11697
11698static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11699 vector unsigned int *__c) {
11700 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11701}
11702
11703static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11704 unsigned int *__c) {
11705 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11706}
11707
11708static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11709 int *__c) {
11710 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11711}
11712
11713static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11714 unsigned int *__c) {
11715 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11716}
11717
11718static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11719 vector bool int *__c) {
11720 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11721}
11722
11723static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11724 vector float *__c) {
11725 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11726}
11727
11728static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11729 float *__c) {
11730 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11731}
11732
11733/* vec_stvxl */
11734
11735static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11736 vector signed char *__c) {
11737 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11738}
11739
11740static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11741 signed char *__c) {
11742 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11743}
11744
11745static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11746 vector unsigned char *__c) {
11747 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11748}
11749
11750static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11751 unsigned char *__c) {
11752 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11753}
11754
11755static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11756 signed char *__c) {
11757 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11758}
11759
11760static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11761 unsigned char *__c) {
11762 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11763}
11764
11765static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11766 vector bool char *__c) {
11767 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11768}
11769
11770static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11771 vector short *__c) {
11772 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11773}
11774
11775static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11776 short *__c) {
11777 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11778}
11779
11780static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11781 int __b,
11782 vector unsigned short *__c) {
11783 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11784}
11785
11786static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11787 int __b, unsigned short *__c) {
11788 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11789}
11790
11791static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11792 short *__c) {
11793 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11794}
11795
11796static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11797 unsigned short *__c) {
11798 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11799}
11800
11801static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11802 vector bool short *__c) {
11803 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11804}
11805
11806static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11807 short *__c) {
11808 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11809}
11810
11811static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11812 unsigned short *__c) {
11813 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11814}
11815
11816static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11817 vector pixel *__c) {
11818 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11819}
11820
11821static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11822 vector int *__c) {
11823 __builtin_altivec_stvxl(__a, __b, __c);
11824}
11825
11826static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11827 int *__c) {
11828 __builtin_altivec_stvxl(__a, __b, __c);
11829}
11830
11831static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11832 vector unsigned int *__c) {
11833 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11834}
11835
11836static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11837 unsigned int *__c) {
11838 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11839}
11840
11841static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11842 int *__c) {
11843 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11844}
11845
11846static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11847 unsigned int *__c) {
11848 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11849}
11850
11851static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11852 vector bool int *__c) {
11853 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11854}
11855
11856static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11857 vector float *__c) {
11858 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11859}
11860
11861static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11862 float *__c) {
11863 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11864}
11865
11866/* vec_sub */
11867
11868static __inline__ vector signed char __ATTRS_o_ai
11869vec_sub(vector signed char __a, vector signed char __b) {
11870 return __a - __b;
11871}
11872
11873static __inline__ vector signed char __ATTRS_o_ai
11874vec_sub(vector bool char __a, vector signed char __b) {
11875 return (vector signed char)__a - __b;
11876}
11877
11878static __inline__ vector signed char __ATTRS_o_ai
11879vec_sub(vector signed char __a, vector bool char __b) {
11880 return __a - (vector signed char)__b;
11881}
11882
11883static __inline__ vector unsigned char __ATTRS_o_ai
11884vec_sub(vector unsigned char __a, vector unsigned char __b) {
11885 return __a - __b;
11886}
11887
11888static __inline__ vector unsigned char __ATTRS_o_ai
11889vec_sub(vector bool char __a, vector unsigned char __b) {
11890 return (vector unsigned char)__a - __b;
11891}
11892
11893static __inline__ vector unsigned char __ATTRS_o_ai
11894vec_sub(vector unsigned char __a, vector bool char __b) {
11895 return __a - (vector unsigned char)__b;
11896}
11897
11898static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11899 vector short __b) {
11900 return __a - __b;
11901}
11902
11903static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
11904 vector short __b) {
11905 return (vector short)__a - __b;
11906}
11907
11908static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11909 vector bool short __b) {
11910 return __a - (vector short)__b;
11911}
11912
11913static __inline__ vector unsigned short __ATTRS_o_ai
11914vec_sub(vector unsigned short __a, vector unsigned short __b) {
11915 return __a - __b;
11916}
11917
11918static __inline__ vector unsigned short __ATTRS_o_ai
11919vec_sub(vector bool short __a, vector unsigned short __b) {
11920 return (vector unsigned short)__a - __b;
11921}
11922
11923static __inline__ vector unsigned short __ATTRS_o_ai
11924vec_sub(vector unsigned short __a, vector bool short __b) {
11925 return __a - (vector unsigned short)__b;
11926}
11927
11928static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11929 vector int __b) {
11930 return __a - __b;
11931}
11932
11933static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
11934 vector int __b) {
11935 return (vector int)__a - __b;
11936}
11937
11938static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11939 vector bool int __b) {
11940 return __a - (vector int)__b;
11941}
11942
11943static __inline__ vector unsigned int __ATTRS_o_ai
11944vec_sub(vector unsigned int __a, vector unsigned int __b) {
11945 return __a - __b;
11946}
11947
11948static __inline__ vector unsigned int __ATTRS_o_ai
11949vec_sub(vector bool int __a, vector unsigned int __b) {
11950 return (vector unsigned int)__a - __b;
11951}
11952
11953static __inline__ vector unsigned int __ATTRS_o_ai
11954vec_sub(vector unsigned int __a, vector bool int __b) {
11955 return __a - (vector unsigned int)__b;
11956}
11957
11958#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
11959 defined(__SIZEOF_INT128__)
11960static __inline__ vector signed __int128 __ATTRS_o_ai
11961vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11962 return __a - __b;
11963}
11964
11965static __inline__ vector unsigned __int128 __ATTRS_o_ai
11966vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11967 return __a - __b;
11968}
11969#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) &&
11970 // defined(__SIZEOF_INT128__)
11971
11972#ifdef __VSX__
11973static __inline__ vector signed long long __ATTRS_o_ai
11974vec_sub(vector signed long long __a, vector signed long long __b) {
11975 return __a - __b;
11976}
11977
11978static __inline__ vector unsigned long long __ATTRS_o_ai
11979vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11980 return __a - __b;
11981}
11982
11983static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11984 vector double __b) {
11985 return __a - __b;
11986}
11987#endif
11988
11989static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11990 vector float __b) {
11991 return __a - __b;
11992}
11993
11994/* vec_vsububm */
11995
11996#define __builtin_altivec_vsububm vec_vsububm
11997
11998static __inline__ vector signed char __ATTRS_o_ai
11999vec_vsububm(vector signed char __a, vector signed char __b) {
12000 return __a - __b;
12001}
12002
12003static __inline__ vector signed char __ATTRS_o_ai
12004vec_vsububm(vector bool char __a, vector signed char __b) {
12005 return (vector signed char)__a - __b;
12006}
12007
12008static __inline__ vector signed char __ATTRS_o_ai
12009vec_vsububm(vector signed char __a, vector bool char __b) {
12010 return __a - (vector signed char)__b;
12011}
12012
12013static __inline__ vector unsigned char __ATTRS_o_ai
12014vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
12015 return __a - __b;
12016}
12017
12018static __inline__ vector unsigned char __ATTRS_o_ai
12019vec_vsububm(vector bool char __a, vector unsigned char __b) {
12020 return (vector unsigned char)__a - __b;
12021}
12022
12023static __inline__ vector unsigned char __ATTRS_o_ai
12024vec_vsububm(vector unsigned char __a, vector bool char __b) {
12025 return __a - (vector unsigned char)__b;
12026}
12027
12028/* vec_vsubuhm */
12029
12030#define __builtin_altivec_vsubuhm vec_vsubuhm
12031
12032static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12033 vector short __b) {
12034 return __a - __b;
12035}
12036
12037static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
12038 vector short __b) {
12039 return (vector short)__a - __b;
12040}
12041
12042static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12043 vector bool short __b) {
12044 return __a - (vector short)__b;
12045}
12046
12047static __inline__ vector unsigned short __ATTRS_o_ai
12048vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
12049 return __a - __b;
12050}
12051
12052static __inline__ vector unsigned short __ATTRS_o_ai
12053vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
12054 return (vector unsigned short)__a - __b;
12055}
12056
12057static __inline__ vector unsigned short __ATTRS_o_ai
12058vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
12059 return __a - (vector unsigned short)__b;
12060}
12061
12062/* vec_vsubuwm */
12063
12064#define __builtin_altivec_vsubuwm vec_vsubuwm
12065
12066static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12067 vector int __b) {
12068 return __a - __b;
12069}
12070
12071static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
12072 vector int __b) {
12073 return (vector int)__a - __b;
12074}
12075
12076static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12077 vector bool int __b) {
12078 return __a - (vector int)__b;
12079}
12080
12081static __inline__ vector unsigned int __ATTRS_o_ai
12082vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
12083 return __a - __b;
12084}
12085
12086static __inline__ vector unsigned int __ATTRS_o_ai
12087vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
12088 return (vector unsigned int)__a - __b;
12089}
12090
12091static __inline__ vector unsigned int __ATTRS_o_ai
12092vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
12093 return __a - (vector unsigned int)__b;
12094}
12095
12096/* vec_vsubfp */
12097
12098#define __builtin_altivec_vsubfp vec_vsubfp
12099
12100static __inline__ vector float __attribute__((__always_inline__))
12101vec_vsubfp(vector float __a, vector float __b) {
12102 return __a - __b;
12103}
12104
12105/* vec_subc */
12106
12107static __inline__ vector signed int __ATTRS_o_ai
12108vec_subc(vector signed int __a, vector signed int __b) {
12109 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
12110 (vector unsigned int) __b);
12111}
12112
12113static __inline__ vector unsigned int __ATTRS_o_ai
12114vec_subc(vector unsigned int __a, vector unsigned int __b) {
12115 return __builtin_altivec_vsubcuw(__a, __b);
12116}
12117
12118#ifdef __POWER8_VECTOR__
12119#ifdef __SIZEOF_INT128__
12120static __inline__ vector unsigned __int128 __ATTRS_o_ai
12121vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12122 return __builtin_altivec_vsubcuq(__a, __b);
12123}
12124
12125static __inline__ vector signed __int128 __ATTRS_o_ai
12126vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
12127 return (vector signed __int128)__builtin_altivec_vsubcuq(
12128 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12129}
12130#endif
12131
12132static __inline__ vector unsigned char __attribute__((__always_inline__))
12133vec_subc_u128(vector unsigned char __a, vector unsigned char __b) {
12134 return (vector unsigned char)__builtin_altivec_vsubcuq_c(
12135 (vector unsigned char)__a, (vector unsigned char)__b);
12136}
12137#endif // __POWER8_VECTOR__
12138
12139/* vec_vsubcuw */
12140
12141static __inline__ vector unsigned int __attribute__((__always_inline__))
12142vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
12143 return __builtin_altivec_vsubcuw(__a, __b);
12144}
12145
12146/* vec_subs */
12147
12148static __inline__ vector signed char __ATTRS_o_ai
12149vec_subs(vector signed char __a, vector signed char __b) {
12150 return __builtin_altivec_vsubsbs(__a, __b);
12151}
12152
12153static __inline__ vector signed char __ATTRS_o_ai
12154vec_subs(vector bool char __a, vector signed char __b) {
12155 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12156}
12157
12158static __inline__ vector signed char __ATTRS_o_ai
12159vec_subs(vector signed char __a, vector bool char __b) {
12160 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12161}
12162
12163static __inline__ vector unsigned char __ATTRS_o_ai
12164vec_subs(vector unsigned char __a, vector unsigned char __b) {
12165 return __builtin_altivec_vsububs(__a, __b);
12166}
12167
12168static __inline__ vector unsigned char __ATTRS_o_ai
12169vec_subs(vector bool char __a, vector unsigned char __b) {
12170 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12171}
12172
12173static __inline__ vector unsigned char __ATTRS_o_ai
12174vec_subs(vector unsigned char __a, vector bool char __b) {
12175 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12176}
12177
12178static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12179 vector short __b) {
12180 return __builtin_altivec_vsubshs(__a, __b);
12181}
12182
12183static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
12184 vector short __b) {
12185 return __builtin_altivec_vsubshs((vector short)__a, __b);
12186}
12187
12188static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12189 vector bool short __b) {
12190 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12191}
12192
12193static __inline__ vector unsigned short __ATTRS_o_ai
12194vec_subs(vector unsigned short __a, vector unsigned short __b) {
12195 return __builtin_altivec_vsubuhs(__a, __b);
12196}
12197
12198static __inline__ vector unsigned short __ATTRS_o_ai
12199vec_subs(vector bool short __a, vector unsigned short __b) {
12200 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12201}
12202
12203static __inline__ vector unsigned short __ATTRS_o_ai
12204vec_subs(vector unsigned short __a, vector bool short __b) {
12205 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12206}
12207
12208static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12209 vector int __b) {
12210 return __builtin_altivec_vsubsws(__a, __b);
12211}
12212
12213static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
12214 vector int __b) {
12215 return __builtin_altivec_vsubsws((vector int)__a, __b);
12216}
12217
12218static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12219 vector bool int __b) {
12220 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12221}
12222
12223static __inline__ vector unsigned int __ATTRS_o_ai
12224vec_subs(vector unsigned int __a, vector unsigned int __b) {
12225 return __builtin_altivec_vsubuws(__a, __b);
12226}
12227
12228static __inline__ vector unsigned int __ATTRS_o_ai
12229vec_subs(vector bool int __a, vector unsigned int __b) {
12230 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12231}
12232
12233static __inline__ vector unsigned int __ATTRS_o_ai
12234vec_subs(vector unsigned int __a, vector bool int __b) {
12235 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12236}
12237
12238/* vec_vsubsbs */
12239
12240static __inline__ vector signed char __ATTRS_o_ai
12241vec_vsubsbs(vector signed char __a, vector signed char __b) {
12242 return __builtin_altivec_vsubsbs(__a, __b);
12243}
12244
12245static __inline__ vector signed char __ATTRS_o_ai
12246vec_vsubsbs(vector bool char __a, vector signed char __b) {
12247 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12248}
12249
12250static __inline__ vector signed char __ATTRS_o_ai
12251vec_vsubsbs(vector signed char __a, vector bool char __b) {
12252 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12253}
12254
12255/* vec_vsububs */
12256
12257static __inline__ vector unsigned char __ATTRS_o_ai
12258vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
12259 return __builtin_altivec_vsububs(__a, __b);
12260}
12261
12262static __inline__ vector unsigned char __ATTRS_o_ai
12263vec_vsububs(vector bool char __a, vector unsigned char __b) {
12264 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12265}
12266
12267static __inline__ vector unsigned char __ATTRS_o_ai
12268vec_vsububs(vector unsigned char __a, vector bool char __b) {
12269 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12270}
12271
12272/* vec_vsubshs */
12273
12274static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12275 vector short __b) {
12276 return __builtin_altivec_vsubshs(__a, __b);
12277}
12278
12279static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
12280 vector short __b) {
12281 return __builtin_altivec_vsubshs((vector short)__a, __b);
12282}
12283
12284static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12285 vector bool short __b) {
12286 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12287}
12288
12289/* vec_vsubuhs */
12290
12291static __inline__ vector unsigned short __ATTRS_o_ai
12292vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
12293 return __builtin_altivec_vsubuhs(__a, __b);
12294}
12295
12296static __inline__ vector unsigned short __ATTRS_o_ai
12297vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
12298 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12299}
12300
12301static __inline__ vector unsigned short __ATTRS_o_ai
12302vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
12303 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12304}
12305
12306/* vec_vsubsws */
12307
12308static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12309 vector int __b) {
12310 return __builtin_altivec_vsubsws(__a, __b);
12311}
12312
12313static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
12314 vector int __b) {
12315 return __builtin_altivec_vsubsws((vector int)__a, __b);
12316}
12317
12318static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12319 vector bool int __b) {
12320 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12321}
12322
12323/* vec_vsubuws */
12324
12325static __inline__ vector unsigned int __ATTRS_o_ai
12326vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
12327 return __builtin_altivec_vsubuws(__a, __b);
12328}
12329
12330static __inline__ vector unsigned int __ATTRS_o_ai
12331vec_vsubuws(vector bool int __a, vector unsigned int __b) {
12332 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12333}
12334
12335static __inline__ vector unsigned int __ATTRS_o_ai
12336vec_vsubuws(vector unsigned int __a, vector bool int __b) {
12337 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12338}
12339
12340#ifdef __POWER8_VECTOR__
12341/* vec_vsubuqm */
12342
12343#ifdef __SIZEOF_INT128__
12344static __inline__ vector signed __int128 __ATTRS_o_ai
12345vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
12346 return __a - __b;
12347}
12348
12349static __inline__ vector unsigned __int128 __ATTRS_o_ai
12350vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12351 return __a - __b;
12352}
12353#endif
12354
12355static __inline__ vector unsigned char __attribute__((__always_inline__))
12356vec_sub_u128(vector unsigned char __a, vector unsigned char __b) {
12357 return (vector unsigned char)__builtin_altivec_vsubuqm(__a, __b);
12358}
12359
12360/* vec_vsubeuqm */
12361
12362#ifdef __SIZEOF_INT128__
12363static __inline__ vector signed __int128 __ATTRS_o_ai
12364vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
12365 vector signed __int128 __c) {
12366 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12367 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12368 (vector unsigned __int128)__c);
12369}
12370
12371static __inline__ vector unsigned __int128 __ATTRS_o_ai
12372vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
12373 vector unsigned __int128 __c) {
12374 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12375}
12376
12377static __inline__ vector signed __int128 __ATTRS_o_ai
12378vec_sube(vector signed __int128 __a, vector signed __int128 __b,
12379 vector signed __int128 __c) {
12380 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12381 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12382 (vector unsigned __int128)__c);
12383}
12384
12385static __inline__ vector unsigned __int128 __ATTRS_o_ai
12386vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
12387 vector unsigned __int128 __c) {
12388 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12389}
12390#endif
12391
12392static __inline__ vector unsigned char __attribute__((__always_inline__))
12393vec_sube_u128(vector unsigned char __a, vector unsigned char __b,
12394 vector unsigned char __c) {
12395 return (vector unsigned char)__builtin_altivec_vsubeuqm_c(
12396 (vector unsigned char)__a, (vector unsigned char)__b,
12397 (vector unsigned char)__c);
12398}
12399
12400/* vec_vsubcuq */
12401
12402#ifdef __SIZEOF_INT128__
12403static __inline__ vector signed __int128 __ATTRS_o_ai
12404vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
12405 return (vector signed __int128)__builtin_altivec_vsubcuq(
12406 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12407}
12408
12409static __inline__ vector unsigned __int128 __ATTRS_o_ai
12410vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12411 return __builtin_altivec_vsubcuq(__a, __b);
12412}
12413
12414/* vec_vsubecuq */
12415
12416static __inline__ vector signed __int128 __ATTRS_o_ai
12417vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
12418 vector signed __int128 __c) {
12419 return (vector signed __int128)__builtin_altivec_vsubecuq(
12420 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12421 (vector unsigned __int128)__c);
12422}
12423
12424static __inline__ vector unsigned __int128 __ATTRS_o_ai
12425vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
12426 vector unsigned __int128 __c) {
12427 return __builtin_altivec_vsubecuq(__a, __b, __c);
12428}
12429#endif
12430
12431#ifdef __powerpc64__
12432static __inline__ vector signed int __ATTRS_o_ai
12433vec_subec(vector signed int __a, vector signed int __b,
12434 vector signed int __c) {
12435 return vec_addec(__a, ~__b, __c);
12436}
12437
12438static __inline__ vector unsigned int __ATTRS_o_ai
12439vec_subec(vector unsigned int __a, vector unsigned int __b,
12440 vector unsigned int __c) {
12441 return vec_addec(__a, ~__b, __c);
12442}
12443#endif
12444
12445#ifdef __SIZEOF_INT128__
12446static __inline__ vector signed __int128 __ATTRS_o_ai
12447vec_subec(vector signed __int128 __a, vector signed __int128 __b,
12448 vector signed __int128 __c) {
12449 return (vector signed __int128)__builtin_altivec_vsubecuq(
12450 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12451 (vector unsigned __int128)__c);
12452}
12453
12454static __inline__ vector unsigned __int128 __ATTRS_o_ai
12455vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
12456 vector unsigned __int128 __c) {
12457 return __builtin_altivec_vsubecuq(__a, __b, __c);
12458}
12459#endif
12460
12461static __inline__ vector unsigned char __attribute__((__always_inline__))
12462vec_subec_u128(vector unsigned char __a, vector unsigned char __b,
12463 vector unsigned char __c) {
12464 return (vector unsigned char)__builtin_altivec_vsubecuq_c(
12465 (vector unsigned char)__a, (vector unsigned char)__b,
12466 (vector unsigned char)__c);
12467}
12468#endif // __POWER8_VECTOR__
12469
12470static __inline__ vector signed int __ATTRS_o_ai
12471vec_sube(vector signed int __a, vector signed int __b,
12472 vector signed int __c) {
12473 vector signed int __mask = {1, 1, 1, 1};
12474 vector signed int __carry = __c & __mask;
12475 return vec_adde(__a, ~__b, __carry);
12476}
12477
12478static __inline__ vector unsigned int __ATTRS_o_ai
12479vec_sube(vector unsigned int __a, vector unsigned int __b,
12480 vector unsigned int __c) {
12481 vector unsigned int __mask = {1, 1, 1, 1};
12482 vector unsigned int __carry = __c & __mask;
12483 return vec_adde(__a, ~__b, __carry);
12484}
12485/* vec_sum4s */
12486
12487static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
12488 vector int __b) {
12489 return __builtin_altivec_vsum4sbs(__a, __b);
12490}
12491
12492static __inline__ vector unsigned int __ATTRS_o_ai
12493vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
12494 return __builtin_altivec_vsum4ubs(__a, __b);
12495}
12496
12497static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
12498 vector int __b) {
12499 return __builtin_altivec_vsum4shs(__a, __b);
12500}
12501
12502/* vec_vsum4sbs */
12503
12504static __inline__ vector int __attribute__((__always_inline__))
12505vec_vsum4sbs(vector signed char __a, vector int __b) {
12506 return __builtin_altivec_vsum4sbs(__a, __b);
12507}
12508
12509/* vec_vsum4ubs */
12510
12511static __inline__ vector unsigned int __attribute__((__always_inline__))
12512vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
12513 return __builtin_altivec_vsum4ubs(__a, __b);
12514}
12515
12516/* vec_vsum4shs */
12517
12518static __inline__ vector int __attribute__((__always_inline__))
12519vec_vsum4shs(vector signed short __a, vector int __b) {
12520 return __builtin_altivec_vsum4shs(__a, __b);
12521}
12522
12523/* vec_sum2s */
12524
12525/* The vsum2sws instruction has a big-endian bias, so that the second
12526 input vector and the result always reference big-endian elements
12527 1 and 3 (little-endian element 0 and 2). For ease of porting the
12528 programmer wants elements 1 and 3 in both cases, so for little
12529 endian we must perform some permutes. */
12530
12531static __inline__ vector signed int __attribute__((__always_inline__))
12532vec_sum2s(vector int __a, vector int __b) {
12533#ifdef __LITTLE_ENDIAN__
12534 vector int __c = (vector signed int)vec_perm(
12535 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12536 8, 9, 10, 11));
12537 __c = __builtin_altivec_vsum2sws(__a, __c);
12538 return (vector signed int)vec_perm(
12539 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12540 8, 9, 10, 11));
12541#else
12542 return __builtin_altivec_vsum2sws(__a, __b);
12543#endif
12544}
12545
12546/* vec_vsum2sws */
12547
12548static __inline__ vector signed int __attribute__((__always_inline__))
12549vec_vsum2sws(vector int __a, vector int __b) {
12550#ifdef __LITTLE_ENDIAN__
12551 vector int __c = (vector signed int)vec_perm(
12552 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12553 8, 9, 10, 11));
12554 __c = __builtin_altivec_vsum2sws(__a, __c);
12555 return (vector signed int)vec_perm(
12556 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12557 8, 9, 10, 11));
12558#else
12559 return __builtin_altivec_vsum2sws(__a, __b);
12560#endif
12561}
12562
12563/* vec_sums */
12564
12565/* The vsumsws instruction has a big-endian bias, so that the second
12566 input vector and the result always reference big-endian element 3
12567 (little-endian element 0). For ease of porting the programmer
12568 wants element 3 in both cases, so for little endian we must perform
12569 some permutes. */
12570
12571static __inline__ vector signed int __attribute__((__always_inline__))
12572vec_sums(vector signed int __a, vector signed int __b) {
12573#ifdef __LITTLE_ENDIAN__
12574 __b = (vector signed int)vec_splat(__b, 3);
12575 __b = __builtin_altivec_vsumsws(__a, __b);
12576 return (vector signed int)(0, 0, 0, __b[0]);
12577#else
12578 return __builtin_altivec_vsumsws(__a, __b);
12579#endif
12580}
12581
12582/* vec_vsumsws */
12583
12584static __inline__ vector signed int __attribute__((__always_inline__))
12585vec_vsumsws(vector signed int __a, vector signed int __b) {
12586#ifdef __LITTLE_ENDIAN__
12587 __b = (vector signed int)vec_splat(__b, 3);
12588 __b = __builtin_altivec_vsumsws(__a, __b);
12589 return (vector signed int)(0, 0, 0, __b[0]);
12590#else
12591 return __builtin_altivec_vsumsws(__a, __b);
12592#endif
12593}
12594
12595/* vec_trunc */
12596
12597static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
12598#ifdef __VSX__
12599 return __builtin_vsx_xvrspiz(__a);
12600#else
12601 return __builtin_altivec_vrfiz(__a);
12602#endif
12603}
12604
12605#ifdef __VSX__
12606static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
12607 return __builtin_vsx_xvrdpiz(__a);
12608}
12609#endif
12610
12611/* vec_roundz */
12612static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) {
12613 return vec_trunc(__a);
12614}
12615
12616#ifdef __VSX__
12617static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) {
12618 return vec_trunc(__a);
12619}
12620#endif
12621
12622/* vec_vrfiz */
12623
12624static __inline__ vector float __attribute__((__always_inline__))
12625vec_vrfiz(vector float __a) {
12626 return __builtin_altivec_vrfiz(__a);
12627}
12628
12629/* vec_unpackh */
12630
12631/* The vector unpack instructions all have a big-endian bias, so for
12632 little endian we must reverse the meanings of "high" and "low." */
12633#ifdef __LITTLE_ENDIAN__
12634#define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12635#define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12636#else
12637#define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12638#define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12639#endif
12640
12641static __inline__ vector short __ATTRS_o_ai
12642vec_unpackh(vector signed char __a) {
12643#ifdef __LITTLE_ENDIAN__
12644 return __builtin_altivec_vupklsb((vector char)__a);
12645#else
12646 return __builtin_altivec_vupkhsb((vector char)__a);
12647#endif
12648}
12649
12650static __inline__ vector bool short __ATTRS_o_ai
12651vec_unpackh(vector bool char __a) {
12652#ifdef __LITTLE_ENDIAN__
12653 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12654#else
12655 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12656#endif
12657}
12658
12659static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
12660#ifdef __LITTLE_ENDIAN__
12661 return __builtin_altivec_vupklsh(__a);
12662#else
12663 return __builtin_altivec_vupkhsh(__a);
12664#endif
12665}
12666
12667static __inline__ vector bool int __ATTRS_o_ai
12668vec_unpackh(vector bool short __a) {
12669#ifdef __LITTLE_ENDIAN__
12670 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12671#else
12672 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12673#endif
12674}
12675
12676static __inline__ vector unsigned int __ATTRS_o_ai
12677vec_unpackh(vector pixel __a) {
12678#ifdef __LITTLE_ENDIAN__
12679 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12680#else
12681 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12682#endif
12683}
12684
12685#ifdef __POWER8_VECTOR__
12686static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
12687#ifdef __LITTLE_ENDIAN__
12688 return __builtin_altivec_vupklsw(__a);
12689#else
12690 return __builtin_altivec_vupkhsw(__a);
12691#endif
12692}
12693
12694static __inline__ vector bool long long __ATTRS_o_ai
12695vec_unpackh(vector bool int __a) {
12696#ifdef __LITTLE_ENDIAN__
12697 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12698#else
12699 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12700#endif
12701}
12702
12703static __inline__ vector double __ATTRS_o_ai
12704vec_unpackh(vector float __a) {
12705 return (vector double)(__a[0], __a[1]);
12706}
12707#endif
12708
12709/* vec_vupkhsb */
12710
12711static __inline__ vector short __ATTRS_o_ai
12712vec_vupkhsb(vector signed char __a) {
12713#ifdef __LITTLE_ENDIAN__
12714 return __builtin_altivec_vupklsb((vector char)__a);
12715#else
12716 return __builtin_altivec_vupkhsb((vector char)__a);
12717#endif
12718}
12719
12720static __inline__ vector bool short __ATTRS_o_ai
12721vec_vupkhsb(vector bool char __a) {
12722#ifdef __LITTLE_ENDIAN__
12723 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12724#else
12725 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12726#endif
12727}
12728
12729/* vec_vupkhsh */
12730
12731static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
12732#ifdef __LITTLE_ENDIAN__
12733 return __builtin_altivec_vupklsh(__a);
12734#else
12735 return __builtin_altivec_vupkhsh(__a);
12736#endif
12737}
12738
12739static __inline__ vector bool int __ATTRS_o_ai
12740vec_vupkhsh(vector bool short __a) {
12741#ifdef __LITTLE_ENDIAN__
12742 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12743#else
12744 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12745#endif
12746}
12747
12748static __inline__ vector unsigned int __ATTRS_o_ai
12749vec_vupkhsh(vector pixel __a) {
12750#ifdef __LITTLE_ENDIAN__
12751 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12752#else
12753 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12754#endif
12755}
12756
12757/* vec_vupkhsw */
12758
12759#ifdef __POWER8_VECTOR__
12760static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
12761#ifdef __LITTLE_ENDIAN__
12762 return __builtin_altivec_vupklsw(__a);
12763#else
12764 return __builtin_altivec_vupkhsw(__a);
12765#endif
12766}
12767
12768static __inline__ vector bool long long __ATTRS_o_ai
12769vec_vupkhsw(vector bool int __a) {
12770#ifdef __LITTLE_ENDIAN__
12771 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12772#else
12773 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12774#endif
12775}
12776#endif
12777
12778/* vec_unpackl */
12779
12780static __inline__ vector short __ATTRS_o_ai
12781vec_unpackl(vector signed char __a) {
12782#ifdef __LITTLE_ENDIAN__
12783 return __builtin_altivec_vupkhsb((vector char)__a);
12784#else
12785 return __builtin_altivec_vupklsb((vector char)__a);
12786#endif
12787}
12788
12789static __inline__ vector bool short __ATTRS_o_ai
12790vec_unpackl(vector bool char __a) {
12791#ifdef __LITTLE_ENDIAN__
12792 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12793#else
12794 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12795#endif
12796}
12797
12798static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
12799#ifdef __LITTLE_ENDIAN__
12800 return __builtin_altivec_vupkhsh(__a);
12801#else
12802 return __builtin_altivec_vupklsh(__a);
12803#endif
12804}
12805
12806static __inline__ vector bool int __ATTRS_o_ai
12807vec_unpackl(vector bool short __a) {
12808#ifdef __LITTLE_ENDIAN__
12809 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12810#else
12811 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12812#endif
12813}
12814
12815static __inline__ vector unsigned int __ATTRS_o_ai
12816vec_unpackl(vector pixel __a) {
12817#ifdef __LITTLE_ENDIAN__
12818 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12819#else
12820 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12821#endif
12822}
12823
12824#ifdef __POWER8_VECTOR__
12825static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
12826#ifdef __LITTLE_ENDIAN__
12827 return __builtin_altivec_vupkhsw(__a);
12828#else
12829 return __builtin_altivec_vupklsw(__a);
12830#endif
12831}
12832
12833static __inline__ vector bool long long __ATTRS_o_ai
12834vec_unpackl(vector bool int __a) {
12835#ifdef __LITTLE_ENDIAN__
12836 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12837#else
12838 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12839#endif
12840}
12841
12842static __inline__ vector double __ATTRS_o_ai
12843vec_unpackl(vector float __a) {
12844 return (vector double)(__a[2], __a[3]);
12845}
12846#endif
12847
12848/* vec_vupklsb */
12849
12850static __inline__ vector short __ATTRS_o_ai
12851vec_vupklsb(vector signed char __a) {
12852#ifdef __LITTLE_ENDIAN__
12853 return __builtin_altivec_vupkhsb((vector char)__a);
12854#else
12855 return __builtin_altivec_vupklsb((vector char)__a);
12856#endif
12857}
12858
12859static __inline__ vector bool short __ATTRS_o_ai
12860vec_vupklsb(vector bool char __a) {
12861#ifdef __LITTLE_ENDIAN__
12862 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12863#else
12864 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12865#endif
12866}
12867
12868/* vec_vupklsh */
12869
12870static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
12871#ifdef __LITTLE_ENDIAN__
12872 return __builtin_altivec_vupkhsh(__a);
12873#else
12874 return __builtin_altivec_vupklsh(__a);
12875#endif
12876}
12877
12878static __inline__ vector bool int __ATTRS_o_ai
12879vec_vupklsh(vector bool short __a) {
12880#ifdef __LITTLE_ENDIAN__
12881 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12882#else
12883 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12884#endif
12885}
12886
12887static __inline__ vector unsigned int __ATTRS_o_ai
12888vec_vupklsh(vector pixel __a) {
12889#ifdef __LITTLE_ENDIAN__
12890 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12891#else
12892 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12893#endif
12894}
12895
12896/* vec_vupklsw */
12897
12898#ifdef __POWER8_VECTOR__
12899static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
12900#ifdef __LITTLE_ENDIAN__
12901 return __builtin_altivec_vupkhsw(__a);
12902#else
12903 return __builtin_altivec_vupklsw(__a);
12904#endif
12905}
12906
12907static __inline__ vector bool long long __ATTRS_o_ai
12908vec_vupklsw(vector bool int __a) {
12909#ifdef __LITTLE_ENDIAN__
12910 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12911#else
12912 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12913#endif
12914}
12915#endif
12916
12917/* vec_vsx_ld */
12918
12919#ifdef __VSX__
12920
12921static __inline__ vector bool int __ATTRS_o_ai
12922vec_vsx_ld(int __a, const vector bool int *__b) {
12923 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
12924}
12925
12926static __inline__ vector signed int __ATTRS_o_ai
12927vec_vsx_ld(int __a, const vector signed int *__b) {
12928 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12929}
12930
12931static __inline__ vector signed int __ATTRS_o_ai
12932vec_vsx_ld(int __a, const signed int *__b) {
12933 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12934}
12935
12936static __inline__ vector unsigned int __ATTRS_o_ai
12937vec_vsx_ld(int __a, const vector unsigned int *__b) {
12938 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12939}
12940
12941static __inline__ vector unsigned int __ATTRS_o_ai
12942vec_vsx_ld(int __a, const unsigned int *__b) {
12943 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12944}
12945
12946static __inline__ vector float __ATTRS_o_ai
12947vec_vsx_ld(int __a, const vector float *__b) {
12948 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12949}
12950
12951static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
12952 const float *__b) {
12953 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12954}
12955
12956static __inline__ vector signed long long __ATTRS_o_ai
12957vec_vsx_ld(int __a, const vector signed long long *__b) {
12958 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
12959}
12960
12961static __inline__ vector unsigned long long __ATTRS_o_ai
12962vec_vsx_ld(int __a, const vector unsigned long long *__b) {
12963 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
12964}
12965
12966static __inline__ vector double __ATTRS_o_ai
12967vec_vsx_ld(int __a, const vector double *__b) {
12968 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12969}
12970
12971static __inline__ vector double __ATTRS_o_ai
12972vec_vsx_ld(int __a, const double *__b) {
12973 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12974}
12975
12976static __inline__ vector bool short __ATTRS_o_ai
12977vec_vsx_ld(int __a, const vector bool short *__b) {
12978 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
12979}
12980
12981static __inline__ vector signed short __ATTRS_o_ai
12982vec_vsx_ld(int __a, const vector signed short *__b) {
12983 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12984}
12985
12986static __inline__ vector signed short __ATTRS_o_ai
12987vec_vsx_ld(int __a, const signed short *__b) {
12988 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12989}
12990
12991static __inline__ vector unsigned short __ATTRS_o_ai
12992vec_vsx_ld(int __a, const vector unsigned short *__b) {
12993 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12994}
12995
12996static __inline__ vector unsigned short __ATTRS_o_ai
12997vec_vsx_ld(int __a, const unsigned short *__b) {
12998 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12999}
13000
13001static __inline__ vector bool char __ATTRS_o_ai
13002vec_vsx_ld(int __a, const vector bool char *__b) {
13003 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
13004}
13005
13006static __inline__ vector signed char __ATTRS_o_ai
13007vec_vsx_ld(int __a, const vector signed char *__b) {
13008 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13009}
13010
13011static __inline__ vector signed char __ATTRS_o_ai
13012vec_vsx_ld(int __a, const signed char *__b) {
13013 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13014}
13015
13016static __inline__ vector unsigned char __ATTRS_o_ai
13017vec_vsx_ld(int __a, const vector unsigned char *__b) {
13018 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13019}
13020
13021static __inline__ vector unsigned char __ATTRS_o_ai
13022vec_vsx_ld(int __a, const unsigned char *__b) {
13023 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13024}
13025
13026#endif
13027
13028/* vec_vsx_st */
13029
13030#ifdef __VSX__
13031
13032static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13033 vector bool int *__c) {
13034 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13035}
13036
13037static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13038 signed int *__c) {
13039 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13040}
13041
13042static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13043 unsigned int *__c) {
13044 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13045}
13046
13047static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13048 vector signed int *__c) {
13049 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13050}
13051
13052static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13053 signed int *__c) {
13054 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13055}
13056
13057static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13058 vector unsigned int *__c) {
13059 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13060}
13061
13062static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13063 unsigned int *__c) {
13064 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13065}
13066
13067static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13068 vector float *__c) {
13069 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13070}
13071
13072static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13073 float *__c) {
13074 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13075}
13076
13077static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
13078 int __b,
13079 vector signed long long *__c) {
13080 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13081}
13082
13083static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
13084 int __b,
13085 vector unsigned long long *__c) {
13086 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13087}
13088
13089static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13090 vector double *__c) {
13091 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13092}
13093
13094static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13095 double *__c) {
13096 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13097}
13098
13099static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13100 vector bool short *__c) {
13101 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13102}
13103
13104static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13105 signed short *__c) {
13106 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13107}
13108
13109static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13110 unsigned short *__c) {
13111 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13112}
13113static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13114 vector signed short *__c) {
13115 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13116}
13117
13118static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13119 signed short *__c) {
13120 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13121}
13122
13123static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13124 int __b,
13125 vector unsigned short *__c) {
13126 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13127}
13128
13129static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13130 int __b, unsigned short *__c) {
13131 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13132}
13133
13134static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13135 vector bool char *__c) {
13136 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13137}
13138
13139static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13140 signed char *__c) {
13141 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13142}
13143
13144static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13145 unsigned char *__c) {
13146 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13147}
13148
13149static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13150 vector signed char *__c) {
13151 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13152}
13153
13154static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13155 signed char *__c) {
13156 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13157}
13158
13159static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13160 int __b,
13161 vector unsigned char *__c) {
13162 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13163}
13164
13165static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13166 int __b, unsigned char *__c) {
13167 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13168}
13169
13170#endif
13171
13172#ifdef __VSX__
13173#define vec_xxpermdi __builtin_vsx_xxpermdi
13174#define vec_xxsldwi __builtin_vsx_xxsldwi
13175#define vec_permi(__a, __b, __c) \
13176 _Generic((__a), vector signed long long \
13177 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13178 (((__c)&0x1) + 2)), \
13179 vector unsigned long long \
13180 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13181 (((__c)&0x1) + 2)), \
13182 vector double \
13183 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13184 (((__c)&0x1) + 2)))
13185#endif
13186
13187/* vec_xor */
13188
13189#define __builtin_altivec_vxor vec_xor
13190
13191static __inline__ vector signed char __ATTRS_o_ai
13192vec_xor(vector signed char __a, vector signed char __b) {
13193 return __a ^ __b;
13194}
13195
13196static __inline__ vector signed char __ATTRS_o_ai
13197vec_xor(vector bool char __a, vector signed char __b) {
13198 return (vector signed char)__a ^ __b;
13199}
13200
13201static __inline__ vector signed char __ATTRS_o_ai
13202vec_xor(vector signed char __a, vector bool char __b) {
13203 return __a ^ (vector signed char)__b;
13204}
13205
13206static __inline__ vector unsigned char __ATTRS_o_ai
13207vec_xor(vector unsigned char __a, vector unsigned char __b) {
13208 return __a ^ __b;
13209}
13210
13211static __inline__ vector unsigned char __ATTRS_o_ai
13212vec_xor(vector bool char __a, vector unsigned char __b) {
13213 return (vector unsigned char)__a ^ __b;
13214}
13215
13216static __inline__ vector unsigned char __ATTRS_o_ai
13217vec_xor(vector unsigned char __a, vector bool char __b) {
13218 return __a ^ (vector unsigned char)__b;
13219}
13220
13221static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
13222 vector bool char __b) {
13223 return __a ^ __b;
13224}
13225
13226static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13227 vector short __b) {
13228 return __a ^ __b;
13229}
13230
13231static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
13232 vector short __b) {
13233 return (vector short)__a ^ __b;
13234}
13235
13236static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13237 vector bool short __b) {
13238 return __a ^ (vector short)__b;
13239}
13240
13241static __inline__ vector unsigned short __ATTRS_o_ai
13242vec_xor(vector unsigned short __a, vector unsigned short __b) {
13243 return __a ^ __b;
13244}
13245
13246static __inline__ vector unsigned short __ATTRS_o_ai
13247vec_xor(vector bool short __a, vector unsigned short __b) {
13248 return (vector unsigned short)__a ^ __b;
13249}
13250
13251static __inline__ vector unsigned short __ATTRS_o_ai
13252vec_xor(vector unsigned short __a, vector bool short __b) {
13253 return __a ^ (vector unsigned short)__b;
13254}
13255
13256static __inline__ vector bool short __ATTRS_o_ai
13257vec_xor(vector bool short __a, vector bool short __b) {
13258 return __a ^ __b;
13259}
13260
13261static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13262 vector int __b) {
13263 return __a ^ __b;
13264}
13265
13266static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
13267 vector int __b) {
13268 return (vector int)__a ^ __b;
13269}
13270
13271static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13272 vector bool int __b) {
13273 return __a ^ (vector int)__b;
13274}
13275
13276static __inline__ vector unsigned int __ATTRS_o_ai
13277vec_xor(vector unsigned int __a, vector unsigned int __b) {
13278 return __a ^ __b;
13279}
13280
13281static __inline__ vector unsigned int __ATTRS_o_ai
13282vec_xor(vector bool int __a, vector unsigned int __b) {
13283 return (vector unsigned int)__a ^ __b;
13284}
13285
13286static __inline__ vector unsigned int __ATTRS_o_ai
13287vec_xor(vector unsigned int __a, vector bool int __b) {
13288 return __a ^ (vector unsigned int)__b;
13289}
13290
13291static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
13292 vector bool int __b) {
13293 return __a ^ __b;
13294}
13295
13296static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13297 vector float __b) {
13298 vector unsigned int __res =
13299 (vector unsigned int)__a ^ (vector unsigned int)__b;
13300 return (vector float)__res;
13301}
13302
13303static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
13304 vector float __b) {
13305 vector unsigned int __res =
13306 (vector unsigned int)__a ^ (vector unsigned int)__b;
13307 return (vector float)__res;
13308}
13309
13310static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13311 vector bool int __b) {
13312 vector unsigned int __res =
13313 (vector unsigned int)__a ^ (vector unsigned int)__b;
13314 return (vector float)__res;
13315}
13316
13317#ifdef __VSX__
13318static __inline__ vector signed long long __ATTRS_o_ai
13319vec_xor(vector signed long long __a, vector signed long long __b) {
13320 return __a ^ __b;
13321}
13322
13323static __inline__ vector signed long long __ATTRS_o_ai
13324vec_xor(vector bool long long __a, vector signed long long __b) {
13325 return (vector signed long long)__a ^ __b;
13326}
13327
13328static __inline__ vector signed long long __ATTRS_o_ai
13329vec_xor(vector signed long long __a, vector bool long long __b) {
13330 return __a ^ (vector signed long long)__b;
13331}
13332
13333static __inline__ vector unsigned long long __ATTRS_o_ai
13334vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
13335 return __a ^ __b;
13336}
13337
13338static __inline__ vector unsigned long long __ATTRS_o_ai
13339vec_xor(vector bool long long __a, vector unsigned long long __b) {
13340 return (vector unsigned long long)__a ^ __b;
13341}
13342
13343static __inline__ vector unsigned long long __ATTRS_o_ai
13344vec_xor(vector unsigned long long __a, vector bool long long __b) {
13345 return __a ^ (vector unsigned long long)__b;
13346}
13347
13348static __inline__ vector bool long long __ATTRS_o_ai
13349vec_xor(vector bool long long __a, vector bool long long __b) {
13350 return __a ^ __b;
13351}
13352
13353static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
13354 vector double __b) {
13355 return (vector double)((vector unsigned long long)__a ^
13356 (vector unsigned long long)__b);
13357}
13358
13359static __inline__ vector double __ATTRS_o_ai
13360vec_xor(vector double __a, vector bool long long __b) {
13361 return (vector double)((vector unsigned long long)__a ^
13362 (vector unsigned long long)__b);
13363}
13364
13365static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
13366 vector double __b) {
13367 return (vector double)((vector unsigned long long)__a ^
13368 (vector unsigned long long)__b);
13369}
13370#endif
13371
13372/* vec_vxor */
13373
13374static __inline__ vector signed char __ATTRS_o_ai
13375vec_vxor(vector signed char __a, vector signed char __b) {
13376 return __a ^ __b;
13377}
13378
13379static __inline__ vector signed char __ATTRS_o_ai
13380vec_vxor(vector bool char __a, vector signed char __b) {
13381 return (vector signed char)__a ^ __b;
13382}
13383
13384static __inline__ vector signed char __ATTRS_o_ai
13385vec_vxor(vector signed char __a, vector bool char __b) {
13386 return __a ^ (vector signed char)__b;
13387}
13388
13389static __inline__ vector unsigned char __ATTRS_o_ai
13390vec_vxor(vector unsigned char __a, vector unsigned char __b) {
13391 return __a ^ __b;
13392}
13393
13394static __inline__ vector unsigned char __ATTRS_o_ai
13395vec_vxor(vector bool char __a, vector unsigned char __b) {
13396 return (vector unsigned char)__a ^ __b;
13397}
13398
13399static __inline__ vector unsigned char __ATTRS_o_ai
13400vec_vxor(vector unsigned char __a, vector bool char __b) {
13401 return __a ^ (vector unsigned char)__b;
13402}
13403
13404static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
13405 vector bool char __b) {
13406 return __a ^ __b;
13407}
13408
13409static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13410 vector short __b) {
13411 return __a ^ __b;
13412}
13413
13414static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
13415 vector short __b) {
13416 return (vector short)__a ^ __b;
13417}
13418
13419static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13420 vector bool short __b) {
13421 return __a ^ (vector short)__b;
13422}
13423
13424static __inline__ vector unsigned short __ATTRS_o_ai
13425vec_vxor(vector unsigned short __a, vector unsigned short __b) {
13426 return __a ^ __b;
13427}
13428
13429static __inline__ vector unsigned short __ATTRS_o_ai
13430vec_vxor(vector bool short __a, vector unsigned short __b) {
13431 return (vector unsigned short)__a ^ __b;
13432}
13433
13434static __inline__ vector unsigned short __ATTRS_o_ai
13435vec_vxor(vector unsigned short __a, vector bool short __b) {
13436 return __a ^ (vector unsigned short)__b;
13437}
13438
13439static __inline__ vector bool short __ATTRS_o_ai
13440vec_vxor(vector bool short __a, vector bool short __b) {
13441 return __a ^ __b;
13442}
13443
13444static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13445 vector int __b) {
13446 return __a ^ __b;
13447}
13448
13449static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
13450 vector int __b) {
13451 return (vector int)__a ^ __b;
13452}
13453
13454static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13455 vector bool int __b) {
13456 return __a ^ (vector int)__b;
13457}
13458
13459static __inline__ vector unsigned int __ATTRS_o_ai
13460vec_vxor(vector unsigned int __a, vector unsigned int __b) {
13461 return __a ^ __b;
13462}
13463
13464static __inline__ vector unsigned int __ATTRS_o_ai
13465vec_vxor(vector bool int __a, vector unsigned int __b) {
13466 return (vector unsigned int)__a ^ __b;
13467}
13468
13469static __inline__ vector unsigned int __ATTRS_o_ai
13470vec_vxor(vector unsigned int __a, vector bool int __b) {
13471 return __a ^ (vector unsigned int)__b;
13472}
13473
13474static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
13475 vector bool int __b) {
13476 return __a ^ __b;
13477}
13478
13479static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13480 vector float __b) {
13481 vector unsigned int __res =
13482 (vector unsigned int)__a ^ (vector unsigned int)__b;
13483 return (vector float)__res;
13484}
13485
13486static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
13487 vector float __b) {
13488 vector unsigned int __res =
13489 (vector unsigned int)__a ^ (vector unsigned int)__b;
13490 return (vector float)__res;
13491}
13492
13493static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13494 vector bool int __b) {
13495 vector unsigned int __res =
13496 (vector unsigned int)__a ^ (vector unsigned int)__b;
13497 return (vector float)__res;
13498}
13499
13500#ifdef __VSX__
13501static __inline__ vector signed long long __ATTRS_o_ai
13502vec_vxor(vector signed long long __a, vector signed long long __b) {
13503 return __a ^ __b;
13504}
13505
13506static __inline__ vector signed long long __ATTRS_o_ai
13507vec_vxor(vector bool long long __a, vector signed long long __b) {
13508 return (vector signed long long)__a ^ __b;
13509}
13510
13511static __inline__ vector signed long long __ATTRS_o_ai
13512vec_vxor(vector signed long long __a, vector bool long long __b) {
13513 return __a ^ (vector signed long long)__b;
13514}
13515
13516static __inline__ vector unsigned long long __ATTRS_o_ai
13517vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
13518 return __a ^ __b;
13519}
13520
13521static __inline__ vector unsigned long long __ATTRS_o_ai
13522vec_vxor(vector bool long long __a, vector unsigned long long __b) {
13523 return (vector unsigned long long)__a ^ __b;
13524}
13525
13526static __inline__ vector unsigned long long __ATTRS_o_ai
13527vec_vxor(vector unsigned long long __a, vector bool long long __b) {
13528 return __a ^ (vector unsigned long long)__b;
13529}
13530
13531static __inline__ vector bool long long __ATTRS_o_ai
13532vec_vxor(vector bool long long __a, vector bool long long __b) {
13533 return __a ^ __b;
13534}
13535#endif
13536
13537/* ------------------------ extensions for CBEA ----------------------------- */
13538
13539/* vec_extract */
13540
13541static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
13542 signed int __b) {
13543 return __a[__b & 0xf];
13544}
13545
13546static __inline__ unsigned char __ATTRS_o_ai
13547vec_extract(vector unsigned char __a, signed int __b) {
13548 return __a[__b & 0xf];
13549}
13550
13551static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
13552 signed int __b) {
13553 return __a[__b & 0xf];
13554}
13555
13556static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
13557 signed int __b) {
13558 return __a[__b & 0x7];
13559}
13560
13561static __inline__ unsigned short __ATTRS_o_ai
13562vec_extract(vector unsigned short __a, signed int __b) {
13563 return __a[__b & 0x7];
13564}
13565
13566static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
13567 signed int __b) {
13568 return __a[__b & 0x7];
13569}
13570
13571static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
13572 signed int __b) {
13573 return __a[__b & 0x3];
13574}
13575
13576static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
13577 signed int __b) {
13578 return __a[__b & 0x3];
13579}
13580
13581static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
13582 signed int __b) {
13583 return __a[__b & 0x3];
13584}
13585
13586#ifdef __VSX__
13587static __inline__ signed long long __ATTRS_o_ai
13588vec_extract(vector signed long long __a, signed int __b) {
13589 return __a[__b & 0x1];
13590}
13591
13592static __inline__ unsigned long long __ATTRS_o_ai
13593vec_extract(vector unsigned long long __a, signed int __b) {
13594 return __a[__b & 0x1];
13595}
13596
13597static __inline__ unsigned long long __ATTRS_o_ai
13598vec_extract(vector bool long long __a, signed int __b) {
13599 return __a[__b & 0x1];
13600}
13601
13602static __inline__ double __ATTRS_o_ai vec_extract(vector double __a,
13603 signed int __b) {
13604 return __a[__b & 0x1];
13605}
13606#endif
13607
13608static __inline__ float __ATTRS_o_ai vec_extract(vector float __a,
13609 signed int __b) {
13610 return __a[__b & 0x3];
13611}
13612
13613#ifdef __POWER9_VECTOR__
13614
13615#define vec_insert4b __builtin_vsx_insertword
13616#define vec_extract4b __builtin_vsx_extractuword
13617
13618/* vec_extract_exp */
13619
13620static __inline__ vector unsigned int __ATTRS_o_ai
13621vec_extract_exp(vector float __a) {
13622 return __builtin_vsx_xvxexpsp(__a);
13623}
13624
13625static __inline__ vector unsigned long long __ATTRS_o_ai
13626vec_extract_exp(vector double __a) {
13627 return __builtin_vsx_xvxexpdp(__a);
13628}
13629
13630/* vec_extract_sig */
13631
13632static __inline__ vector unsigned int __ATTRS_o_ai
13633vec_extract_sig(vector float __a) {
13634 return __builtin_vsx_xvxsigsp(__a);
13635}
13636
13637static __inline__ vector unsigned long long __ATTRS_o_ai
13638vec_extract_sig (vector double __a) {
13639 return __builtin_vsx_xvxsigdp(__a);
13640}
13641
13642static __inline__ vector float __ATTRS_o_ai
13643vec_extract_fp32_from_shorth(vector unsigned short __a) {
13644 vector unsigned short __b =
13645#ifdef __LITTLE_ENDIAN__
13646 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
13647#else
13648 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
13649#endif
13650 return __builtin_vsx_xvcvhpsp(__b);
13651}
13652
13653static __inline__ vector float __ATTRS_o_ai
13654vec_extract_fp32_from_shortl(vector unsigned short __a) {
13655 vector unsigned short __b =
13656#ifdef __LITTLE_ENDIAN__
13657 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
13658#else
13659 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
13660#endif
13661 return __builtin_vsx_xvcvhpsp(__b);
13662}
13663#endif /* __POWER9_VECTOR__ */
13664
13665/* vec_insert */
13666
13667static __inline__ vector signed char __ATTRS_o_ai
13668vec_insert(signed char __a, vector signed char __b, int __c) {
13669 __b[__c & 0xF] = __a;
13670 return __b;
13671}
13672
13673static __inline__ vector unsigned char __ATTRS_o_ai
13674vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
13675 __b[__c & 0xF] = __a;
13676 return __b;
13677}
13678
13679static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
13680 vector bool char __b,
13681 int __c) {
13682 __b[__c & 0xF] = __a;
13683 return __b;
13684}
13685
13686static __inline__ vector signed short __ATTRS_o_ai
13687vec_insert(signed short __a, vector signed short __b, int __c) {
13688 __b[__c & 0x7] = __a;
13689 return __b;
13690}
13691
13692static __inline__ vector unsigned short __ATTRS_o_ai
13693vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
13694 __b[__c & 0x7] = __a;
13695 return __b;
13696}
13697
13698static __inline__ vector bool short __ATTRS_o_ai
13699vec_insert(unsigned short __a, vector bool short __b, int __c) {
13700 __b[__c & 0x7] = __a;
13701 return __b;
13702}
13703
13704static __inline__ vector signed int __ATTRS_o_ai
13705vec_insert(signed int __a, vector signed int __b, int __c) {
13706 __b[__c & 0x3] = __a;
13707 return __b;
13708}
13709
13710static __inline__ vector unsigned int __ATTRS_o_ai
13711vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
13712 __b[__c & 0x3] = __a;
13713 return __b;
13714}
13715
13716static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
13717 vector bool int __b,
13718 int __c) {
13719 __b[__c & 0x3] = __a;
13720 return __b;
13721}
13722
13723#ifdef __VSX__
13724static __inline__ vector signed long long __ATTRS_o_ai
13725vec_insert(signed long long __a, vector signed long long __b, int __c) {
13726 __b[__c & 0x1] = __a;
13727 return __b;
13728}
13729
13730static __inline__ vector unsigned long long __ATTRS_o_ai
13731vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
13732 __b[__c & 0x1] = __a;
13733 return __b;
13734}
13735
13736static __inline__ vector bool long long __ATTRS_o_ai
13737vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
13738 __b[__c & 0x1] = __a;
13739 return __b;
13740}
13741static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
13742 vector double __b,
13743 int __c) {
13744 __b[__c & 0x1] = __a;
13745 return __b;
13746}
13747#endif
13748
13749static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
13750 vector float __b,
13751 int __c) {
13752 __b[__c & 0x3] = __a;
13753 return __b;
13754}
13755
13756/* vec_lvlx */
13757
13758static __inline__ vector signed char __ATTRS_o_ai
13759vec_lvlx(int __a, const signed char *__b) {
13760 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13761 vec_lvsl(__a, __b));
13762}
13763
13764static __inline__ vector signed char __ATTRS_o_ai
13765vec_lvlx(int __a, const vector signed char *__b) {
13766 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13767 vec_lvsl(__a, (unsigned char *)__b));
13768}
13769
13770static __inline__ vector unsigned char __ATTRS_o_ai
13771vec_lvlx(int __a, const unsigned char *__b) {
13772 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13773 vec_lvsl(__a, __b));
13774}
13775
13776static __inline__ vector unsigned char __ATTRS_o_ai
13777vec_lvlx(int __a, const vector unsigned char *__b) {
13778 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13779 vec_lvsl(__a, (unsigned char *)__b));
13780}
13781
13782static __inline__ vector bool char __ATTRS_o_ai
13783vec_lvlx(int __a, const vector bool char *__b) {
13784 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
13785 vec_lvsl(__a, (unsigned char *)__b));
13786}
13787
13788static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13789 const short *__b) {
13790 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13791}
13792
13793static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13794 const vector short *__b) {
13795 return vec_perm(vec_ld(__a, __b), (vector short)(0),
13796 vec_lvsl(__a, (unsigned char *)__b));
13797}
13798
13799static __inline__ vector unsigned short __ATTRS_o_ai
13800vec_lvlx(int __a, const unsigned short *__b) {
13801 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13802 vec_lvsl(__a, __b));
13803}
13804
13805static __inline__ vector unsigned short __ATTRS_o_ai
13806vec_lvlx(int __a, const vector unsigned short *__b) {
13807 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13808 vec_lvsl(__a, (unsigned char *)__b));
13809}
13810
13811static __inline__ vector bool short __ATTRS_o_ai
13812vec_lvlx(int __a, const vector bool short *__b) {
13813 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
13814 vec_lvsl(__a, (unsigned char *)__b));
13815}
13816
13817static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
13818 const vector pixel *__b) {
13819 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
13820 vec_lvsl(__a, (unsigned char *)__b));
13821}
13822
13823static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
13824 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13825}
13826
13827static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
13828 const vector int *__b) {
13829 return vec_perm(vec_ld(__a, __b), (vector int)(0),
13830 vec_lvsl(__a, (unsigned char *)__b));
13831}
13832
13833static __inline__ vector unsigned int __ATTRS_o_ai
13834vec_lvlx(int __a, const unsigned int *__b) {
13835 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13836 vec_lvsl(__a, __b));
13837}
13838
13839static __inline__ vector unsigned int __ATTRS_o_ai
13840vec_lvlx(int __a, const vector unsigned int *__b) {
13841 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13842 vec_lvsl(__a, (unsigned char *)__b));
13843}
13844
13845static __inline__ vector bool int __ATTRS_o_ai
13846vec_lvlx(int __a, const vector bool int *__b) {
13847 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
13848 vec_lvsl(__a, (unsigned char *)__b));
13849}
13850
13851static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13852 const float *__b) {
13853 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13854}
13855
13856static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13857 const vector float *__b) {
13858 return vec_perm(vec_ld(__a, __b), (vector float)(0),
13859 vec_lvsl(__a, (unsigned char *)__b));
13860}
13861
13862/* vec_lvlxl */
13863
13864static __inline__ vector signed char __ATTRS_o_ai
13865vec_lvlxl(int __a, const signed char *__b) {
13866 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13867 vec_lvsl(__a, __b));
13868}
13869
13870static __inline__ vector signed char __ATTRS_o_ai
13871vec_lvlxl(int __a, const vector signed char *__b) {
13872 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13873 vec_lvsl(__a, (unsigned char *)__b));
13874}
13875
13876static __inline__ vector unsigned char __ATTRS_o_ai
13877vec_lvlxl(int __a, const unsigned char *__b) {
13878 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13879 vec_lvsl(__a, __b));
13880}
13881
13882static __inline__ vector unsigned char __ATTRS_o_ai
13883vec_lvlxl(int __a, const vector unsigned char *__b) {
13884 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13885 vec_lvsl(__a, (unsigned char *)__b));
13886}
13887
13888static __inline__ vector bool char __ATTRS_o_ai
13889vec_lvlxl(int __a, const vector bool char *__b) {
13890 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
13891 vec_lvsl(__a, (unsigned char *)__b));
13892}
13893
13894static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13895 const short *__b) {
13896 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13897}
13898
13899static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13900 const vector short *__b) {
13901 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
13902 vec_lvsl(__a, (unsigned char *)__b));
13903}
13904
13905static __inline__ vector unsigned short __ATTRS_o_ai
13906vec_lvlxl(int __a, const unsigned short *__b) {
13907 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13908 vec_lvsl(__a, __b));
13909}
13910
13911static __inline__ vector unsigned short __ATTRS_o_ai
13912vec_lvlxl(int __a, const vector unsigned short *__b) {
13913 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13914 vec_lvsl(__a, (unsigned char *)__b));
13915}
13916
13917static __inline__ vector bool short __ATTRS_o_ai
13918vec_lvlxl(int __a, const vector bool short *__b) {
13919 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
13920 vec_lvsl(__a, (unsigned char *)__b));
13921}
13922
13923static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
13924 const vector pixel *__b) {
13925 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
13926 vec_lvsl(__a, (unsigned char *)__b));
13927}
13928
13929static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
13930 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13931}
13932
13933static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
13934 const vector int *__b) {
13935 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
13936 vec_lvsl(__a, (unsigned char *)__b));
13937}
13938
13939static __inline__ vector unsigned int __ATTRS_o_ai
13940vec_lvlxl(int __a, const unsigned int *__b) {
13941 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13942 vec_lvsl(__a, __b));
13943}
13944
13945static __inline__ vector unsigned int __ATTRS_o_ai
13946vec_lvlxl(int __a, const vector unsigned int *__b) {
13947 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13948 vec_lvsl(__a, (unsigned char *)__b));
13949}
13950
13951static __inline__ vector bool int __ATTRS_o_ai
13952vec_lvlxl(int __a, const vector bool int *__b) {
13953 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
13954 vec_lvsl(__a, (unsigned char *)__b));
13955}
13956
13957static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13958 const float *__b) {
13959 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13960}
13961
13962static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13963 vector float *__b) {
13964 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
13965 vec_lvsl(__a, (unsigned char *)__b));
13966}
13967
13968/* vec_lvrx */
13969
13970static __inline__ vector signed char __ATTRS_o_ai
13971vec_lvrx(int __a, const signed char *__b) {
13972 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13973 vec_lvsl(__a, __b));
13974}
13975
13976static __inline__ vector signed char __ATTRS_o_ai
13977vec_lvrx(int __a, const vector signed char *__b) {
13978 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13979 vec_lvsl(__a, (unsigned char *)__b));
13980}
13981
13982static __inline__ vector unsigned char __ATTRS_o_ai
13983vec_lvrx(int __a, const unsigned char *__b) {
13984 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13985 vec_lvsl(__a, __b));
13986}
13987
13988static __inline__ vector unsigned char __ATTRS_o_ai
13989vec_lvrx(int __a, const vector unsigned char *__b) {
13990 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13991 vec_lvsl(__a, (unsigned char *)__b));
13992}
13993
13994static __inline__ vector bool char __ATTRS_o_ai
13995vec_lvrx(int __a, const vector bool char *__b) {
13996 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
13997 vec_lvsl(__a, (unsigned char *)__b));
13998}
13999
14000static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14001 const short *__b) {
14002 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14003}
14004
14005static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14006 const vector short *__b) {
14007 return vec_perm((vector short)(0), vec_ld(__a, __b),
14008 vec_lvsl(__a, (unsigned char *)__b));
14009}
14010
14011static __inline__ vector unsigned short __ATTRS_o_ai
14012vec_lvrx(int __a, const unsigned short *__b) {
14013 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14014 vec_lvsl(__a, __b));
14015}
14016
14017static __inline__ vector unsigned short __ATTRS_o_ai
14018vec_lvrx(int __a, const vector unsigned short *__b) {
14019 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14020 vec_lvsl(__a, (unsigned char *)__b));
14021}
14022
14023static __inline__ vector bool short __ATTRS_o_ai
14024vec_lvrx(int __a, const vector bool short *__b) {
14025 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
14026 vec_lvsl(__a, (unsigned char *)__b));
14027}
14028
14029static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
14030 const vector pixel *__b) {
14031 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
14032 vec_lvsl(__a, (unsigned char *)__b));
14033}
14034
14035static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
14036 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14037}
14038
14039static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
14040 const vector int *__b) {
14041 return vec_perm((vector int)(0), vec_ld(__a, __b),
14042 vec_lvsl(__a, (unsigned char *)__b));
14043}
14044
14045static __inline__ vector unsigned int __ATTRS_o_ai
14046vec_lvrx(int __a, const unsigned int *__b) {
14047 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14048 vec_lvsl(__a, __b));
14049}
14050
14051static __inline__ vector unsigned int __ATTRS_o_ai
14052vec_lvrx(int __a, const vector unsigned int *__b) {
14053 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14054 vec_lvsl(__a, (unsigned char *)__b));
14055}
14056
14057static __inline__ vector bool int __ATTRS_o_ai
14058vec_lvrx(int __a, const vector bool int *__b) {
14059 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
14060 vec_lvsl(__a, (unsigned char *)__b));
14061}
14062
14063static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14064 const float *__b) {
14065 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14066}
14067
14068static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14069 const vector float *__b) {
14070 return vec_perm((vector float)(0), vec_ld(__a, __b),
14071 vec_lvsl(__a, (unsigned char *)__b));
14072}
14073
14074/* vec_lvrxl */
14075
14076static __inline__ vector signed char __ATTRS_o_ai
14077vec_lvrxl(int __a, const signed char *__b) {
14078 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14079 vec_lvsl(__a, __b));
14080}
14081
14082static __inline__ vector signed char __ATTRS_o_ai
14083vec_lvrxl(int __a, const vector signed char *__b) {
14084 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14085 vec_lvsl(__a, (unsigned char *)__b));
14086}
14087
14088static __inline__ vector unsigned char __ATTRS_o_ai
14089vec_lvrxl(int __a, const unsigned char *__b) {
14090 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14091 vec_lvsl(__a, __b));
14092}
14093
14094static __inline__ vector unsigned char __ATTRS_o_ai
14095vec_lvrxl(int __a, const vector unsigned char *__b) {
14096 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14097 vec_lvsl(__a, (unsigned char *)__b));
14098}
14099
14100static __inline__ vector bool char __ATTRS_o_ai
14101vec_lvrxl(int __a, const vector bool char *__b) {
14102 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
14103 vec_lvsl(__a, (unsigned char *)__b));
14104}
14105
14106static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14107 const short *__b) {
14108 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14109}
14110
14111static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14112 const vector short *__b) {
14113 return vec_perm((vector short)(0), vec_ldl(__a, __b),
14114 vec_lvsl(__a, (unsigned char *)__b));
14115}
14116
14117static __inline__ vector unsigned short __ATTRS_o_ai
14118vec_lvrxl(int __a, const unsigned short *__b) {
14119 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14120 vec_lvsl(__a, __b));
14121}
14122
14123static __inline__ vector unsigned short __ATTRS_o_ai
14124vec_lvrxl(int __a, const vector unsigned short *__b) {
14125 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14126 vec_lvsl(__a, (unsigned char *)__b));
14127}
14128
14129static __inline__ vector bool short __ATTRS_o_ai
14130vec_lvrxl(int __a, const vector bool short *__b) {
14131 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
14132 vec_lvsl(__a, (unsigned char *)__b));
14133}
14134
14135static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
14136 const vector pixel *__b) {
14137 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
14138 vec_lvsl(__a, (unsigned char *)__b));
14139}
14140
14141static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
14142 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14143}
14144
14145static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
14146 const vector int *__b) {
14147 return vec_perm((vector int)(0), vec_ldl(__a, __b),
14148 vec_lvsl(__a, (unsigned char *)__b));
14149}
14150
14151static __inline__ vector unsigned int __ATTRS_o_ai
14152vec_lvrxl(int __a, const unsigned int *__b) {
14153 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14154 vec_lvsl(__a, __b));
14155}
14156
14157static __inline__ vector unsigned int __ATTRS_o_ai
14158vec_lvrxl(int __a, const vector unsigned int *__b) {
14159 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14160 vec_lvsl(__a, (unsigned char *)__b));
14161}
14162
14163static __inline__ vector bool int __ATTRS_o_ai
14164vec_lvrxl(int __a, const vector bool int *__b) {
14165 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
14166 vec_lvsl(__a, (unsigned char *)__b));
14167}
14168
14169static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14170 const float *__b) {
14171 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14172}
14173
14174static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14175 const vector float *__b) {
14176 return vec_perm((vector float)(0), vec_ldl(__a, __b),
14177 vec_lvsl(__a, (unsigned char *)__b));
14178}
14179
14180/* vec_stvlx */
14181
14182static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14183 signed char *__c) {
14185 __c);
14186}
14187
14188static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14189 vector signed char *__c) {
14190 return vec_st(
14191 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14192 __b, __c);
14193}
14194
14195static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14196 unsigned char *__c) {
14198 __c);
14199}
14200
14201static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14202 vector unsigned char *__c) {
14203 return vec_st(
14204 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14205 __b, __c);
14206}
14207
14208static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
14209 vector bool char *__c) {
14210 return vec_st(
14211 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14212 __b, __c);
14213}
14214
14215static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14216 short *__c) {
14218 __c);
14219}
14220
14221static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14222 vector short *__c) {
14223 return vec_st(
14224 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14225 __b, __c);
14226}
14227
14228static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14229 int __b, unsigned short *__c) {
14231 __c);
14232}
14233
14234static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14235 int __b,
14236 vector unsigned short *__c) {
14237 return vec_st(
14238 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14239 __b, __c);
14240}
14241
14242static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
14243 vector bool short *__c) {
14244 return vec_st(
14245 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14246 __b, __c);
14247}
14248
14249static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
14250 vector pixel *__c) {
14251 return vec_st(
14252 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14253 __b, __c);
14254}
14255
14256static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14257 int *__c) {
14259 __c);
14260}
14261
14262static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14263 vector int *__c) {
14264 return vec_st(
14265 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14266 __b, __c);
14267}
14268
14269static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14270 unsigned int *__c) {
14272 __c);
14273}
14274
14275static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14276 vector unsigned int *__c) {
14277 return vec_st(
14278 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14279 __b, __c);
14280}
14281
14282static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
14283 vector bool int *__c) {
14284 return vec_st(
14285 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14286 __b, __c);
14287}
14288
14289static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
14290 vector float *__c) {
14291 return vec_st(
14292 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14293 __b, __c);
14294}
14295
14296/* vec_stvlxl */
14297
14298static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14299 signed char *__c) {
14301 __c);
14302}
14303
14304static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14305 vector signed char *__c) {
14306 return vec_stl(
14307 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14308 __b, __c);
14309}
14310
14311static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14312 int __b, unsigned char *__c) {
14314 __c);
14315}
14316
14317static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14318 int __b,
14319 vector unsigned char *__c) {
14320 return vec_stl(
14321 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14322 __b, __c);
14323}
14324
14325static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
14326 vector bool char *__c) {
14327 return vec_stl(
14328 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14329 __b, __c);
14330}
14331
14332static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14333 short *__c) {
14335 __c);
14336}
14337
14338static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14339 vector short *__c) {
14340 return vec_stl(
14341 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14342 __b, __c);
14343}
14344
14345static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14346 int __b, unsigned short *__c) {
14348 __c);
14349}
14350
14351static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14352 int __b,
14353 vector unsigned short *__c) {
14354 return vec_stl(
14355 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14356 __b, __c);
14357}
14358
14359static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
14360 vector bool short *__c) {
14361 return vec_stl(
14362 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14363 __b, __c);
14364}
14365
14366static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
14367 vector pixel *__c) {
14368 return vec_stl(
14369 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14370 __b, __c);
14371}
14372
14373static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14374 int *__c) {
14376 __c);
14377}
14378
14379static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14380 vector int *__c) {
14381 return vec_stl(
14382 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14383 __b, __c);
14384}
14385
14386static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14387 unsigned int *__c) {
14389 __c);
14390}
14391
14392static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14393 vector unsigned int *__c) {
14394 return vec_stl(
14395 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14396 __b, __c);
14397}
14398
14399static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
14400 vector bool int *__c) {
14401 return vec_stl(
14402 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14403 __b, __c);
14404}
14405
14406static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
14407 vector float *__c) {
14408 return vec_stl(
14409 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14410 __b, __c);
14411}
14412
14413/* vec_stvrx */
14414
14415static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14416 signed char *__c) {
14418 __c);
14419}
14420
14421static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14422 vector signed char *__c) {
14423 return vec_st(
14424 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14425 __b, __c);
14426}
14427
14428static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14429 unsigned char *__c) {
14431 __c);
14432}
14433
14434static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14435 vector unsigned char *__c) {
14436 return vec_st(
14437 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14438 __b, __c);
14439}
14440
14441static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
14442 vector bool char *__c) {
14443 return vec_st(
14444 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14445 __b, __c);
14446}
14447
14448static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14449 short *__c) {
14451 __c);
14452}
14453
14454static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14455 vector short *__c) {
14456 return vec_st(
14457 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14458 __b, __c);
14459}
14460
14461static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14462 int __b, unsigned short *__c) {
14464 __c);
14465}
14466
14467static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14468 int __b,
14469 vector unsigned short *__c) {
14470 return vec_st(
14471 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14472 __b, __c);
14473}
14474
14475static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
14476 vector bool short *__c) {
14477 return vec_st(
14478 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14479 __b, __c);
14480}
14481
14482static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
14483 vector pixel *__c) {
14484 return vec_st(
14485 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14486 __b, __c);
14487}
14488
14489static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14490 int *__c) {
14492 __c);
14493}
14494
14495static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14496 vector int *__c) {
14497 return vec_st(
14498 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14499 __b, __c);
14500}
14501
14502static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14503 unsigned int *__c) {
14505 __c);
14506}
14507
14508static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14509 vector unsigned int *__c) {
14510 return vec_st(
14511 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14512 __b, __c);
14513}
14514
14515static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
14516 vector bool int *__c) {
14517 return vec_st(
14518 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14519 __b, __c);
14520}
14521
14522static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
14523 vector float *__c) {
14524 return vec_st(
14525 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14526 __b, __c);
14527}
14528
14529/* vec_stvrxl */
14530
14531static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14532 signed char *__c) {
14534 __c);
14535}
14536
14537static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14538 vector signed char *__c) {
14539 return vec_stl(
14540 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14541 __b, __c);
14542}
14543
14544static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14545 int __b, unsigned char *__c) {
14547 __c);
14548}
14549
14550static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14551 int __b,
14552 vector unsigned char *__c) {
14553 return vec_stl(
14554 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14555 __b, __c);
14556}
14557
14558static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
14559 vector bool char *__c) {
14560 return vec_stl(
14561 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14562 __b, __c);
14563}
14564
14565static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14566 short *__c) {
14568 __c);
14569}
14570
14571static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14572 vector short *__c) {
14573 return vec_stl(
14574 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14575 __b, __c);
14576}
14577
14578static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14579 int __b, unsigned short *__c) {
14581 __c);
14582}
14583
14584static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14585 int __b,
14586 vector unsigned short *__c) {
14587 return vec_stl(
14588 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14589 __b, __c);
14590}
14591
14592static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
14593 vector bool short *__c) {
14594 return vec_stl(
14595 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14596 __b, __c);
14597}
14598
14599static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
14600 vector pixel *__c) {
14601 return vec_stl(
14602 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14603 __b, __c);
14604}
14605
14606static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14607 int *__c) {
14609 __c);
14610}
14611
14612static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14613 vector int *__c) {
14614 return vec_stl(
14615 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14616 __b, __c);
14617}
14618
14619static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14620 unsigned int *__c) {
14622 __c);
14623}
14624
14625static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14626 vector unsigned int *__c) {
14627 return vec_stl(
14628 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14629 __b, __c);
14630}
14631
14632static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
14633 vector bool int *__c) {
14634 return vec_stl(
14635 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14636 __b, __c);
14637}
14638
14639static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
14640 vector float *__c) {
14641 return vec_stl(
14642 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14643 __b, __c);
14644}
14645
14646/* vec_promote */
14647
14648static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
14649 int __b) {
14650 const vector signed char __zero = (vector signed char)0;
14651 vector signed char __res =
14652 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1,
14653 -1, -1, -1, -1, -1, -1, -1, -1);
14654 __res[__b & 0xf] = __a;
14655 return __res;
14656}
14657
14658static __inline__ vector unsigned char __ATTRS_o_ai
14659vec_promote(unsigned char __a, int __b) {
14660 const vector unsigned char __zero = (vector unsigned char)(0);
14661 vector unsigned char __res =
14662 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1,
14663 -1, -1, -1, -1, -1, -1, -1, -1);
14664 __res[__b & 0xf] = __a;
14665 return __res;
14666}
14667
14668static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
14669 const vector short __zero = (vector short)(0);
14670 vector short __res =
14671 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1);
14672 __res[__b & 0x7] = __a;
14673 return __res;
14674}
14675
14676static __inline__ vector unsigned short __ATTRS_o_ai
14677vec_promote(unsigned short __a, int __b) {
14678 const vector unsigned short __zero = (vector unsigned short)(0);
14679 vector unsigned short __res =
14680 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1);
14681 __res[__b & 0x7] = __a;
14682 return __res;
14683}
14684
14685static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
14686 const vector int __zero = (vector int)(0);
14687 vector int __res = __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14688 __res[__b & 0x3] = __a;
14689 return __res;
14690}
14691
14692static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
14693 int __b) {
14694 const vector unsigned int __zero = (vector unsigned int)(0);
14695 vector unsigned int __res =
14696 __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14697 __res[__b & 0x3] = __a;
14698 return __res;
14699}
14700
14701static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
14702 const vector float __zero = (vector float)(0);
14703 vector float __res = __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1);
14704 __res[__b & 0x3] = __a;
14705 return __res;
14706}
14707
14708#ifdef __VSX__
14709static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) {
14710 const vector double __zero = (vector double)(0);
14711 vector double __res = __builtin_shufflevector(__zero, __zero, -1, -1);
14712 __res[__b & 0x1] = __a;
14713 return __res;
14714}
14715
14716static __inline__ vector signed long long __ATTRS_o_ai
14717vec_promote(signed long long __a, int __b) {
14718 const vector signed long long __zero = (vector signed long long)(0);
14719 vector signed long long __res =
14720 __builtin_shufflevector(__zero, __zero, -1, -1);
14721 __res[__b & 0x1] = __a;
14722 return __res;
14723}
14724
14725static __inline__ vector unsigned long long __ATTRS_o_ai
14726vec_promote(unsigned long long __a, int __b) {
14727 const vector unsigned long long __zero = (vector unsigned long long)(0);
14728 vector unsigned long long __res =
14729 __builtin_shufflevector(__zero, __zero, -1, -1);
14730 __res[__b & 0x1] = __a;
14731 return __res;
14732}
14733#endif
14734
14735/* vec_splats */
14736
14737static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
14738 return (vector signed char)(__a);
14739}
14740
14741static __inline__ vector unsigned char __ATTRS_o_ai
14742vec_splats(unsigned char __a) {
14743 return (vector unsigned char)(__a);
14744}
14745
14746static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
14747 return (vector short)(__a);
14748}
14749
14750static __inline__ vector unsigned short __ATTRS_o_ai
14751vec_splats(unsigned short __a) {
14752 return (vector unsigned short)(__a);
14753}
14754
14755static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
14756 return (vector int)(__a);
14757}
14758
14759static __inline__ vector unsigned int __ATTRS_o_ai
14760vec_splats(unsigned int __a) {
14761 return (vector unsigned int)(__a);
14762}
14763
14764#ifdef __VSX__
14765static __inline__ vector signed long long __ATTRS_o_ai
14766vec_splats(signed long long __a) {
14767 return (vector signed long long)(__a);
14768}
14769
14770static __inline__ vector unsigned long long __ATTRS_o_ai
14771vec_splats(unsigned long long __a) {
14772 return (vector unsigned long long)(__a);
14773}
14774
14775#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
14776 defined(__SIZEOF_INT128__)
14777static __inline__ vector signed __int128 __ATTRS_o_ai
14778vec_splats(signed __int128 __a) {
14779 return (vector signed __int128)(__a);
14780}
14781
14782static __inline__ vector unsigned __int128 __ATTRS_o_ai
14783vec_splats(unsigned __int128 __a) {
14784 return (vector unsigned __int128)(__a);
14785}
14786
14787#endif
14788
14789static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
14790 return (vector double)(__a);
14791}
14792#endif
14793
14794static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
14795 return (vector float)(__a);
14796}
14797
14798/* ----------------------------- predicates --------------------------------- */
14799
14800/* vec_all_eq */
14801
14802static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14803 vector signed char __b) {
14804 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14805 (vector char)__b);
14806}
14807
14808static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14809 vector bool char __b) {
14810 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14811 (vector char)__b);
14812}
14813
14814static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14815 vector unsigned 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 unsigned 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 bool char __a,
14827 vector signed 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 bool char __a,
14833 vector unsigned 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 bool 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 short __a,
14845 vector short __b) {
14846 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
14847}
14848
14849static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14850 vector bool short __b) {
14851 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
14852}
14853
14854static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14855 vector unsigned short __b) {
14856 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14857 (vector short)__b);
14858}
14859
14860static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14861 vector bool short __b) {
14862 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14863 (vector short)__b);
14864}
14865
14866static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14867 vector 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 bool short __a,
14873 vector unsigned 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 bool 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 pixel __a,
14885 vector pixel __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 int __a, vector int __b) {
14891 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
14892}
14893
14894static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
14895 vector bool int __b) {
14896 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
14897}
14898
14899static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14900 vector unsigned int __b) {
14901 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14902 (vector int)__b);
14903}
14904
14905static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14906 vector bool int __b) {
14907 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14908 (vector int)__b);
14909}
14910
14911static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14912 vector 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 bool int __a,
14918 vector unsigned 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 bool int __b) {
14925 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14926 (vector int)__b);
14927}
14928
14929#ifdef __VSX__
14930static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
14931 vector signed long long __b) {
14932#ifdef __POWER8_VECTOR__
14933 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
14934#else
14935 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as
14936 // 32-bit elements.
14937 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0);
14938#endif
14939}
14940
14941static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
14942 vector bool long long __b) {
14943 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14944}
14945
14946static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14947 vector unsigned long long __b) {
14948 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14949}
14950
14951static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14952 vector bool long long __b) {
14953 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14954}
14955
14956static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14957 vector long long __b) {
14958 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14959}
14960
14961static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14962 vector unsigned long long __b) {
14963 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14964}
14965
14966static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14967 vector bool long long __b) {
14968 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14969}
14970#endif
14971
14972static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
14973 vector float __b) {
14974#ifdef __VSX__
14975 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
14976#else
14977 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
14978#endif
14979}
14980
14981#ifdef __VSX__
14982static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
14983 vector double __b) {
14984 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
14985}
14986#endif
14987
14988#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
14989static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a,
14990 vector signed __int128 __b) {
14991 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
14992 (vector signed __int128)__b);
14993}
14994
14995static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a,
14996 vector unsigned __int128 __b) {
14997 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a,
14998 (vector signed __int128)__b);
14999}
15000
15001static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a,
15002 vector bool __int128 __b) {
15003 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
15004 (vector signed __int128)__b);
15005}
15006#endif
15007
15008/* vec_all_ge */
15009
15010static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
15011 vector signed char __b) {
15012 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
15013}
15014
15015static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
15016 vector bool char __b) {
15017 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
15018}
15019
15020static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15021 vector unsigned char __b) {
15022 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
15023}
15024
15025static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15026 vector bool char __b) {
15027 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
15028}
15029
15030static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15031 vector signed char __b) {
15032 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a);
15033}
15034
15035static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15036 vector unsigned char __b) {
15037 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
15038}
15039
15040static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15041 vector bool char __b) {
15042 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
15043 (vector unsigned char)__a);
15044}
15045
15046static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15047 vector short __b) {
15048 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
15049}
15050
15051static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15052 vector bool short __b) {
15053 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
15054}
15055
15056static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15057 vector unsigned short __b) {
15058 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
15059}
15060
15061static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15062 vector bool short __b) {
15063 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15064 __a);
15065}
15066
15067static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15068 vector short __b) {
15069 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a);
15070}
15071
15072static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15073 vector unsigned short __b) {
15074 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
15075 (vector unsigned short)__a);
15076}
15077
15078static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15079 vector bool short __b) {
15080 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15081 (vector unsigned short)__a);
15082}
15083
15084static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
15085 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
15086}
15087
15088static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
15089 vector bool int __b) {
15090 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
15091}
15092
15093static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15094 vector unsigned int __b) {
15095 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
15096}
15097
15098static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15099 vector bool int __b) {
15100 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
15101}
15102
15103static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15104 vector int __b) {
15105 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a);
15106}
15107
15108static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15109 vector unsigned int __b) {
15110 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
15111}
15112
15113static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15114 vector bool int __b) {
15115 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
15116 (vector unsigned int)__a);
15117}
15118
15119#ifdef __VSX__
15120static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15121 vector signed long long __b) {
15122 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
15123}
15124static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15125 vector bool long long __b) {
15126 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
15127 __a);
15128}
15129
15130static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15131 vector unsigned long long __b) {
15132 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
15133}
15134
15135static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15136 vector bool long long __b) {
15137 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15138 __a);
15139}
15140
15141static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15142 vector signed long long __b) {
15143 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b,
15144 (vector signed long long)__a);
15145}
15146
15147static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15148 vector unsigned long long __b) {
15149 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
15150 (vector unsigned long long)__a);
15151}
15152
15153static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15154 vector bool long long __b) {
15155 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15156 (vector unsigned long long)__a);
15157}
15158#endif
15159
15160static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
15161 vector float __b) {
15162#ifdef __VSX__
15163 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
15164#else
15165 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
15166#endif
15167}
15168
15169#ifdef __VSX__
15170static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
15171 vector double __b) {
15172 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
15173}
15174#endif
15175
15176#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15177static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a,
15178 vector signed __int128 __b) {
15179 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a);
15180}
15181
15182static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a,
15183 vector unsigned __int128 __b) {
15184 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a);
15185}
15186#endif
15187
15188/* vec_all_gt */
15189
15190static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15191 vector signed char __b) {
15192 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
15193}
15194
15195static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15196 vector bool char __b) {
15197 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
15198}
15199
15200static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15201 vector unsigned char __b) {
15202 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
15203}
15204
15205static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15206 vector bool char __b) {
15207 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
15208}
15209
15210static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15211 vector signed char __b) {
15212 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b);
15213}
15214
15215static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15216 vector unsigned char __b) {
15217 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
15218}
15219
15220static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15221 vector bool char __b) {
15222 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
15223 (vector unsigned char)__b);
15224}
15225
15226static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15227 vector short __b) {
15228 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
15229}
15230
15231static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15232 vector bool short __b) {
15233 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
15234}
15235
15236static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15237 vector unsigned short __b) {
15238 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
15239}
15240
15241static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15242 vector bool short __b) {
15243 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
15244 (vector unsigned short)__b);
15245}
15246
15247static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15248 vector short __b) {
15249 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b);
15250}
15251
15252static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15253 vector unsigned short __b) {
15254 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15255 __b);
15256}
15257
15258static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15259 vector bool short __b) {
15260 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15261 (vector unsigned short)__b);
15262}
15263
15264static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
15265 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
15266}
15267
15268static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
15269 vector bool int __b) {
15270 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
15271}
15272
15273static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15274 vector unsigned int __b) {
15275 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
15276}
15277
15278static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15279 vector bool int __b) {
15280 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
15281}
15282
15283static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15284 vector int __b) {
15285 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b);
15286}
15287
15288static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15289 vector unsigned int __b) {
15290 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
15291}
15292
15293static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15294 vector bool int __b) {
15295 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
15296 (vector unsigned int)__b);
15297}
15298
15299#ifdef __VSX__
15300static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15301 vector signed long long __b) {
15302 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
15303}
15304static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15305 vector bool long long __b) {
15306 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
15307 (vector signed long long)__b);
15308}
15309
15310static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15311 vector unsigned long long __b) {
15312 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
15313}
15314
15315static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15316 vector bool long long __b) {
15317 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
15318 (vector unsigned long long)__b);
15319}
15320
15321static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15322 vector signed long long __b) {
15323 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a,
15324 __b);
15325}
15326
15327static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15328 vector unsigned long long __b) {
15329 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15330 __b);
15331}
15332
15333static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15334 vector bool long long __b) {
15335 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15336 (vector unsigned long long)__b);
15337}
15338#endif
15339
15340static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
15341 vector float __b) {
15342#ifdef __VSX__
15343 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
15344#else
15345 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
15346#endif
15347}
15348
15349#ifdef __VSX__
15350static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
15351 vector double __b) {
15352 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
15353}
15354#endif
15355
15356#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15357static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a,
15358 vector signed __int128 __b) {
15359 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b);
15360}
15361
15362static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a,
15363 vector unsigned __int128 __b) {
15364 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b);
15365}
15366#endif
15367
15368/* vec_all_in */
15369
15370static __inline__ int __attribute__((__always_inline__))
15371vec_all_in(vector float __a, vector float __b) {
15372 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
15373}
15374
15375/* vec_all_le */
15376
15377static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15378 vector signed char __b) {
15379 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
15380}
15381
15382static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15383 vector bool char __b) {
15384 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
15385}
15386
15387static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15388 vector unsigned char __b) {
15389 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
15390}
15391
15392static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15393 vector bool char __b) {
15394 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
15395}
15396
15397static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15398 vector signed char __b) {
15399 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b);
15400}
15401
15402static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15403 vector unsigned char __b) {
15404 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
15405}
15406
15407static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15408 vector bool char __b) {
15409 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
15410 (vector unsigned char)__b);
15411}
15412
15413static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15414 vector short __b) {
15415 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
15416}
15417
15418static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15419 vector bool short __b) {
15420 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
15421}
15422
15423static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15424 vector unsigned short __b) {
15425 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
15426}
15427
15428static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15429 vector bool short __b) {
15430 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
15431 (vector unsigned short)__b);
15432}
15433
15434static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15435 vector short __b) {
15436 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b);
15437}
15438
15439static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15440 vector unsigned short __b) {
15441 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15442 __b);
15443}
15444
15445static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15446 vector bool short __b) {
15447 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15448 (vector unsigned short)__b);
15449}
15450
15451static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
15452 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
15453}
15454
15455static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
15456 vector bool int __b) {
15457 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
15458}
15459
15460static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15461 vector unsigned int __b) {
15462 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
15463}
15464
15465static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15466 vector bool int __b) {
15467 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
15468}
15469
15470static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15471 vector int __b) {
15472 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b);
15473}
15474
15475static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15476 vector unsigned int __b) {
15477 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
15478}
15479
15480static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15481 vector bool int __b) {
15482 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
15483 (vector unsigned int)__b);
15484}
15485
15486#ifdef __VSX__
15487static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15488 vector signed long long __b) {
15489 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
15490}
15491
15492static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15493 vector unsigned long long __b) {
15494 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
15495}
15496
15497static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15498 vector bool long long __b) {
15499 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
15500 (vector signed long long)__b);
15501}
15502
15503static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15504 vector bool long long __b) {
15505 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
15506 (vector unsigned long long)__b);
15507}
15508
15509static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15510 vector signed long long __b) {
15511 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a,
15512 __b);
15513}
15514
15515static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15516 vector unsigned long long __b) {
15517 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15518 __b);
15519}
15520
15521static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15522 vector bool long long __b) {
15523 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15524 (vector unsigned long long)__b);
15525}
15526#endif
15527
15528static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
15529 vector float __b) {
15530#ifdef __VSX__
15531 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
15532#else
15533 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
15534#endif
15535}
15536
15537#ifdef __VSX__
15538static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
15539 vector double __b) {
15540 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
15541}
15542#endif
15543
15544#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15545static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a,
15546 vector signed __int128 __b) {
15547 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b);
15548}
15549
15550static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a,
15551 vector unsigned __int128 __b) {
15552 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b);
15553}
15554#endif
15555
15556/* vec_all_lt */
15557
15558static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15559 vector signed char __b) {
15560 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
15561}
15562
15563static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15564 vector bool char __b) {
15565 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
15566}
15567
15568static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15569 vector unsigned char __b) {
15570 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
15571}
15572
15573static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15574 vector bool char __b) {
15575 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
15576}
15577
15578static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15579 vector signed char __b) {
15580 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a);
15581}
15582
15583static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15584 vector unsigned char __b) {
15585 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
15586}
15587
15588static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15589 vector bool char __b) {
15590 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
15591 (vector unsigned char)__a);
15592}
15593
15594static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15595 vector short __b) {
15596 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
15597}
15598
15599static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15600 vector bool short __b) {
15601 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
15602}
15603
15604static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15605 vector unsigned short __b) {
15606 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
15607}
15608
15609static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15610 vector bool short __b) {
15611 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15612 __a);
15613}
15614
15615static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15616 vector short __b) {
15617 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a);
15618}
15619
15620static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15621 vector unsigned short __b) {
15622 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
15623 (vector unsigned short)__a);
15624}
15625
15626static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15627 vector bool short __b) {
15628 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15629 (vector unsigned short)__a);
15630}
15631
15632static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
15633 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
15634}
15635
15636static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
15637 vector bool int __b) {
15638 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
15639}
15640
15641static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15642 vector unsigned int __b) {
15643 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
15644}
15645
15646static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15647 vector bool int __b) {
15648 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
15649}
15650
15651static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15652 vector int __b) {
15653 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a);
15654}
15655
15656static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15657 vector unsigned int __b) {
15658 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
15659}
15660
15661static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15662 vector bool int __b) {
15663 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
15664 (vector unsigned int)__a);
15665}
15666
15667#ifdef __VSX__
15668static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15669 vector signed long long __b) {
15670 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
15671}
15672
15673static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15674 vector unsigned long long __b) {
15675 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
15676}
15677
15678static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15679 vector bool long long __b) {
15680 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
15681 __a);
15682}
15683
15684static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15685 vector bool long long __b) {
15686 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15687 __a);
15688}
15689
15690static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15691 vector signed long long __b) {
15692 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b,
15693 (vector signed long long)__a);
15694}
15695
15696static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15697 vector unsigned long long __b) {
15698 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
15699 (vector unsigned long long)__a);
15700}
15701
15702static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15703 vector bool long long __b) {
15704 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15705 (vector unsigned long long)__a);
15706}
15707#endif
15708
15709static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
15710 vector float __b) {
15711#ifdef __VSX__
15712 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
15713#else
15714 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
15715#endif
15716}
15717
15718#ifdef __VSX__
15719static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
15720 vector double __b) {
15721 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
15722}
15723#endif
15724
15725#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15726static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a,
15727 vector signed __int128 __b) {
15728 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a);
15729}
15730
15731static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a,
15732 vector unsigned __int128 __b) {
15733 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a);
15734}
15735#endif
15736
15737/* vec_all_nan */
15738
15739static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
15740#ifdef __VSX__
15741 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
15742#else
15743 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
15744#endif
15745}
15746
15747#ifdef __VSX__
15748static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
15749 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
15750}
15751#endif
15752
15753/* vec_all_ne */
15754
15755static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15756 vector signed char __b) {
15757 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15758 (vector char)__b);
15759}
15760
15761static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15762 vector bool char __b) {
15763 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15764 (vector char)__b);
15765}
15766
15767static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15768 vector unsigned 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 unsigned 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 bool char __a,
15780 vector signed 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 bool char __a,
15786 vector unsigned 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 bool 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 short __a,
15798 vector short __b) {
15799 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
15800}
15801
15802static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15803 vector bool short __b) {
15804 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
15805}
15806
15807static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15808 vector unsigned short __b) {
15809 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15810 (vector short)__b);
15811}
15812
15813static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15814 vector bool short __b) {
15815 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15816 (vector short)__b);
15817}
15818
15819static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15820 vector 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 bool short __a,
15826 vector unsigned 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 bool 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 pixel __a,
15838 vector pixel __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 int __a, vector int __b) {
15844 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
15845}
15846
15847static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
15848 vector bool int __b) {
15849 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
15850}
15851
15852static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15853 vector unsigned int __b) {
15854 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15855 (vector int)__b);
15856}
15857
15858static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15859 vector bool int __b) {
15860 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15861 (vector int)__b);
15862}
15863
15864static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15865 vector 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 bool int __a,
15871 vector unsigned 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 bool int __b) {
15878 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15879 (vector int)__b);
15880}
15881
15882#ifdef __VSX__
15883static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15884 vector signed long long __b) {
15885 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
15886}
15887
15888static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15889 vector unsigned long long __b) {
15890 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
15891 (vector long long)__b);
15892}
15893
15894static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15895 vector bool long long __b) {
15896 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
15897 (vector signed long long)__b);
15898}
15899
15900static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15901 vector bool long long __b) {
15902 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15903 (vector signed long long)__b);
15904}
15905
15906static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15907 vector signed long long __b) {
15908 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15909 (vector signed long long)__b);
15910}
15911
15912static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15913 vector unsigned 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 bool long long __b) {
15920 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15921 (vector signed long long)__b);
15922}
15923#endif
15924
15925static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
15926 vector float __b) {
15927#ifdef __VSX__
15928 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
15929#else
15930 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
15931#endif
15932}
15933
15934#ifdef __VSX__
15935static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
15936 vector double __b) {
15937 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
15938}
15939#endif
15940
15941#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15942static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a,
15943 vector signed __int128 __b) {
15944 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15945 __b);
15946}
15947
15948static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a,
15949 vector unsigned __int128 __b) {
15950 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a,
15951 (vector signed __int128)__b);
15952}
15953
15954static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a,
15955 vector bool __int128 __b) {
15956 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15957 (vector signed __int128)__b);
15958}
15959#endif
15960
15961/* vec_all_nge */
15962
15963static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
15964 vector float __b) {
15965#ifdef __VSX__
15966 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
15967#else
15968 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
15969#endif
15970}
15971
15972#ifdef __VSX__
15973static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
15974 vector double __b) {
15975 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
15976}
15977#endif
15978
15979/* vec_all_ngt */
15980
15981static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
15982 vector float __b) {
15983#ifdef __VSX__
15984 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
15985#else
15986 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
15987#endif
15988}
15989
15990#ifdef __VSX__
15991static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
15992 vector double __b) {
15993 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
15994}
15995#endif
15996
15997/* vec_all_nle */
15998
15999static __inline__ int __ATTRS_o_ai
16000vec_all_nle(vector float __a, vector float __b) {
16001#ifdef __VSX__
16002 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a);
16003#else
16004 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
16005#endif
16006}
16007
16008#ifdef __VSX__
16009static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a,
16010 vector double __b) {
16011 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a);
16012}
16013#endif
16014
16015/* vec_all_nlt */
16016
16017static __inline__ int __ATTRS_o_ai
16018vec_all_nlt(vector float __a, vector float __b) {
16019#ifdef __VSX__
16020 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a);
16021#else
16022 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
16023#endif
16024}
16025
16026#ifdef __VSX__
16027static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a,
16028 vector double __b) {
16029 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a);
16030}
16031#endif
16032
16033/* vec_all_numeric */
16034
16035static __inline__ int __ATTRS_o_ai
16036vec_all_numeric(vector float __a) {
16037#ifdef __VSX__
16038 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a);
16039#else
16040 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
16041#endif
16042}
16043
16044#ifdef __VSX__
16045static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) {
16046 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a);
16047}
16048#endif
16049
16050/* vec_any_eq */
16051
16052static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16053 vector signed char __b) {
16054 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16055 (vector char)__b);
16056}
16057
16058static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16059 vector bool char __b) {
16060 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16061 (vector char)__b);
16062}
16063
16064static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16065 vector unsigned 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 unsigned 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 bool char __a,
16077 vector signed 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 bool char __a,
16083 vector unsigned 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 bool 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 short __a,
16095 vector short __b) {
16096 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
16097}
16098
16099static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16100 vector bool short __b) {
16101 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
16102}
16103
16104static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16105 vector unsigned short __b) {
16106 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16107 (vector short)__b);
16108}
16109
16110static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16111 vector bool short __b) {
16112 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16113 (vector short)__b);
16114}
16115
16116static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16117 vector 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 bool short __a,
16123 vector unsigned 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 bool 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 pixel __a,
16135 vector pixel __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 int __a, vector int __b) {
16141 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
16142}
16143
16144static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
16145 vector bool int __b) {
16146 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
16147}
16148
16149static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16150 vector unsigned int __b) {
16151 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16152 (vector int)__b);
16153}
16154
16155static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16156 vector bool int __b) {
16157 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16158 (vector int)__b);
16159}
16160
16161static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16162 vector 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 bool int __a,
16168 vector unsigned 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 bool int __b) {
16175 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16176 (vector int)__b);
16177}
16178
16179#ifdef __VSX__
16180static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16181 vector signed long long __b) {
16182 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
16183}
16184
16185static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16186 vector unsigned long long __b) {
16187 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
16188 (vector long long)__b);
16189}
16190
16191static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16192 vector bool long long __b) {
16193 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
16194 (vector signed long long)__b);
16195}
16196
16197static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16198 vector bool long long __b) {
16199 return __builtin_altivec_vcmpequd_p(
16200 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16201}
16202
16203static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16204 vector signed long long __b) {
16205 return __builtin_altivec_vcmpequd_p(
16206 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16207}
16208
16209static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16210 vector unsigned 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 bool 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#endif
16221
16222static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
16223 vector float __b) {
16224#ifdef __VSX__
16225 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
16226#else
16227 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
16228#endif
16229}
16230
16231#ifdef __VSX__
16232static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
16233 vector double __b) {
16234 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
16235}
16236#endif
16237
16238#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16239static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a,
16240 vector signed __int128 __b) {
16241 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV,
16242 (vector unsigned __int128)__a, __b);
16243}
16244
16245static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a,
16246 vector unsigned __int128 __b) {
16247 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a,
16248 (vector signed __int128)__b);
16249}
16250
16251static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a,
16252 vector bool __int128 __b) {
16253 return __builtin_altivec_vcmpequq_p(
16254 __CR6_EQ_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
16255}
16256#endif
16257
16258/* vec_any_ge */
16259
16260static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16261 vector signed char __b) {
16262 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
16263}
16264
16265static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16266 vector bool char __b) {
16267 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
16268 __a);
16269}
16270
16271static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16272 vector unsigned char __b) {
16273 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
16274}
16275
16276static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16277 vector bool char __b) {
16278 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16279 __a);
16280}
16281
16282static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16283 vector signed char __b) {
16284 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b,
16285 (vector signed char)__a);
16286}
16287
16288static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16289 vector unsigned char __b) {
16290 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
16291 (vector unsigned char)__a);
16292}
16293
16294static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16295 vector bool char __b) {
16296 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16297 (vector unsigned char)__a);
16298}
16299
16300static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16301 vector short __b) {
16302 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
16303}
16304
16305static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16306 vector bool short __b) {
16307 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
16308}
16309
16310static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16311 vector unsigned short __b) {
16312 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
16313}
16314
16315static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16316 vector bool short __b) {
16317 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16318 __a);
16319}
16320
16321static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16322 vector short __b) {
16323 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b,
16324 (vector signed short)__a);
16325}
16326
16327static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16328 vector unsigned short __b) {
16329 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
16330 (vector unsigned short)__a);
16331}
16332
16333static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16334 vector bool short __b) {
16335 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16336 (vector unsigned short)__a);
16337}
16338
16339static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
16340 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
16341}
16342
16343static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
16344 vector bool int __b) {
16345 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
16346}
16347
16348static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16349 vector unsigned int __b) {
16350 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
16351}
16352
16353static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16354 vector bool int __b) {
16355 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16356 __a);
16357}
16358
16359static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16360 vector int __b) {
16361 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b,
16362 (vector signed int)__a);
16363}
16364
16365static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16366 vector unsigned int __b) {
16367 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
16368 (vector unsigned int)__a);
16369}
16370
16371static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16372 vector bool int __b) {
16373 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16374 (vector unsigned int)__a);
16375}
16376
16377#ifdef __VSX__
16378static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16379 vector signed long long __b) {
16380 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
16381}
16382
16383static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16384 vector unsigned long long __b) {
16385 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
16386}
16387
16388static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16389 vector bool long long __b) {
16390 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16391 (vector signed long long)__b, __a);
16392}
16393
16394static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16395 vector bool long long __b) {
16396 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16397 (vector unsigned long long)__b, __a);
16398}
16399
16400static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16401 vector signed long long __b) {
16402 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b,
16403 (vector signed long long)__a);
16404}
16405
16406static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16407 vector unsigned long long __b) {
16408 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
16409 (vector unsigned long long)__a);
16410}
16411
16412static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16413 vector bool long long __b) {
16414 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16415 (vector unsigned long long)__b,
16416 (vector unsigned long long)__a);
16417}
16418#endif
16419
16420static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
16421 vector float __b) {
16422#ifdef __VSX__
16423 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
16424#else
16425 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
16426#endif
16427}
16428
16429#ifdef __VSX__
16430static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
16431 vector double __b) {
16432 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
16433}
16434#endif
16435
16436#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16437static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a,
16438 vector signed __int128 __b) {
16439 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a);
16440}
16441
16442static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a,
16443 vector unsigned __int128 __b) {
16444 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a);
16445}
16446#endif
16447
16448/* vec_any_gt */
16449
16450static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16451 vector signed char __b) {
16452 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
16453}
16454
16455static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16456 vector bool char __b) {
16457 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
16458 (vector signed char)__b);
16459}
16460
16461static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16462 vector unsigned char __b) {
16463 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
16464}
16465
16466static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16467 vector bool char __b) {
16468 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
16469 (vector unsigned char)__b);
16470}
16471
16472static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16473 vector signed char __b) {
16474 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a,
16475 __b);
16476}
16477
16478static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16479 vector unsigned char __b) {
16480 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16481 __b);
16482}
16483
16484static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16485 vector bool char __b) {
16486 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16487 (vector unsigned char)__b);
16488}
16489
16490static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16491 vector short __b) {
16492 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
16493}
16494
16495static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16496 vector bool short __b) {
16497 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
16498}
16499
16500static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16501 vector unsigned short __b) {
16502 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
16503}
16504
16505static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16506 vector bool short __b) {
16507 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
16508 (vector unsigned short)__b);
16509}
16510
16511static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16512 vector short __b) {
16513 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a,
16514 __b);
16515}
16516
16517static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16518 vector unsigned short __b) {
16519 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16520 __b);
16521}
16522
16523static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16524 vector bool short __b) {
16525 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16526 (vector unsigned short)__b);
16527}
16528
16529static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
16530 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
16531}
16532
16533static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
16534 vector bool int __b) {
16535 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
16536}
16537
16538static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16539 vector unsigned int __b) {
16540 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
16541}
16542
16543static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16544 vector bool int __b) {
16545 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
16546 (vector unsigned int)__b);
16547}
16548
16549static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16550 vector int __b) {
16551 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a,
16552 __b);
16553}
16554
16555static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16556 vector unsigned int __b) {
16557 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16558 __b);
16559}
16560
16561static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16562 vector bool int __b) {
16563 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16564 (vector unsigned int)__b);
16565}
16566
16567#ifdef __VSX__
16568static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16569 vector signed long long __b) {
16570 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
16571}
16572
16573static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16574 vector unsigned long long __b) {
16575 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
16576}
16577
16578static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16579 vector bool long long __b) {
16580 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
16581 (vector signed long long)__b);
16582}
16583
16584static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16585 vector bool long long __b) {
16586 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
16587 (vector unsigned long long)__b);
16588}
16589
16590static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16591 vector signed long long __b) {
16592 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16593 (vector signed long long)__a, __b);
16594}
16595
16596static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16597 vector unsigned long long __b) {
16598 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16599 (vector unsigned long long)__a, __b);
16600}
16601
16602static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16603 vector bool long long __b) {
16604 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16605 (vector unsigned long long)__a,
16606 (vector unsigned long long)__b);
16607}
16608#endif
16609
16610static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
16611 vector float __b) {
16612#ifdef __VSX__
16613 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
16614#else
16615 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
16616#endif
16617}
16618
16619#ifdef __VSX__
16620static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
16621 vector double __b) {
16622 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
16623}
16624#endif
16625
16626#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16627static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a,
16628 vector signed __int128 __b) {
16629 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b);
16630}
16631
16632static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a,
16633 vector unsigned __int128 __b) {
16634 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b);
16635}
16636#endif
16637
16638/* vec_any_le */
16639
16640static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16641 vector signed char __b) {
16642 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
16643}
16644
16645static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16646 vector bool char __b) {
16647 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
16648 (vector signed char)__b);
16649}
16650
16651static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16652 vector unsigned char __b) {
16653 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
16654}
16655
16656static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16657 vector bool char __b) {
16658 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
16659 (vector unsigned char)__b);
16660}
16661
16662static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16663 vector signed char __b) {
16664 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a,
16665 __b);
16666}
16667
16668static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16669 vector unsigned char __b) {
16670 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16671 __b);
16672}
16673
16674static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16675 vector bool char __b) {
16676 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16677 (vector unsigned char)__b);
16678}
16679
16680static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16681 vector short __b) {
16682 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
16683}
16684
16685static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16686 vector bool short __b) {
16687 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
16688}
16689
16690static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16691 vector unsigned short __b) {
16692 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
16693}
16694
16695static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16696 vector bool short __b) {
16697 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
16698 (vector unsigned short)__b);
16699}
16700
16701static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16702 vector short __b) {
16703 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a,
16704 __b);
16705}
16706
16707static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16708 vector unsigned short __b) {
16709 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16710 __b);
16711}
16712
16713static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16714 vector bool short __b) {
16715 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16716 (vector unsigned short)__b);
16717}
16718
16719static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
16720 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
16721}
16722
16723static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
16724 vector bool int __b) {
16725 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
16726}
16727
16728static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16729 vector unsigned int __b) {
16730 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
16731}
16732
16733static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16734 vector bool int __b) {
16735 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
16736 (vector unsigned int)__b);
16737}
16738
16739static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16740 vector int __b) {
16741 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a,
16742 __b);
16743}
16744
16745static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16746 vector unsigned int __b) {
16747 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16748 __b);
16749}
16750
16751static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16752 vector bool int __b) {
16753 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16754 (vector unsigned int)__b);
16755}
16756
16757#ifdef __VSX__
16758static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16759 vector signed long long __b) {
16760 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
16761}
16762
16763static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16764 vector unsigned long long __b) {
16765 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
16766}
16767
16768static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16769 vector bool long long __b) {
16770 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
16771 (vector signed long long)__b);
16772}
16773
16774static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16775 vector bool long long __b) {
16776 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
16777 (vector unsigned long long)__b);
16778}
16779
16780static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16781 vector signed long long __b) {
16782 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16783 (vector signed long long)__a, __b);
16784}
16785
16786static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16787 vector unsigned long long __b) {
16788 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16789 (vector unsigned long long)__a, __b);
16790}
16791
16792static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16793 vector bool long long __b) {
16794 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16795 (vector unsigned long long)__a,
16796 (vector unsigned long long)__b);
16797}
16798#endif
16799
16800static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
16801 vector float __b) {
16802#ifdef __VSX__
16803 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
16804#else
16805 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
16806#endif
16807}
16808
16809#ifdef __VSX__
16810static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
16811 vector double __b) {
16812 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
16813}
16814#endif
16815
16816#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16817static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a,
16818 vector signed __int128 __b) {
16819 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b);
16820}
16821
16822static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a,
16823 vector unsigned __int128 __b) {
16824 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b);
16825}
16826#endif
16827
16828/* vec_any_lt */
16829
16830static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16831 vector signed char __b) {
16832 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
16833}
16834
16835static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16836 vector bool char __b) {
16837 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
16838 __a);
16839}
16840
16841static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16842 vector unsigned char __b) {
16843 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
16844}
16845
16846static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16847 vector bool char __b) {
16848 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16849 __a);
16850}
16851
16852static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16853 vector signed char __b) {
16854 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b,
16855 (vector signed char)__a);
16856}
16857
16858static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16859 vector unsigned char __b) {
16860 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
16861 (vector unsigned char)__a);
16862}
16863
16864static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16865 vector bool char __b) {
16866 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16867 (vector unsigned char)__a);
16868}
16869
16870static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16871 vector short __b) {
16872 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
16873}
16874
16875static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16876 vector bool short __b) {
16877 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
16878}
16879
16880static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16881 vector unsigned short __b) {
16882 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
16883}
16884
16885static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16886 vector bool short __b) {
16887 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16888 __a);
16889}
16890
16891static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16892 vector short __b) {
16893 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b,
16894 (vector signed short)__a);
16895}
16896
16897static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16898 vector unsigned short __b) {
16899 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
16900 (vector unsigned short)__a);
16901}
16902
16903static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16904 vector bool short __b) {
16905 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16906 (vector unsigned short)__a);
16907}
16908
16909static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
16910 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
16911}
16912
16913static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
16914 vector bool int __b) {
16915 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
16916}
16917
16918static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16919 vector unsigned int __b) {
16920 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
16921}
16922
16923static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16924 vector bool int __b) {
16925 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16926 __a);
16927}
16928
16929static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16930 vector int __b) {
16931 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b,
16932 (vector signed int)__a);
16933}
16934
16935static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16936 vector unsigned int __b) {
16937 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
16938 (vector unsigned int)__a);
16939}
16940
16941static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16942 vector bool int __b) {
16943 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16944 (vector unsigned int)__a);
16945}
16946
16947#ifdef __VSX__
16948static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16949 vector signed long long __b) {
16950 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
16951}
16952
16953static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16954 vector unsigned long long __b) {
16955 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
16956}
16957
16958static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16959 vector bool long long __b) {
16960 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16961 (vector signed long long)__b, __a);
16962}
16963
16964static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16965 vector bool long long __b) {
16966 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16967 (vector unsigned long long)__b, __a);
16968}
16969
16970static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16971 vector signed long long __b) {
16972 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b,
16973 (vector signed long long)__a);
16974}
16975
16976static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16977 vector unsigned long long __b) {
16978 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
16979 (vector unsigned long long)__a);
16980}
16981
16982static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16983 vector bool long long __b) {
16984 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16985 (vector unsigned long long)__b,
16986 (vector unsigned long long)__a);
16987}
16988#endif
16989
16990static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
16991 vector float __b) {
16992#ifdef __VSX__
16993 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
16994#else
16995 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
16996#endif
16997}
16998
16999#ifdef __VSX__
17000static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
17001 vector double __b) {
17002 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
17003}
17004#endif
17005
17006#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17007static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a,
17008 vector signed __int128 __b) {
17009 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a);
17010}
17011
17012static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a,
17013 vector unsigned __int128 __b) {
17014 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a);
17015}
17016#endif
17017
17018/* vec_any_nan */
17019
17020static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) {
17021#ifdef __VSX__
17022 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a);
17023#else
17024 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
17025#endif
17026}
17027#ifdef __VSX__
17028static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) {
17029 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a);
17030}
17031#endif
17032
17033/* vec_any_ne */
17034
17035static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17036 vector signed char __b) {
17037 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17038 (vector char)__b);
17039}
17040
17041static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17042 vector bool char __b) {
17043 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17044 (vector char)__b);
17045}
17046
17047static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17048 vector unsigned 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 unsigned 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 bool char __a,
17060 vector signed 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 bool char __a,
17066 vector unsigned 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 bool 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 short __a,
17078 vector short __b) {
17079 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
17080}
17081
17082static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17083 vector bool short __b) {
17084 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
17085}
17086
17087static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17088 vector unsigned short __b) {
17089 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17090 (vector short)__b);
17091}
17092
17093static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17094 vector bool short __b) {
17095 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17096 (vector short)__b);
17097}
17098
17099static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17100 vector 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 bool short __a,
17106 vector unsigned 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 bool 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 pixel __a,
17118 vector pixel __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 int __a, vector int __b) {
17124 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
17125}
17126
17127static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
17128 vector bool int __b) {
17129 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
17130}
17131
17132static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17133 vector unsigned int __b) {
17134 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17135 (vector int)__b);
17136}
17137
17138static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17139 vector bool int __b) {
17140 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17141 (vector int)__b);
17142}
17143
17144static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17145 vector 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 bool int __a,
17151 vector unsigned 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 bool int __b) {
17158 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17159 (vector int)__b);
17160}
17161
17162#ifdef __VSX__
17163static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17164 vector signed long long __b) {
17165#ifdef __POWER8_VECTOR__
17166 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
17167#else
17168 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is
17169 // not available.
17170 return !vec_all_eq(__a, __b);
17171#endif
17172}
17173
17174static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17175 vector unsigned long long __b) {
17176 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17177}
17178
17179static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17180 vector bool long long __b) {
17181 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17182}
17183
17184static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17185 vector bool long long __b) {
17186 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17187}
17188
17189static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17190 vector signed long long __b) {
17191 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17192}
17193
17194static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17195 vector unsigned long long __b) {
17196 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17197}
17198
17199static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17200 vector bool long long __b) {
17201 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17202}
17203#endif
17204
17205static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
17206 vector float __b) {
17207#ifdef __VSX__
17208 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
17209#else
17210 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
17211#endif
17212}
17213
17214#ifdef __VSX__
17215static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
17216 vector double __b) {
17217 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
17218}
17219#endif
17220
17221#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17222static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a,
17223 vector signed __int128 __b) {
17224 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV,
17225 (vector unsigned __int128)__a, __b);
17226}
17227
17228static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a,
17229 vector unsigned __int128 __b) {
17230 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a,
17231 (vector signed __int128)__b);
17232}
17233
17234static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a,
17235 vector bool __int128 __b) {
17236 return __builtin_altivec_vcmpequq_p(
17237 __CR6_LT_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
17238}
17239#endif
17240
17241/* vec_any_nge */
17242
17243static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a,
17244 vector float __b) {
17245#ifdef __VSX__
17246 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b);
17247#else
17248 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
17249#endif
17250}
17251
17252#ifdef __VSX__
17253static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a,
17254 vector double __b) {
17255 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b);
17256}
17257#endif
17258
17259/* vec_any_ngt */
17260
17261static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a,
17262 vector float __b) {
17263#ifdef __VSX__
17264 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b);
17265#else
17266 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
17267#endif
17268}
17269
17270#ifdef __VSX__
17271static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a,
17272 vector double __b) {
17273 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b);
17274}
17275#endif
17276
17277/* vec_any_nle */
17278
17279static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a,
17280 vector float __b) {
17281#ifdef __VSX__
17282 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a);
17283#else
17284 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
17285#endif
17286}
17287
17288#ifdef __VSX__
17289static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a,
17290 vector double __b) {
17291 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a);
17292}
17293#endif
17294
17295/* vec_any_nlt */
17296
17297static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a,
17298 vector float __b) {
17299#ifdef __VSX__
17300 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a);
17301#else
17302 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
17303#endif
17304}
17305
17306#ifdef __VSX__
17307static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a,
17308 vector double __b) {
17309 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a);
17310}
17311#endif
17312
17313/* vec_any_numeric */
17314
17315static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) {
17316#ifdef __VSX__
17317 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a);
17318#else
17319 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
17320#endif
17321}
17322
17323#ifdef __VSX__
17324static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) {
17325 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a);
17326}
17327#endif
17328
17329/* vec_any_out */
17330
17331static __inline__ int __attribute__((__always_inline__))
17332vec_any_out(vector float __a, vector float __b) {
17333 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
17334}
17335
17336/* Power 8 Crypto functions
17337Note: We diverge from the current GCC implementation with regard
17338to cryptography and related functions as follows:
17339- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
17340- The remaining ones are only available on Power8 and up so
17341 require -mpower8-vector
17342The justification for this is that export requirements require that
17343Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
17344support). As a result, we need to be able to turn off support for those.
17345The remaining ones (currently controlled by -mcrypto for GCC) still
17346need to be provided on compliant hardware even if Vector.Crypto is not
17347provided.
17348*/
17349#ifdef __CRYPTO__
17350#define vec_sbox_be __builtin_altivec_crypto_vsbox
17351#define vec_cipher_be __builtin_altivec_crypto_vcipher
17352#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
17353#define vec_ncipher_be __builtin_altivec_crypto_vncipher
17354#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
17355
17356#ifdef __VSX__
17357static __inline__ vector unsigned char __attribute__((__always_inline__))
17358__builtin_crypto_vsbox(vector unsigned char __a) {
17359 return __builtin_altivec_crypto_vsbox(__a);
17360}
17361
17362static __inline__ vector unsigned char __attribute__((__always_inline__))
17363__builtin_crypto_vcipher(vector unsigned char __a,
17364 vector unsigned char __b) {
17365 return __builtin_altivec_crypto_vcipher(__a, __b);
17366}
17367
17368static __inline__ vector unsigned char __attribute__((__always_inline__))
17369__builtin_crypto_vcipherlast(vector unsigned char __a,
17370 vector unsigned char __b) {
17371 return __builtin_altivec_crypto_vcipherlast(__a, __b);
17372}
17373
17374static __inline__ vector unsigned char __attribute__((__always_inline__))
17375__builtin_crypto_vncipher(vector unsigned char __a,
17376 vector unsigned char __b) {
17377 return __builtin_altivec_crypto_vncipher(__a, __b);
17378}
17379
17380static __inline__ vector unsigned char __attribute__((__always_inline__))
17381__builtin_crypto_vncipherlast(vector unsigned char __a,
17382 vector unsigned char __b) {
17383 return __builtin_altivec_crypto_vncipherlast(__a, __b);
17384}
17385#endif /* __VSX__ */
17386
17387#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
17388#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
17389
17390#define vec_shasigma_be(X, Y, Z) \
17391 _Generic((X), vector unsigned int \
17392 : __builtin_crypto_vshasigmaw, vector unsigned long long \
17393 : __builtin_crypto_vshasigmad)((X), (Y), (Z))
17394#endif
17395
17396#ifdef __POWER8_VECTOR__
17397static __inline__ vector bool char __ATTRS_o_ai
17398vec_permxor(vector bool char __a, vector bool char __b,
17399 vector bool char __c) {
17400 return (vector bool char)__builtin_altivec_crypto_vpermxor(
17401 (vector unsigned char)__a, (vector unsigned char)__b,
17402 (vector unsigned char)__c);
17403}
17404
17405static __inline__ vector signed char __ATTRS_o_ai
17406vec_permxor(vector signed char __a, vector signed char __b,
17407 vector signed char __c) {
17408 return (vector signed char)__builtin_altivec_crypto_vpermxor(
17409 (vector unsigned char)__a, (vector unsigned char)__b,
17410 (vector unsigned char)__c);
17411}
17412
17413static __inline__ vector unsigned char __ATTRS_o_ai
17414vec_permxor(vector unsigned char __a, vector unsigned char __b,
17415 vector unsigned char __c) {
17416 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17417}
17418
17419static __inline__ vector unsigned char __ATTRS_o_ai
17420__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
17421 vector unsigned char __c) {
17422 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17423}
17424
17425static __inline__ vector unsigned short __ATTRS_o_ai
17426__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
17427 vector unsigned short __c) {
17428 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
17429 (vector unsigned char)__a, (vector unsigned char)__b,
17430 (vector unsigned char)__c);
17431}
17432
17433static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
17434 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
17435 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
17436 (vector unsigned char)__a, (vector unsigned char)__b,
17437 (vector unsigned char)__c);
17438}
17439
17440static __inline__ vector unsigned long long __ATTRS_o_ai
17441__builtin_crypto_vpermxor(vector unsigned long long __a,
17442 vector unsigned long long __b,
17443 vector unsigned long long __c) {
17444 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
17445 (vector unsigned char)__a, (vector unsigned char)__b,
17446 (vector unsigned char)__c);
17447}
17448
17449static __inline__ vector unsigned char __ATTRS_o_ai
17450__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
17451 return __builtin_altivec_crypto_vpmsumb(__a, __b);
17452}
17453
17454static __inline__ vector unsigned short __ATTRS_o_ai
17455__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
17456 return __builtin_altivec_crypto_vpmsumh(__a, __b);
17457}
17458
17459static __inline__ vector unsigned int __ATTRS_o_ai
17460__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
17461 return __builtin_altivec_crypto_vpmsumw(__a, __b);
17462}
17463
17464static __inline__ vector unsigned long long __ATTRS_o_ai
17465__builtin_crypto_vpmsumb(vector unsigned long long __a,
17466 vector unsigned long long __b) {
17467 return __builtin_altivec_crypto_vpmsumd(__a, __b);
17468}
17469
17470static __inline__ vector signed char __ATTRS_o_ai
17471vec_vgbbd(vector signed char __a) {
17472 return (vector signed char)__builtin_altivec_vgbbd((vector unsigned char)__a);
17473}
17474
17475#define vec_pmsum_be __builtin_crypto_vpmsumb
17476#define vec_gb __builtin_altivec_vgbbd
17477
17478static __inline__ vector unsigned char __ATTRS_o_ai
17479vec_vgbbd(vector unsigned char __a) {
17480 return __builtin_altivec_vgbbd(__a);
17481}
17482
17483static __inline__ vector signed long long __ATTRS_o_ai
17484vec_gbb(vector signed long long __a) {
17485 return (vector signed long long)__builtin_altivec_vgbbd(
17486 (vector unsigned char)__a);
17487}
17488
17489static __inline__ vector unsigned long long __ATTRS_o_ai
17490vec_gbb(vector unsigned long long __a) {
17491 return (vector unsigned long long)__builtin_altivec_vgbbd(
17492 (vector unsigned char)__a);
17493}
17494
17495static __inline__ vector long long __ATTRS_o_ai
17496vec_vbpermq(vector signed char __a, vector signed char __b) {
17497 return (vector long long)__builtin_altivec_vbpermq((vector unsigned char)__a,
17498 (vector unsigned char)__b);
17499}
17500
17501static __inline__ vector long long __ATTRS_o_ai
17502vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
17503 return (vector long long)__builtin_altivec_vbpermq(__a, __b);
17504}
17505
17506#if defined(__powerpc64__) && defined(__SIZEOF_INT128__)
17507static __inline__ vector unsigned long long __ATTRS_o_ai
17508vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
17509 return __builtin_altivec_vbpermq((vector unsigned char)__a,
17510 (vector unsigned char)__b);
17511}
17512#endif
17513static __inline__ vector unsigned char __ATTRS_o_ai
17514vec_bperm(vector unsigned char __a, vector unsigned char __b) {
17515 return (vector unsigned char)__builtin_altivec_vbpermq(__a, __b);
17516}
17517#endif // __POWER8_VECTOR__
17518#ifdef __POWER9_VECTOR__
17519static __inline__ vector unsigned long long __ATTRS_o_ai
17520vec_bperm(vector unsigned long long __a, vector unsigned char __b) {
17521 return __builtin_altivec_vbpermd(__a, __b);
17522}
17523#endif
17524
17525
17526/* vec_reve */
17527
17528static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
17529 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17530 5, 4, 3, 2, 1, 0);
17531}
17532
17533static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
17534 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17535 5, 4, 3, 2, 1, 0);
17536}
17537
17538static inline __ATTRS_o_ai vector unsigned char
17539vec_reve(vector unsigned char __a) {
17540 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17541 5, 4, 3, 2, 1, 0);
17542}
17543
17544static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
17545 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17546}
17547
17548static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
17549 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17550}
17551
17552static inline __ATTRS_o_ai vector unsigned int
17553vec_reve(vector unsigned int __a) {
17554 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17555}
17556
17557static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
17558 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17559}
17560
17561static inline __ATTRS_o_ai vector signed short
17562vec_reve(vector signed short __a) {
17563 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17564}
17565
17566static inline __ATTRS_o_ai vector unsigned short
17567vec_reve(vector unsigned short __a) {
17568 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17569}
17570
17571static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
17572 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17573}
17574
17575#ifdef __VSX__
17576static inline __ATTRS_o_ai vector bool long long
17577vec_reve(vector bool long long __a) {
17578 return __builtin_shufflevector(__a, __a, 1, 0);
17579}
17580
17581static inline __ATTRS_o_ai vector signed long long
17582vec_reve(vector signed long long __a) {
17583 return __builtin_shufflevector(__a, __a, 1, 0);
17584}
17585
17586static inline __ATTRS_o_ai vector unsigned long long
17587vec_reve(vector unsigned long long __a) {
17588 return __builtin_shufflevector(__a, __a, 1, 0);
17589}
17590
17591static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
17592 return __builtin_shufflevector(__a, __a, 1, 0);
17593}
17594#endif
17595
17596/* vec_revb */
17597static __inline__ vector bool char __ATTRS_o_ai
17598vec_revb(vector bool char __a) {
17599 return __a;
17600}
17601
17602static __inline__ vector signed char __ATTRS_o_ai
17603vec_revb(vector signed char __a) {
17604 return __a;
17605}
17606
17607static __inline__ vector unsigned char __ATTRS_o_ai
17608vec_revb(vector unsigned char __a) {
17609 return __a;
17610}
17611
17612static __inline__ vector bool short __ATTRS_o_ai
17613vec_revb(vector bool short __a) {
17614 vector unsigned char __indices =
17615 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17616 return vec_perm(__a, __a, __indices);
17617}
17618
17619static __inline__ vector signed short __ATTRS_o_ai
17620vec_revb(vector signed short __a) {
17621 vector unsigned char __indices =
17622 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17623 return vec_perm(__a, __a, __indices);
17624}
17625
17626static __inline__ vector unsigned short __ATTRS_o_ai
17627vec_revb(vector unsigned short __a) {
17628 vector unsigned char __indices =
17629 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17630 return vec_perm(__a, __a, __indices);
17631}
17632
17633static __inline__ vector bool int __ATTRS_o_ai
17634vec_revb(vector bool int __a) {
17635 vector unsigned char __indices =
17636 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17637 return vec_perm(__a, __a, __indices);
17638}
17639
17640static __inline__ vector signed int __ATTRS_o_ai
17641vec_revb(vector signed int __a) {
17642 vector unsigned char __indices =
17643 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17644 return vec_perm(__a, __a, __indices);
17645}
17646
17647static __inline__ vector unsigned int __ATTRS_o_ai
17648vec_revb(vector unsigned int __a) {
17649 vector unsigned char __indices =
17650 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17651 return vec_perm(__a, __a, __indices);
17652}
17653
17654static __inline__ vector float __ATTRS_o_ai
17655vec_revb(vector float __a) {
17656 vector unsigned char __indices =
17657 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17658 return vec_perm(__a, __a, __indices);
17659}
17660
17661#ifdef __VSX__
17662static __inline__ vector bool long long __ATTRS_o_ai
17663vec_revb(vector bool long long __a) {
17664 vector unsigned char __indices =
17665 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17666 return vec_perm(__a, __a, __indices);
17667}
17668
17669static __inline__ vector signed long long __ATTRS_o_ai
17670vec_revb(vector signed long long __a) {
17671 vector unsigned char __indices =
17672 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17673 return vec_perm(__a, __a, __indices);
17674}
17675
17676static __inline__ vector unsigned long long __ATTRS_o_ai
17677vec_revb(vector unsigned long long __a) {
17678 vector unsigned char __indices =
17679 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17680 return vec_perm(__a, __a, __indices);
17681}
17682
17683static __inline__ vector double __ATTRS_o_ai
17684vec_revb(vector double __a) {
17685 vector unsigned char __indices =
17686 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17687 return vec_perm(__a, __a, __indices);
17688}
17689#endif /* End __VSX__ */
17690
17691#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17692 defined(__SIZEOF_INT128__)
17693static __inline__ vector signed __int128 __ATTRS_o_ai
17694vec_revb(vector signed __int128 __a) {
17695 vector unsigned char __indices =
17696 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17697 return (vector signed __int128)vec_perm((vector signed int)__a,
17698 (vector signed int)__a,
17699 __indices);
17700}
17701
17702static __inline__ vector unsigned __int128 __ATTRS_o_ai
17703vec_revb(vector unsigned __int128 __a) {
17704 vector unsigned char __indices =
17705 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17706 return (vector unsigned __int128)vec_perm((vector signed int)__a,
17707 (vector signed int)__a,
17708 __indices);
17709}
17710#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
17711
17712/* vec_xl */
17713
17714#define vec_xld2 vec_xl
17715#define vec_xlw4 vec_xl
17716typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
17717typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
17718typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
17719typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
17720typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
17721typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
17722typedef vector float unaligned_vec_float __attribute__((aligned(1)));
17723
17724static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
17725 const signed char *__ptr) {
17726 return *(unaligned_vec_schar *)(__ptr + __offset);
17727}
17728
17729static inline __ATTRS_o_ai vector unsigned char
17730vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
17731 return *(unaligned_vec_uchar*)(__ptr + __offset);
17732}
17733
17734static inline __ATTRS_o_ai vector signed short
17735vec_xl(ptrdiff_t __offset, const signed short *__ptr) {
17736 signed char *__addr = (signed char *)__ptr + __offset;
17737 return *(unaligned_vec_sshort *)__addr;
17738}
17739
17740static inline __ATTRS_o_ai vector unsigned short
17741vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
17742 signed char *__addr = (signed char *)__ptr + __offset;
17743 return *(unaligned_vec_ushort *)__addr;
17744}
17745
17746static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
17747 const signed int *__ptr) {
17748 signed char *__addr = (signed char *)__ptr + __offset;
17749 return *(unaligned_vec_sint *)__addr;
17750}
17751
17752static inline __ATTRS_o_ai vector unsigned int
17753vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
17754 signed char *__addr = (signed char *)__ptr + __offset;
17755 return *(unaligned_vec_uint *)__addr;
17756}
17757
17758static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
17759 const float *__ptr) {
17760 signed char *__addr = (signed char *)__ptr + __offset;
17761 return *(unaligned_vec_float *)__addr;
17762}
17763
17764#ifdef __VSX__
17765typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
17766typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
17767typedef vector double unaligned_vec_double __attribute__((aligned(1)));
17768
17769static inline __ATTRS_o_ai vector signed long long
17770vec_xl(ptrdiff_t __offset, const signed long long *__ptr) {
17771 signed char *__addr = (signed char *)__ptr + __offset;
17772 return *(unaligned_vec_sll *)__addr;
17773}
17774
17775static inline __ATTRS_o_ai vector unsigned long long
17776vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
17777 signed char *__addr = (signed char *)__ptr + __offset;
17778 return *(unaligned_vec_ull *)__addr;
17779}
17780
17781static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
17782 const double *__ptr) {
17783 signed char *__addr = (signed char *)__ptr + __offset;
17784 return *(unaligned_vec_double *)__addr;
17785}
17786#endif
17787
17788#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17789 defined(__SIZEOF_INT128__)
17790typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
17791typedef vector unsigned __int128 unaligned_vec_ui128
17792 __attribute__((aligned(1)));
17793static inline __ATTRS_o_ai vector signed __int128
17794vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) {
17795 signed char *__addr = (signed char *)__ptr + __offset;
17796 return *(unaligned_vec_si128 *)__addr;
17797}
17798
17799static inline __ATTRS_o_ai vector unsigned __int128
17800vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
17801 signed char *__addr = (signed char *)__ptr + __offset;
17802 return *(unaligned_vec_ui128 *)__addr;
17803}
17804#endif
17805
17806/* vec_xl_be */
17807
17808#ifdef __LITTLE_ENDIAN__
17809static __inline__ vector signed char __ATTRS_o_ai
17810vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) {
17811 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17812 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17813 13, 12, 11, 10, 9, 8);
17814}
17815
17816static __inline__ vector unsigned char __ATTRS_o_ai
17817vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) {
17818 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17819 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17820 13, 12, 11, 10, 9, 8);
17821}
17822
17823static __inline__ vector signed short __ATTRS_o_ai
17824vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) {
17825 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17826 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17827}
17828
17829static __inline__ vector unsigned short __ATTRS_o_ai
17830vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) {
17831 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17832 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17833}
17834
17835static __inline__ vector signed int __ATTRS_o_ai
17836vec_xl_be(signed long long __offset, const signed int *__ptr) {
17837 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17838}
17839
17840static __inline__ vector unsigned int __ATTRS_o_ai
17841vec_xl_be(signed long long __offset, const unsigned int *__ptr) {
17842 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17843}
17844
17845static __inline__ vector float __ATTRS_o_ai
17846vec_xl_be(signed long long __offset, const float *__ptr) {
17847 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17848}
17849
17850#ifdef __VSX__
17851static __inline__ vector signed long long __ATTRS_o_ai
17852vec_xl_be(signed long long __offset, const signed long long *__ptr) {
17853 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17854}
17855
17856static __inline__ vector unsigned long long __ATTRS_o_ai
17857vec_xl_be(signed long long __offset, const unsigned long long *__ptr) {
17858 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17859}
17860
17861static __inline__ vector double __ATTRS_o_ai
17862vec_xl_be(signed long long __offset, const double *__ptr) {
17863 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17864}
17865#endif
17866
17867#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17868 defined(__SIZEOF_INT128__)
17869static __inline__ vector signed __int128 __ATTRS_o_ai
17870vec_xl_be(signed long long __offset, const signed __int128 *__ptr) {
17871 return vec_xl(__offset, __ptr);
17872}
17873
17874static __inline__ vector unsigned __int128 __ATTRS_o_ai
17875vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
17876 return vec_xl(__offset, __ptr);
17877}
17878#endif
17879#else
17880 #define vec_xl_be vec_xl
17881#endif
17882
17883#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
17884 defined(__SIZEOF_INT128__)
17885
17886/* vec_xl_sext */
17887
17888static __inline__ vector signed __int128 __ATTRS_o_ai
17889vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) {
17890 return (vector signed __int128)*(__pointer + __offset);
17891}
17892
17893static __inline__ vector signed __int128 __ATTRS_o_ai
17894vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) {
17895 return (vector signed __int128)*(__pointer + __offset);
17896}
17897
17898static __inline__ vector signed __int128 __ATTRS_o_ai
17899vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) {
17900 return (vector signed __int128)*(__pointer + __offset);
17901}
17902
17903static __inline__ vector signed __int128 __ATTRS_o_ai
17904vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) {
17905 return (vector signed __int128)*(__pointer + __offset);
17906}
17907
17908/* vec_xl_zext */
17909
17910static __inline__ vector unsigned __int128 __ATTRS_o_ai
17911vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) {
17912 return (vector unsigned __int128)*(__pointer + __offset);
17913}
17914
17915static __inline__ vector unsigned __int128 __ATTRS_o_ai
17916vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) {
17917 return (vector unsigned __int128)*(__pointer + __offset);
17918}
17919
17920static __inline__ vector unsigned __int128 __ATTRS_o_ai
17921vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) {
17922 return (vector unsigned __int128)*(__pointer + __offset);
17923}
17924
17925static __inline__ vector unsigned __int128 __ATTRS_o_ai
17926vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) {
17927 return (vector unsigned __int128)*(__pointer + __offset);
17928}
17929
17930#endif
17931
17932/* vec_xlds */
17933#ifdef __VSX__
17934static __inline__ vector signed long long __ATTRS_o_ai
17935vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) {
17936 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset);
17937 return (vector signed long long) *__addr;
17938}
17939
17940static __inline__ vector unsigned long long __ATTRS_o_ai
17941vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) {
17942 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset);
17943 return (unaligned_vec_ull) *__addr;
17944}
17945
17946static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset,
17947 const double *__ptr) {
17948 double *__addr = (double*)((signed char *)__ptr + __offset);
17949 return (unaligned_vec_double) *__addr;
17950}
17951
17952/* vec_load_splats */
17953static __inline__ vector signed int __ATTRS_o_ai
17954vec_load_splats(signed long long __offset, const signed int *__ptr) {
17955 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17956 return (vector signed int)*__addr;
17957}
17958
17959static __inline__ vector signed int __ATTRS_o_ai
17960vec_load_splats(unsigned long long __offset, const signed int *__ptr) {
17961 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17962 return (vector signed int)*__addr;
17963}
17964
17965static __inline__ vector unsigned int __ATTRS_o_ai
17966vec_load_splats(signed long long __offset, const unsigned int *__ptr) {
17967 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17968 return (vector unsigned int)*__addr;
17969}
17970
17971static __inline__ vector unsigned int __ATTRS_o_ai
17972vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) {
17973 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17974 return (vector unsigned int)*__addr;
17975}
17976
17977static __inline__ vector float __ATTRS_o_ai
17978vec_load_splats(signed long long __offset, const float *__ptr) {
17979 float *__addr = (float*)((signed char *)__ptr + __offset);
17980 return (vector float)*__addr;
17981}
17982
17983static __inline__ vector float __ATTRS_o_ai
17984vec_load_splats(unsigned long long __offset, const float *__ptr) {
17985 float *__addr = (float*)((signed char *)__ptr + __offset);
17986 return (vector float)*__addr;
17987}
17988#endif
17989
17990/* vec_xst */
17991
17992#define vec_xstd2 vec_xst
17993#define vec_xstw4 vec_xst
17994static inline __ATTRS_o_ai void
17995vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) {
17996 *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
17997}
17998
17999static inline __ATTRS_o_ai void
18000vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) {
18001 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
18002}
18003
18004static inline __ATTRS_o_ai void
18005vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
18006 signed char *__addr = (signed char *)__ptr + __offset;
18007 *(unaligned_vec_sshort *)__addr = __vec;
18008}
18009
18010static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
18011 ptrdiff_t __offset,
18012 unsigned short *__ptr) {
18013 signed char *__addr = (signed char *)__ptr + __offset;
18014 *(unaligned_vec_ushort *)__addr = __vec;
18015}
18016
18017static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
18018 ptrdiff_t __offset, signed int *__ptr) {
18019 signed char *__addr = (signed char *)__ptr + __offset;
18020 *(unaligned_vec_sint *)__addr = __vec;
18021}
18022
18023static inline __ATTRS_o_ai void
18024vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
18025 signed char *__addr = (signed char *)__ptr + __offset;
18026 *(unaligned_vec_uint *)__addr = __vec;
18027}
18028
18029static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
18030 float *__ptr) {
18031 signed char *__addr = (signed char *)__ptr + __offset;
18032 *(unaligned_vec_float *)__addr = __vec;
18033}
18034
18035#ifdef __VSX__
18036static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
18037 ptrdiff_t __offset,
18038 signed long long *__ptr) {
18039 signed char *__addr = (signed char *)__ptr + __offset;
18040 *(unaligned_vec_sll *)__addr = __vec;
18041}
18042
18043static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
18044 ptrdiff_t __offset,
18045 unsigned long long *__ptr) {
18046 signed char *__addr = (signed char *)__ptr + __offset;
18047 *(unaligned_vec_ull *)__addr = __vec;
18048}
18049
18050static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
18051 double *__ptr) {
18052 signed char *__addr = (signed char *)__ptr + __offset;
18053 *(unaligned_vec_double *)__addr = __vec;
18054}
18055#endif
18056
18057#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18058 defined(__SIZEOF_INT128__)
18059static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
18060 ptrdiff_t __offset,
18061 signed __int128 *__ptr) {
18062 signed char *__addr = (signed char *)__ptr + __offset;
18063 *(unaligned_vec_si128 *)__addr = __vec;
18064}
18065
18066static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
18067 ptrdiff_t __offset,
18068 unsigned __int128 *__ptr) {
18069 signed char *__addr = (signed char *)__ptr + __offset;
18070 *(unaligned_vec_ui128 *)__addr = __vec;
18071}
18072#endif
18073
18074/* vec_xst_trunc */
18075
18076#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
18077 defined(__SIZEOF_INT128__)
18078static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18079 ptrdiff_t __offset,
18080 signed char *__ptr) {
18081 *(__ptr + __offset) = (signed char)__vec[0];
18082}
18083
18084static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18085 ptrdiff_t __offset,
18086 unsigned char *__ptr) {
18087 *(__ptr + __offset) = (unsigned char)__vec[0];
18088}
18089
18090static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18091 ptrdiff_t __offset,
18092 signed short *__ptr) {
18093 *(__ptr + __offset) = (signed short)__vec[0];
18094}
18095
18096static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18097 ptrdiff_t __offset,
18098 unsigned short *__ptr) {
18099 *(__ptr + __offset) = (unsigned short)__vec[0];
18100}
18101
18102static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18103 ptrdiff_t __offset,
18104 signed int *__ptr) {
18105 *(__ptr + __offset) = (signed int)__vec[0];
18106}
18107
18108static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18109 ptrdiff_t __offset,
18110 unsigned int *__ptr) {
18111 *(__ptr + __offset) = (unsigned int)__vec[0];
18112}
18113
18114static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18115 ptrdiff_t __offset,
18116 signed long long *__ptr) {
18117 *(__ptr + __offset) = (signed long long)__vec[0];
18118}
18119
18120static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18121 ptrdiff_t __offset,
18122 unsigned long long *__ptr) {
18123 *(__ptr + __offset) = (unsigned long long)__vec[0];
18124}
18125#endif
18126
18127/* vec_xst_be */
18128
18129#ifdef __LITTLE_ENDIAN__
18130static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
18131 signed long long __offset,
18132 signed char *__ptr) {
18133 vector signed char __tmp =
18134 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18135 13, 12, 11, 10, 9, 8);
18136 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18137 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18138}
18139
18140static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
18141 signed long long __offset,
18142 unsigned char *__ptr) {
18143 vector unsigned char __tmp =
18144 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18145 13, 12, 11, 10, 9, 8);
18146 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18147 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18148}
18149
18150static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
18151 signed long long __offset,
18152 signed short *__ptr) {
18153 vector signed short __tmp =
18154 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18155 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18156 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18157}
18158
18159static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
18160 signed long long __offset,
18161 unsigned short *__ptr) {
18162 vector unsigned short __tmp =
18163 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18164 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18165 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18166}
18167
18168static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
18169 signed long long __offset,
18170 signed int *__ptr) {
18171 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
18172}
18173
18174static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
18175 signed long long __offset,
18176 unsigned int *__ptr) {
18177 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18178}
18179
18180static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
18181 signed long long __offset,
18182 float *__ptr) {
18183 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18184}
18185
18186#ifdef __VSX__
18187static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
18188 signed long long __offset,
18189 signed long long *__ptr) {
18190 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18191}
18192
18193static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
18194 signed long long __offset,
18195 unsigned long long *__ptr) {
18196 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18197}
18198
18199static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
18200 signed long long __offset,
18201 double *__ptr) {
18202 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18203}
18204#endif
18205
18206#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18207 defined(__SIZEOF_INT128__)
18208static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
18209 signed long long __offset,
18210 signed __int128 *__ptr) {
18211 vec_xst(__vec, __offset, __ptr);
18212}
18213
18214static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
18215 signed long long __offset,
18216 unsigned __int128 *__ptr) {
18217 vec_xst(__vec, __offset, __ptr);
18218}
18219#endif
18220#else
18221 #define vec_xst_be vec_xst
18222#endif
18223
18224#ifdef __POWER9_VECTOR__
18225#define vec_test_data_class(__a, __b) \
18226 _Generic( \
18227 (__a), vector float \
18228 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
18229 vector double \
18230 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
18231 (__b)))
18232
18233#endif /* #ifdef __POWER9_VECTOR__ */
18234
18235static vector float __ATTRS_o_ai vec_neg(vector float __a) {
18236 return -__a;
18237}
18238
18239#ifdef __VSX__
18240static vector double __ATTRS_o_ai vec_neg(vector double __a) {
18241 return -__a;
18242}
18243
18244#endif
18245
18246#ifdef __VSX__
18247static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
18248 return -__a;
18249}
18250#endif
18251
18252static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
18253 return -__a;
18254}
18255
18256static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
18257 return -__a;
18258}
18259
18260static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
18261 return -__a;
18262}
18263
18264static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
18265 return - vec_abs(__a);
18266}
18267
18268#ifdef __VSX__
18269static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
18270 return - vec_abs(__a);
18271}
18272
18273#endif
18274
18275#ifdef __POWER8_VECTOR__
18276static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
18277 return __builtin_altivec_vminsd(__a, -__a);
18278}
18279#endif
18280
18281static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
18282 return __builtin_altivec_vminsw(__a, -__a);
18283}
18284
18285static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
18286 return __builtin_altivec_vminsh(__a, -__a);
18287}
18288
18289static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
18290 return __builtin_altivec_vminsb(__a, -__a);
18291}
18292
18293static vector float __ATTRS_o_ai vec_recipdiv(vector float __a,
18294 vector float __b) {
18295 return __builtin_ppc_recipdivf(__a, __b);
18296}
18297
18298#ifdef __VSX__
18299static vector double __ATTRS_o_ai vec_recipdiv(vector double __a,
18300 vector double __b) {
18301 return __builtin_ppc_recipdivd(__a, __b);
18302}
18303#endif
18304
18305#ifdef __POWER10_VECTOR__
18306
18307/* vec_extractm */
18308
18309static __inline__ unsigned int __ATTRS_o_ai
18310vec_extractm(vector unsigned char __a) {
18311 return __builtin_altivec_vextractbm(__a);
18312}
18313
18314static __inline__ unsigned int __ATTRS_o_ai
18315vec_extractm(vector unsigned short __a) {
18316 return __builtin_altivec_vextracthm(__a);
18317}
18318
18319static __inline__ unsigned int __ATTRS_o_ai
18320vec_extractm(vector unsigned int __a) {
18321 return __builtin_altivec_vextractwm(__a);
18322}
18323
18324static __inline__ unsigned int __ATTRS_o_ai
18325vec_extractm(vector unsigned long long __a) {
18326 return __builtin_altivec_vextractdm(__a);
18327}
18328
18329#ifdef __SIZEOF_INT128__
18330static __inline__ unsigned int __ATTRS_o_ai
18331vec_extractm(vector unsigned __int128 __a) {
18332 return __builtin_altivec_vextractqm(__a);
18333}
18334#endif
18335
18336/* vec_expandm */
18337
18338static __inline__ vector unsigned char __ATTRS_o_ai
18339vec_expandm(vector unsigned char __a) {
18340 return __builtin_altivec_vexpandbm(__a);
18341}
18342
18343static __inline__ vector unsigned short __ATTRS_o_ai
18344vec_expandm(vector unsigned short __a) {
18345 return __builtin_altivec_vexpandhm(__a);
18346}
18347
18348static __inline__ vector unsigned int __ATTRS_o_ai
18349vec_expandm(vector unsigned int __a) {
18350 return __builtin_altivec_vexpandwm(__a);
18351}
18352
18353static __inline__ vector unsigned long long __ATTRS_o_ai
18354vec_expandm(vector unsigned long long __a) {
18355 return __builtin_altivec_vexpanddm(__a);
18356}
18357
18358#ifdef __SIZEOF_INT128__
18359static __inline__ vector unsigned __int128 __ATTRS_o_ai
18360vec_expandm(vector unsigned __int128 __a) {
18361 return __builtin_altivec_vexpandqm(__a);
18362}
18363#endif
18364
18365/* vec_cntm */
18366
18367#define vec_cntm(__a, __mp) \
18368 _Generic((__a), vector unsigned char \
18369 : __builtin_altivec_vcntmbb((vector unsigned char)(__a), \
18370 (unsigned char)(__mp)), \
18371 vector unsigned short \
18372 : __builtin_altivec_vcntmbh((vector unsigned short)(__a), \
18373 (unsigned char)(__mp)), \
18374 vector unsigned int \
18375 : __builtin_altivec_vcntmbw((vector unsigned int)(__a), \
18376 (unsigned char)(__mp)), \
18377 vector unsigned long long \
18378 : __builtin_altivec_vcntmbd((vector unsigned long long)(__a), \
18379 (unsigned char)(__mp)))
18380
18381/* vec_gen[b|h|w|d|q]m */
18382
18383static __inline__ vector unsigned char __ATTRS_o_ai
18384vec_genbm(unsigned long long __bm) {
18385 return __builtin_altivec_mtvsrbm(__bm);
18386}
18387
18388static __inline__ vector unsigned short __ATTRS_o_ai
18389vec_genhm(unsigned long long __bm) {
18390 return __builtin_altivec_mtvsrhm(__bm);
18391}
18392
18393static __inline__ vector unsigned int __ATTRS_o_ai
18394vec_genwm(unsigned long long __bm) {
18395 return __builtin_altivec_mtvsrwm(__bm);
18396}
18397
18398static __inline__ vector unsigned long long __ATTRS_o_ai
18399vec_gendm(unsigned long long __bm) {
18400 return __builtin_altivec_mtvsrdm(__bm);
18401}
18402
18403#ifdef __SIZEOF_INT128__
18404static __inline__ vector unsigned __int128 __ATTRS_o_ai
18405vec_genqm(unsigned long long __bm) {
18406 return __builtin_altivec_mtvsrqm(__bm);
18407}
18408#endif
18409
18410/* vec_pdep */
18411
18412static __inline__ vector unsigned long long __ATTRS_o_ai
18413vec_pdep(vector unsigned long long __a, vector unsigned long long __b) {
18414 return __builtin_altivec_vpdepd(__a, __b);
18415}
18416
18417/* vec_pext */
18418
18419static __inline__ vector unsigned long long __ATTRS_o_ai
18420vec_pext(vector unsigned long long __a, vector unsigned long long __b) {
18421 return __builtin_altivec_vpextd(__a, __b);
18422}
18423
18424/* vec_cfuge */
18425
18426static __inline__ vector unsigned long long __ATTRS_o_ai
18427vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) {
18428 return __builtin_altivec_vcfuged(__a, __b);
18429}
18430
18431/* vec_gnb */
18432
18433#define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b)
18434
18435/* vec_ternarylogic */
18436#ifdef __VSX__
18437#ifdef __SIZEOF_INT128__
18438#define vec_ternarylogic(__a, __b, __c, __imm) \
18439 _Generic((__a), vector unsigned char \
18440 : (vector unsigned char)__builtin_vsx_xxeval( \
18441 (vector unsigned long long)(__a), \
18442 (vector unsigned long long)(__b), \
18443 (vector unsigned long long)(__c), (__imm)), \
18444 vector unsigned short \
18445 : (vector unsigned short)__builtin_vsx_xxeval( \
18446 (vector unsigned long long)(__a), \
18447 (vector unsigned long long)(__b), \
18448 (vector unsigned long long)(__c), (__imm)), \
18449 vector unsigned int \
18450 : (vector unsigned int)__builtin_vsx_xxeval( \
18451 (vector unsigned long long)(__a), \
18452 (vector unsigned long long)(__b), \
18453 (vector unsigned long long)(__c), (__imm)), \
18454 vector unsigned long long \
18455 : (vector unsigned long long)__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 __int128 \
18460 : (vector unsigned __int128)__builtin_vsx_xxeval( \
18461 (vector unsigned long long)(__a), \
18462 (vector unsigned long long)(__b), \
18463 (vector unsigned long long)(__c), (__imm)))
18464#else
18465#define vec_ternarylogic(__a, __b, __c, __imm) \
18466 _Generic((__a), vector unsigned char \
18467 : (vector unsigned char)__builtin_vsx_xxeval( \
18468 (vector unsigned long long)(__a), \
18469 (vector unsigned long long)(__b), \
18470 (vector unsigned long long)(__c), (__imm)), \
18471 vector unsigned short \
18472 : (vector unsigned short)__builtin_vsx_xxeval( \
18473 (vector unsigned long long)(__a), \
18474 (vector unsigned long long)(__b), \
18475 (vector unsigned long long)(__c), (__imm)), \
18476 vector unsigned int \
18477 : (vector unsigned int)__builtin_vsx_xxeval( \
18478 (vector unsigned long long)(__a), \
18479 (vector unsigned long long)(__b), \
18480 (vector unsigned long long)(__c), (__imm)), \
18481 vector unsigned long long \
18482 : (vector unsigned long long)__builtin_vsx_xxeval( \
18483 (vector unsigned long long)(__a), \
18484 (vector unsigned long long)(__b), \
18485 (vector unsigned long long)(__c), (__imm)))
18486#endif /* __SIZEOF_INT128__ */
18487#endif /* __VSX__ */
18488
18489/* vec_genpcvm */
18490
18491#ifdef __VSX__
18492#define vec_genpcvm(__a, __imm) \
18493 _Generic( \
18494 (__a), vector unsigned char \
18495 : __builtin_vsx_xxgenpcvbm((vector unsigned char)(__a), (int)(__imm)), \
18496 vector unsigned short \
18497 : __builtin_vsx_xxgenpcvhm((vector unsigned short)(__a), (int)(__imm)), \
18498 vector unsigned int \
18499 : __builtin_vsx_xxgenpcvwm((vector unsigned int)(__a), (int)(__imm)), \
18500 vector unsigned long long \
18501 : __builtin_vsx_xxgenpcvdm((vector unsigned long long)(__a), \
18502 (int)(__imm)))
18503#endif /* __VSX__ */
18504
18505/* vec_clr_first */
18506
18507static __inline__ vector signed char __ATTRS_o_ai
18508vec_clr_first(vector signed char __a, unsigned int __n) {
18509#ifdef __LITTLE_ENDIAN__
18510 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18511 __n);
18512#else
18513 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18514 __n);
18515#endif
18516}
18517
18518static __inline__ vector unsigned char __ATTRS_o_ai
18519vec_clr_first(vector unsigned char __a, unsigned int __n) {
18520#ifdef __LITTLE_ENDIAN__
18521 return (vector unsigned char)__builtin_altivec_vclrrb(
18522 (vector unsigned char)__a, __n);
18523#else
18524 return (vector unsigned char)__builtin_altivec_vclrlb(
18525 (vector unsigned char)__a, __n);
18526#endif
18527}
18528
18529/* vec_clr_last */
18530
18531static __inline__ vector signed char __ATTRS_o_ai
18532vec_clr_last(vector signed char __a, unsigned int __n) {
18533#ifdef __LITTLE_ENDIAN__
18534 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18535 __n);
18536#else
18537 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18538 __n);
18539#endif
18540}
18541
18542static __inline__ vector unsigned char __ATTRS_o_ai
18543vec_clr_last(vector unsigned char __a, unsigned int __n) {
18544#ifdef __LITTLE_ENDIAN__
18545 return (vector unsigned char)__builtin_altivec_vclrlb(
18546 (vector unsigned char)__a, __n);
18547#else
18548 return (vector unsigned char)__builtin_altivec_vclrrb(
18549 (vector unsigned char)__a, __n);
18550#endif
18551}
18552
18553/* vec_cntlzm */
18554
18555static __inline__ vector unsigned long long __ATTRS_o_ai
18556vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) {
18557 return __builtin_altivec_vclzdm(__a, __b);
18558}
18559
18560/* vec_cnttzm */
18561
18562static __inline__ vector unsigned long long __ATTRS_o_ai
18563vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) {
18564 return __builtin_altivec_vctzdm(__a, __b);
18565}
18566
18567/* vec_mod */
18568
18569static __inline__ vector signed int __ATTRS_o_ai
18570vec_mod(vector signed int __a, vector signed int __b) {
18571 return __a % __b;
18572}
18573
18574static __inline__ vector unsigned int __ATTRS_o_ai
18575vec_mod(vector unsigned int __a, vector unsigned int __b) {
18576 return __a % __b;
18577}
18578
18579static __inline__ vector signed long long __ATTRS_o_ai
18580vec_mod(vector signed long long __a, vector signed long long __b) {
18581 return __a % __b;
18582}
18583
18584static __inline__ vector unsigned long long __ATTRS_o_ai
18585vec_mod(vector unsigned long long __a, vector unsigned long long __b) {
18586 return __a % __b;
18587}
18588
18589#ifdef __SIZEOF_INT128__
18590static __inline__ vector signed __int128 __ATTRS_o_ai
18591vec_mod(vector signed __int128 __a, vector signed __int128 __b) {
18592 return __a % __b;
18593}
18594
18595static __inline__ vector unsigned __int128 __ATTRS_o_ai
18596vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18597 return __a % __b;
18598}
18599#endif
18600
18601/* vec_sldb */
18602#define vec_sldb(__a, __b, __c) \
18603 _Generic( \
18604 (__a), vector unsigned char \
18605 : (vector unsigned char)__builtin_altivec_vsldbi( \
18606 (vector unsigned char)__a, (vector unsigned char)__b, \
18607 (__c & 0x7)), \
18608 vector signed char \
18609 : (vector signed char)__builtin_altivec_vsldbi( \
18610 (vector unsigned char)__a, (vector unsigned char)__b, \
18611 (__c & 0x7)), \
18612 vector unsigned short \
18613 : (vector unsigned short)__builtin_altivec_vsldbi( \
18614 (vector unsigned char)__a, (vector unsigned char)__b, \
18615 (__c & 0x7)), \
18616 vector signed short \
18617 : (vector signed short)__builtin_altivec_vsldbi( \
18618 (vector unsigned char)__a, (vector unsigned char)__b, \
18619 (__c & 0x7)), \
18620 vector unsigned int \
18621 : (vector unsigned int)__builtin_altivec_vsldbi( \
18622 (vector unsigned char)__a, (vector unsigned char)__b, \
18623 (__c & 0x7)), \
18624 vector signed int \
18625 : (vector signed int)__builtin_altivec_vsldbi((vector unsigned char)__a, \
18626 (vector unsigned char)__b, \
18627 (__c & 0x7)), \
18628 vector unsigned long long \
18629 : (vector unsigned long long)__builtin_altivec_vsldbi( \
18630 (vector unsigned char)__a, (vector unsigned char)__b, \
18631 (__c & 0x7)), \
18632 vector signed long long \
18633 : (vector signed long long)__builtin_altivec_vsldbi( \
18634 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18635
18636/* vec_srdb */
18637#define vec_srdb(__a, __b, __c) \
18638 _Generic( \
18639 (__a), vector unsigned char \
18640 : (vector unsigned char)__builtin_altivec_vsrdbi( \
18641 (vector unsigned char)__a, (vector unsigned char)__b, \
18642 (__c & 0x7)), \
18643 vector signed char \
18644 : (vector signed char)__builtin_altivec_vsrdbi( \
18645 (vector unsigned char)__a, (vector unsigned char)__b, \
18646 (__c & 0x7)), \
18647 vector unsigned short \
18648 : (vector unsigned short)__builtin_altivec_vsrdbi( \
18649 (vector unsigned char)__a, (vector unsigned char)__b, \
18650 (__c & 0x7)), \
18651 vector signed short \
18652 : (vector signed short)__builtin_altivec_vsrdbi( \
18653 (vector unsigned char)__a, (vector unsigned char)__b, \
18654 (__c & 0x7)), \
18655 vector unsigned int \
18656 : (vector unsigned int)__builtin_altivec_vsrdbi( \
18657 (vector unsigned char)__a, (vector unsigned char)__b, \
18658 (__c & 0x7)), \
18659 vector signed int \
18660 : (vector signed int)__builtin_altivec_vsrdbi((vector unsigned char)__a, \
18661 (vector unsigned char)__b, \
18662 (__c & 0x7)), \
18663 vector unsigned long long \
18664 : (vector unsigned long long)__builtin_altivec_vsrdbi( \
18665 (vector unsigned char)__a, (vector unsigned char)__b, \
18666 (__c & 0x7)), \
18667 vector signed long long \
18668 : (vector signed long long)__builtin_altivec_vsrdbi( \
18669 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18670
18671/* vec_insertl */
18672
18673static __inline__ vector unsigned char __ATTRS_o_ai
18674vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18675#ifdef __LITTLE_ENDIAN__
18676 return __builtin_altivec_vinsbrx(__b, __c, __a);
18677#else
18678 return __builtin_altivec_vinsblx(__b, __c, __a);
18679#endif
18680}
18681
18682static __inline__ vector unsigned short __ATTRS_o_ai
18683vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18684#ifdef __LITTLE_ENDIAN__
18685 return __builtin_altivec_vinshrx(__b, __c, __a);
18686#else
18687 return __builtin_altivec_vinshlx(__b, __c, __a);
18688#endif
18689}
18690
18691static __inline__ vector unsigned int __ATTRS_o_ai
18692vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18693#ifdef __LITTLE_ENDIAN__
18694 return __builtin_altivec_vinswrx(__b, __c, __a);
18695#else
18696 return __builtin_altivec_vinswlx(__b, __c, __a);
18697#endif
18698}
18699
18700static __inline__ vector unsigned long long __ATTRS_o_ai
18701vec_insertl(unsigned long long __a, vector unsigned long long __b,
18702 unsigned int __c) {
18703#ifdef __LITTLE_ENDIAN__
18704 return __builtin_altivec_vinsdrx(__b, __c, __a);
18705#else
18706 return __builtin_altivec_vinsdlx(__b, __c, __a);
18707#endif
18708}
18709
18710static __inline__ vector unsigned char __ATTRS_o_ai
18711vec_insertl(vector unsigned char __a, vector unsigned char __b,
18712 unsigned int __c) {
18713#ifdef __LITTLE_ENDIAN__
18714 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18715#else
18716 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18717#endif
18718}
18719
18720static __inline__ vector unsigned short __ATTRS_o_ai
18721vec_insertl(vector unsigned short __a, vector unsigned short __b,
18722 unsigned int __c) {
18723#ifdef __LITTLE_ENDIAN__
18724 return __builtin_altivec_vinshvrx(__b, __c, __a);
18725#else
18726 return __builtin_altivec_vinshvlx(__b, __c, __a);
18727#endif
18728}
18729
18730static __inline__ vector unsigned int __ATTRS_o_ai
18731vec_insertl(vector unsigned int __a, vector unsigned int __b,
18732 unsigned int __c) {
18733#ifdef __LITTLE_ENDIAN__
18734 return __builtin_altivec_vinswvrx(__b, __c, __a);
18735#else
18736 return __builtin_altivec_vinswvlx(__b, __c, __a);
18737#endif
18738}
18739
18740/* vec_inserth */
18741
18742static __inline__ vector unsigned char __ATTRS_o_ai
18743vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18744#ifdef __LITTLE_ENDIAN__
18745 return __builtin_altivec_vinsblx(__b, __c, __a);
18746#else
18747 return __builtin_altivec_vinsbrx(__b, __c, __a);
18748#endif
18749}
18750
18751static __inline__ vector unsigned short __ATTRS_o_ai
18752vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18753#ifdef __LITTLE_ENDIAN__
18754 return __builtin_altivec_vinshlx(__b, __c, __a);
18755#else
18756 return __builtin_altivec_vinshrx(__b, __c, __a);
18757#endif
18758}
18759
18760static __inline__ vector unsigned int __ATTRS_o_ai
18761vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18762#ifdef __LITTLE_ENDIAN__
18763 return __builtin_altivec_vinswlx(__b, __c, __a);
18764#else
18765 return __builtin_altivec_vinswrx(__b, __c, __a);
18766#endif
18767}
18768
18769static __inline__ vector unsigned long long __ATTRS_o_ai
18770vec_inserth(unsigned long long __a, vector unsigned long long __b,
18771 unsigned int __c) {
18772#ifdef __LITTLE_ENDIAN__
18773 return __builtin_altivec_vinsdlx(__b, __c, __a);
18774#else
18775 return __builtin_altivec_vinsdrx(__b, __c, __a);
18776#endif
18777}
18778
18779static __inline__ vector unsigned char __ATTRS_o_ai
18780vec_inserth(vector unsigned char __a, vector unsigned char __b,
18781 unsigned int __c) {
18782#ifdef __LITTLE_ENDIAN__
18783 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18784#else
18785 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18786#endif
18787}
18788
18789static __inline__ vector unsigned short __ATTRS_o_ai
18790vec_inserth(vector unsigned short __a, vector unsigned short __b,
18791 unsigned int __c) {
18792#ifdef __LITTLE_ENDIAN__
18793 return __builtin_altivec_vinshvlx(__b, __c, __a);
18794#else
18795 return __builtin_altivec_vinshvrx(__b, __c, __a);
18796#endif
18797}
18798
18799static __inline__ vector unsigned int __ATTRS_o_ai
18800vec_inserth(vector unsigned int __a, vector unsigned int __b,
18801 unsigned int __c) {
18802#ifdef __LITTLE_ENDIAN__
18803 return __builtin_altivec_vinswvlx(__b, __c, __a);
18804#else
18805 return __builtin_altivec_vinswvrx(__b, __c, __a);
18806#endif
18807}
18808
18809/* vec_extractl */
18810
18811static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18812 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18813#ifdef __LITTLE_ENDIAN__
18814 return __builtin_altivec_vextdubvrx(__a, __b, __c);
18815#else
18816 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c);
18817 return vec_sld(__ret, __ret, 8);
18818#endif
18819}
18820
18821static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18822 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18823#ifdef __LITTLE_ENDIAN__
18824 return __builtin_altivec_vextduhvrx(__a, __b, __c);
18825#else
18826 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c);
18827 return vec_sld(__ret, __ret, 8);
18828#endif
18829}
18830
18831static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18832 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18833#ifdef __LITTLE_ENDIAN__
18834 return __builtin_altivec_vextduwvrx(__a, __b, __c);
18835#else
18836 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c);
18837 return vec_sld(__ret, __ret, 8);
18838#endif
18839}
18840
18841static __inline__ vector unsigned long long __ATTRS_o_ai
18842vec_extractl(vector unsigned long long __a, vector unsigned long long __b,
18843 unsigned int __c) {
18844#ifdef __LITTLE_ENDIAN__
18845 return __builtin_altivec_vextddvrx(__a, __b, __c);
18846#else
18847 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c);
18848 return vec_sld(__ret, __ret, 8);
18849#endif
18850}
18851
18852/* vec_extracth */
18853
18854static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18855 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18856#ifdef __LITTLE_ENDIAN__
18857 return __builtin_altivec_vextdubvlx(__a, __b, __c);
18858#else
18859 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c);
18860 return vec_sld(__ret, __ret, 8);
18861#endif
18862}
18863
18864static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18865 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18866#ifdef __LITTLE_ENDIAN__
18867 return __builtin_altivec_vextduhvlx(__a, __b, __c);
18868#else
18869 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c);
18870 return vec_sld(__ret, __ret, 8);
18871#endif
18872}
18873
18874static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18875 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18876#ifdef __LITTLE_ENDIAN__
18877 return __builtin_altivec_vextduwvlx(__a, __b, __c);
18878#else
18879 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c);
18880 return vec_sld(__ret, __ret, 8);
18881#endif
18882}
18883
18884static __inline__ vector unsigned long long __ATTRS_o_ai
18885vec_extracth(vector unsigned long long __a, vector unsigned long long __b,
18886 unsigned int __c) {
18887#ifdef __LITTLE_ENDIAN__
18888 return __builtin_altivec_vextddvlx(__a, __b, __c);
18889#else
18890 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c);
18891 return vec_sld(__ret, __ret, 8);
18892#endif
18893}
18894
18895#ifdef __VSX__
18896
18897/* vec_permx */
18898#define vec_permx(__a, __b, __c, __d) \
18899 _Generic( \
18900 (__a), vector unsigned char \
18901 : (vector unsigned char)__builtin_vsx_xxpermx( \
18902 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18903 vector signed char \
18904 : (vector signed char)__builtin_vsx_xxpermx( \
18905 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18906 vector unsigned short \
18907 : (vector unsigned short)__builtin_vsx_xxpermx( \
18908 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18909 vector signed short \
18910 : (vector signed short)__builtin_vsx_xxpermx( \
18911 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18912 vector unsigned int \
18913 : (vector unsigned int)__builtin_vsx_xxpermx( \
18914 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18915 vector signed int \
18916 : (vector signed int)__builtin_vsx_xxpermx( \
18917 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18918 vector unsigned long long \
18919 : (vector unsigned long long)__builtin_vsx_xxpermx( \
18920 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18921 vector signed long long \
18922 : (vector signed long long)__builtin_vsx_xxpermx( \
18923 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18924 vector float \
18925 : (vector float)__builtin_vsx_xxpermx( \
18926 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18927 vector double \
18928 : (vector double)__builtin_vsx_xxpermx( \
18929 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d))
18930
18931/* vec_blendv */
18932
18933static __inline__ vector signed char __ATTRS_o_ai
18934vec_blendv(vector signed char __a, vector signed char __b,
18935 vector unsigned char __c) {
18936 return (vector signed char)__builtin_vsx_xxblendvb(
18937 (vector unsigned char)__a, (vector unsigned char)__b, __c);
18938}
18939
18940static __inline__ vector unsigned char __ATTRS_o_ai
18941vec_blendv(vector unsigned char __a, vector unsigned char __b,
18942 vector unsigned char __c) {
18943 return __builtin_vsx_xxblendvb(__a, __b, __c);
18944}
18945
18946static __inline__ vector signed short __ATTRS_o_ai
18947vec_blendv(vector signed short __a, vector signed short __b,
18948 vector unsigned short __c) {
18949 return (vector signed short)__builtin_vsx_xxblendvh(
18950 (vector unsigned short)__a, (vector unsigned short)__b, __c);
18951}
18952
18953static __inline__ vector unsigned short __ATTRS_o_ai
18954vec_blendv(vector unsigned short __a, vector unsigned short __b,
18955 vector unsigned short __c) {
18956 return __builtin_vsx_xxblendvh(__a, __b, __c);
18957}
18958
18959static __inline__ vector signed int __ATTRS_o_ai
18960vec_blendv(vector signed int __a, vector signed int __b,
18961 vector unsigned int __c) {
18962 return (vector signed int)__builtin_vsx_xxblendvw(
18963 (vector unsigned int)__a, (vector unsigned int)__b, __c);
18964}
18965
18966static __inline__ vector unsigned int __ATTRS_o_ai
18967vec_blendv(vector unsigned int __a, vector unsigned int __b,
18968 vector unsigned int __c) {
18969 return __builtin_vsx_xxblendvw(__a, __b, __c);
18970}
18971
18972static __inline__ vector signed long long __ATTRS_o_ai
18973vec_blendv(vector signed long long __a, vector signed long long __b,
18974 vector unsigned long long __c) {
18975 return (vector signed long long)__builtin_vsx_xxblendvd(
18976 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18977}
18978
18979static __inline__ vector unsigned long long __ATTRS_o_ai
18980vec_blendv(vector unsigned long long __a, vector unsigned long long __b,
18981 vector unsigned long long __c) {
18982 return (vector unsigned long long)__builtin_vsx_xxblendvd(__a, __b, __c);
18983}
18984
18985static __inline__ vector float __ATTRS_o_ai
18986vec_blendv(vector float __a, vector float __b, vector unsigned int __c) {
18987 return (vector float)__builtin_vsx_xxblendvw((vector unsigned int)__a,
18988 (vector unsigned int)__b, __c);
18989}
18990
18991static __inline__ vector double __ATTRS_o_ai
18992vec_blendv(vector double __a, vector double __b,
18993 vector unsigned long long __c) {
18994 return (vector double)__builtin_vsx_xxblendvd(
18995 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18996}
18997
18998#define vec_replace_unaligned(__a, __b, __c) \
18999 _Generic((__a), vector signed int \
19000 : __builtin_altivec_vinsw((vector unsigned char)__a, \
19001 (unsigned int)__b, __c), \
19002 vector unsigned int \
19003 : __builtin_altivec_vinsw((vector unsigned char)__a, \
19004 (unsigned int)__b, __c), \
19005 vector unsigned long long \
19006 : __builtin_altivec_vinsd((vector unsigned char)__a, \
19007 (unsigned long long)__b, __c), \
19008 vector signed long long \
19009 : __builtin_altivec_vinsd((vector unsigned char)__a, \
19010 (unsigned long long)__b, __c), \
19011 vector float \
19012 : __builtin_altivec_vinsw((vector unsigned char)__a, \
19013 (unsigned int)__b, __c), \
19014 vector double \
19015 : __builtin_altivec_vinsd((vector unsigned char)__a, \
19016 (unsigned long long)__b, __c))
19017
19018#define vec_replace_elt(__a, __b, __c) \
19019 _Generic((__a), vector signed int \
19020 : (vector signed int)__builtin_altivec_vinsw_elt( \
19021 (vector unsigned char)__a, (unsigned int)__b, __c), \
19022 vector unsigned int \
19023 : (vector unsigned int)__builtin_altivec_vinsw_elt( \
19024 (vector unsigned char)__a, (unsigned int)__b, __c), \
19025 vector unsigned long long \
19026 : (vector unsigned long long)__builtin_altivec_vinsd_elt( \
19027 (vector unsigned char)__a, (unsigned long long)__b, __c), \
19028 vector signed long long \
19029 : (vector signed long long)__builtin_altivec_vinsd_elt( \
19030 (vector unsigned char)__a, (unsigned long long)__b, __c), \
19031 vector float \
19032 : (vector float)__builtin_altivec_vinsw_elt( \
19033 (vector unsigned char)__a, (unsigned int)__b, __c), \
19034 vector double \
19035 : (vector double)__builtin_altivec_vinsd_elt( \
19036 (vector unsigned char)__a, (unsigned long long)__b, __c))
19037
19038/* vec_splati */
19039
19040#define vec_splati(__a) \
19041 _Generic((__a), signed int \
19042 : ((vector signed int)__a), unsigned int \
19043 : ((vector unsigned int)__a), float \
19044 : ((vector float)__a))
19045
19046/* vec_spatid */
19047
19048static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) {
19049 return ((vector double)((double)__a));
19050}
19051
19052/* vec_splati_ins */
19053
19054static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins(
19055 vector signed int __a, const unsigned int __b, const signed int __c) {
19056 const unsigned int __d = __b & 0x01;
19057#ifdef __LITTLE_ENDIAN__
19058 __a[1 - __d] = __c;
19059 __a[3 - __d] = __c;
19060#else
19061 __a[__d] = __c;
19062 __a[2 + __d] = __c;
19063#endif
19064 return __a;
19065}
19066
19067static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins(
19068 vector unsigned int __a, const unsigned int __b, const unsigned int __c) {
19069 const unsigned int __d = __b & 0x01;
19070#ifdef __LITTLE_ENDIAN__
19071 __a[1 - __d] = __c;
19072 __a[3 - __d] = __c;
19073#else
19074 __a[__d] = __c;
19075 __a[2 + __d] = __c;
19076#endif
19077 return __a;
19078}
19079
19080static __inline__ vector float __ATTRS_o_ai
19081vec_splati_ins(vector float __a, const unsigned int __b, const float __c) {
19082 const unsigned int __d = __b & 0x01;
19083#ifdef __LITTLE_ENDIAN__
19084 __a[1 - __d] = __c;
19085 __a[3 - __d] = __c;
19086#else
19087 __a[__d] = __c;
19088 __a[2 + __d] = __c;
19089#endif
19090 return __a;
19091}
19092
19093/* vec_test_lsbb_all_ones */
19094
19095static __inline__ int __ATTRS_o_ai
19096vec_test_lsbb_all_ones(vector unsigned char __a) {
19097 return __builtin_vsx_xvtlsbb(__a, 1);
19098}
19099
19100/* vec_test_lsbb_all_zeros */
19101
19102static __inline__ int __ATTRS_o_ai
19103vec_test_lsbb_all_zeros(vector unsigned char __a) {
19104 return __builtin_vsx_xvtlsbb(__a, 0);
19105}
19106#endif /* __VSX__ */
19107
19108/* vec_stril */
19109
19110static __inline__ vector unsigned char __ATTRS_o_ai
19111vec_stril(vector unsigned char __a) {
19112#ifdef __LITTLE_ENDIAN__
19113 return (vector unsigned char)__builtin_altivec_vstribr(
19114 (vector unsigned char)__a);
19115#else
19116 return (vector unsigned char)__builtin_altivec_vstribl(
19117 (vector unsigned char)__a);
19118#endif
19119}
19120
19121static __inline__ vector signed char __ATTRS_o_ai
19122vec_stril(vector signed char __a) {
19123#ifdef __LITTLE_ENDIAN__
19124 return (vector signed char)__builtin_altivec_vstribr(
19125 (vector unsigned char)__a);
19126#else
19127 return (vector signed char)__builtin_altivec_vstribl(
19128 (vector unsigned char)__a);
19129#endif
19130}
19131
19132static __inline__ vector unsigned short __ATTRS_o_ai
19133vec_stril(vector unsigned short __a) {
19134#ifdef __LITTLE_ENDIAN__
19135 return (vector unsigned short)__builtin_altivec_vstrihr(
19136 (vector signed short)__a);
19137#else
19138 return (vector unsigned short)__builtin_altivec_vstrihl(
19139 (vector signed short)__a);
19140#endif
19141}
19142
19143static __inline__ vector signed short __ATTRS_o_ai
19144vec_stril(vector signed short __a) {
19145#ifdef __LITTLE_ENDIAN__
19146 return __builtin_altivec_vstrihr(__a);
19147#else
19148 return __builtin_altivec_vstrihl(__a);
19149#endif
19150}
19151
19152/* vec_stril_p */
19153
19154static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) {
19155#ifdef __LITTLE_ENDIAN__
19156 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19157#else
19158 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19159#endif
19160}
19161
19162static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) {
19163#ifdef __LITTLE_ENDIAN__
19164 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19165#else
19166 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19167#endif
19168}
19169
19170static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) {
19171#ifdef __LITTLE_ENDIAN__
19172 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19173#else
19174 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19175#endif
19176}
19177
19178static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) {
19179#ifdef __LITTLE_ENDIAN__
19180 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19181#else
19182 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19183#endif
19184}
19185
19186/* vec_strir */
19187
19188static __inline__ vector unsigned char __ATTRS_o_ai
19189vec_strir(vector unsigned char __a) {
19190#ifdef __LITTLE_ENDIAN__
19191 return (vector unsigned char)__builtin_altivec_vstribl(
19192 (vector unsigned char)__a);
19193#else
19194 return (vector unsigned char)__builtin_altivec_vstribr(
19195 (vector unsigned char)__a);
19196#endif
19197}
19198
19199static __inline__ vector signed char __ATTRS_o_ai
19200vec_strir(vector signed char __a) {
19201#ifdef __LITTLE_ENDIAN__
19202 return (vector signed char)__builtin_altivec_vstribl(
19203 (vector unsigned char)__a);
19204#else
19205 return (vector signed char)__builtin_altivec_vstribr(
19206 (vector unsigned char)__a);
19207#endif
19208}
19209
19210static __inline__ vector unsigned short __ATTRS_o_ai
19211vec_strir(vector unsigned short __a) {
19212#ifdef __LITTLE_ENDIAN__
19213 return (vector unsigned short)__builtin_altivec_vstrihl(
19214 (vector signed short)__a);
19215#else
19216 return (vector unsigned short)__builtin_altivec_vstrihr(
19217 (vector signed short)__a);
19218#endif
19219}
19220
19221static __inline__ vector signed short __ATTRS_o_ai
19222vec_strir(vector signed short __a) {
19223#ifdef __LITTLE_ENDIAN__
19224 return __builtin_altivec_vstrihl(__a);
19225#else
19226 return __builtin_altivec_vstrihr(__a);
19227#endif
19228}
19229
19230/* vec_strir_p */
19231
19232static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) {
19233#ifdef __LITTLE_ENDIAN__
19234 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19235#else
19236 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19237#endif
19238}
19239
19240static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) {
19241#ifdef __LITTLE_ENDIAN__
19242 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19243#else
19244 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19245#endif
19246}
19247
19248static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) {
19249#ifdef __LITTLE_ENDIAN__
19250 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19251#else
19252 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19253#endif
19254}
19255
19256static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) {
19257#ifdef __LITTLE_ENDIAN__
19258 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19259#else
19260 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19261#endif
19262}
19263
19264/* vs[l | r | ra] */
19265
19266#ifdef __SIZEOF_INT128__
19267static __inline__ vector unsigned __int128 __ATTRS_o_ai
19268vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19269 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19270 __CHAR_BIT__));
19271}
19272
19273static __inline__ vector signed __int128 __ATTRS_o_ai
19274vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) {
19275 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19276 __CHAR_BIT__));
19277}
19278
19279static __inline__ vector unsigned __int128 __ATTRS_o_ai
19280vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19281 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19282 __CHAR_BIT__));
19283}
19284
19285static __inline__ vector signed __int128 __ATTRS_o_ai
19286vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) {
19287 return (
19288 vector signed __int128)(((vector unsigned __int128)__a) >>
19289 (__b %
19290 (vector unsigned __int128)(sizeof(
19291 unsigned __int128) *
19292 __CHAR_BIT__)));
19293}
19294
19295static __inline__ vector unsigned __int128 __ATTRS_o_ai
19296vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19297 return (
19298 vector unsigned __int128)(((vector signed __int128)__a) >>
19299 (__b %
19300 (vector unsigned __int128)(sizeof(
19301 unsigned __int128) *
19302 __CHAR_BIT__)));
19303}
19304
19305static __inline__ vector signed __int128 __ATTRS_o_ai
19306vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) {
19307 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19308 __CHAR_BIT__));
19309}
19310
19311#endif /* __SIZEOF_INT128__ */
19312#endif /* __POWER10_VECTOR__ */
19313
19314#ifdef __POWER8_VECTOR__
19315#define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps))
19316#define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps))
19317
19318static __inline__ long __bcdadd_ofl(vector unsigned char __a,
19319 vector unsigned char __b) {
19320 return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b);
19321}
19322
19323static __inline__ long __bcdsub_ofl(vector unsigned char __a,
19324 vector unsigned char __b) {
19325 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b);
19326}
19327
19328static __inline__ long __bcd_invalid(vector unsigned char __a) {
19329 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a);
19330}
19331
19332static __inline__ long __bcdcmpeq(vector unsigned char __a,
19333 vector unsigned char __b) {
19334 return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b);
19335}
19336
19337static __inline__ long __bcdcmplt(vector unsigned char __a,
19338 vector unsigned char __b) {
19339 return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b);
19340}
19341
19342static __inline__ long __bcdcmpgt(vector unsigned char __a,
19343 vector unsigned char __b) {
19344 return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b);
19345}
19346
19347static __inline__ long __bcdcmple(vector unsigned char __a,
19348 vector unsigned char __b) {
19349 return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b);
19350}
19351
19352static __inline__ long __bcdcmpge(vector unsigned char __a,
19353 vector unsigned char __b) {
19354 return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b);
19355}
19356
19357#endif // __POWER8_VECTOR__
19358
19359#undef __ATTRS_o_ai
19360
19361#endif /* __ALTIVEC_H */
__device__ double
__device__ int
__device__ float
#define NULL
Definition: __stddef_null.h:26
__PTRDIFF_TYPE__ ptrdiff_t
static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b)
Definition: altivec.h:12308
static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b)
Definition: altivec.h:4296
static __inline__ vector signed int __ATTRS_o_ai vec_sube(vector signed int __a, vector signed int __b, vector signed int __c)
Definition: altivec.h:12471
static __inline__ vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:10393
static __inline__ vector unsigned short __ATTRS_o_ai vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Definition: altivec.h:769
static __inline__ vector bool char __ATTRS_o_ai vec_cmpeq(vector signed char __a, vector signed char __b)
Definition: altivec.h:1708
#define __CR6_GT_REV
Definition: altivec.h:23
static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, vector signed char *__c)
Definition: altivec.h:11315
static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, vector short __b)
Definition: altivec.h:5011
static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, signed int __b)
Definition: altivec.h:13541
static __inline__ vector signed char __ATTRS_o_ai vec_sra(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:10527
static __inline__ vector signed char __ATTRS_o_ai vec_lvx(long __a, const vector signed char *__b)
Definition: altivec.h:4150
static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b)
Definition: altivec.h:5326
static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, vector short __b)
Definition: altivec.h:12274
static __inline__ vector signed char __ATTRS_o_ai vec_sro(vector signed char __a, vector signed char __b)
Definition: altivec.h:10979
static __inline__ vector signed char __ATTRS_o_ai vec_lvrx(int __a, const signed char *__b)
Definition: altivec.h:13971
static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, short *__c)
Definition: altivec.h:11545
#define __CR6_GT
Definition: altivec.h:22
static __inline__ vector signed char __ATTRS_o_ai vec_abss(vector signed char __a)
Definition: altivec.h:160
static __inline__ vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a, vector signed char __b)
Definition: altivec.h:12241
static __inline__ vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Definition: altivec.h:5063
static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a)
Definition: altivec.h:1659
static __inline__ vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:8978
static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, unsigned char __b)
Definition: altivec.h:10238
static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Definition: altivec.h:6021
static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a)
Definition: altivec.h:12731
static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, vector float __b)
Definition: altivec.h:17261
static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, vector signed char __b)
Definition: altivec.h:17035
static __inline__ vector signed char __ATTRS_o_ai vec_lde(long __a, const signed char *__b)
Definition: altivec.h:4239
static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Definition: altivec.h:14298
#define vec_xst_be
Definition: altivec.h:18221
static __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, const signed char *__ptr)
Definition: altivec.h:17724
static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, vector unsigned int __b)
Definition: altivec.h:10606
static __inline__ vector bool char __ATTRS_o_ai vec_cmpne(vector bool char __a, vector bool char __b)
Definition: altivec.h:2032
static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, vector float __b)
Definition: altivec.h:17243
static __inline__ vector signed char __ATTRS_o_ai vec_sldw(vector signed char __a, vector signed char __b, unsigned const int __c)
Definition: altivec.h:9301
vector signed char unaligned_vec_schar __attribute__((aligned(1)))
Definition: altivec.h:17716
static __inline__ vector short __ATTRS_o_ai vec_vslh(vector short __a, vector unsigned short __b)
Definition: altivec.h:8992
static __inline__ vector float vector float vector float __c
Definition: altivec.h:4800
static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, vector short __b)
Definition: altivec.h:751
static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Definition: altivec.h:6059
static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, vector signed char __b)
Definition: altivec.h:6263
static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, vector signed char __b)
Definition: altivec.h:16640
static __inline__ vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a, vector signed char __b)
Definition: altivec.h:476
static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a)
Definition: altivec.h:10344
static __inline__ vector float vector float __b
Definition: altivec.h:578
static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const signed char *__b)
Definition: altivec.h:4639
static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, vector float __b)
Definition: altivec.h:18293
static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, vector short __b)
Definition: altivec.h:12032
static __inline__ vector signed char __ATTRS_o_ai vec_ld(long __a, const vector signed char *__b)
Definition: altivec.h:4061
static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a)
Definition: altivec.h:8469
static __inline__ vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:8434
static __inline__ vector signed int __ATTRS_o_ai vec_subc(vector signed int __a, vector signed int __b)
Definition: altivec.h:12108
static __inline__ vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:735
static __inline__ vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a, vector signed short __b)
Definition: altivec.h:7547
static __inline__ vector signed int __ATTRS_o_ai vec_addc(vector signed int __a, vector signed int __b)
Definition: altivec.h:585
static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, vector signed char __b)
Definition: altivec.h:15377
static __ATTRS_o_ai vector bool char vec_reve(vector bool char __a)
Definition: altivec.h:17528
static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, vector short __b)
Definition: altivec.h:5915
static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a)
Definition: altivec.h:14737
static __inline__ vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a)
Definition: altivec.h:12712
#define __CR6_LT
Definition: altivec.h:20
static __inline__ vector bool char __ATTRS_o_ai vec_revb(vector bool char __a)
Definition: altivec.h:17598
static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a)
Definition: altivec.h:17020
static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, vector signed char __b)
Definition: altivec.h:14802
static __inline__ vector signed char __ATTRS_o_ai vec_andc(vector signed char __a, vector signed char __b)
Definition: altivec.h:1235
static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const signed char *__b)
Definition: altivec.h:4518
static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, vector signed char *__c)
Definition: altivec.h:11184
static __inline__ vector signed int __ATTRS_o_ai vec_sld(vector signed int, vector signed int, unsigned const int __c)
Definition: altivec.h:9149
static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, vector unsigned int __b)
Definition: altivec.h:10514
static __inline__ vector short __ATTRS_o_ai vec_unpackl(vector signed char __a)
Definition: altivec.h:12781
static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, vector signed char __b)
Definition: altivec.h:15755
static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, vector int __b)
Definition: altivec.h:12487
static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a)
Definition: altivec.h:6154
static __inline__ vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a, vector signed char __b)
Definition: altivec.h:1421
static __inline__ vector signed char __ATTRS_o_ai vec_mul(vector signed char __a, vector signed char __b)
Definition: altivec.h:6205
static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Definition: altivec.h:11735
static __inline__ vector signed int __ATTRS_o_ai vec_signed(vector float __a)
Definition: altivec.h:3495
static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, vector signed char *__c)
Definition: altivec.h:11604
static __inline__ vector signed char __ATTRS_o_ai vec_and(vector signed char __a, vector signed char __b)
Definition: altivec.h:882
static __inline__ vector signed char __ATTRS_o_ai vec_avg(vector signed char __a, vector signed char __b)
Definition: altivec.h:1586
static __ATTRS_o_ai void vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr)
Definition: altivec.h:17995
static __inline__ vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a)
Definition: altivec.h:10320
static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a)
Definition: altivec.h:15739
static __inline__ vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a, vector signed char __b)
Definition: altivec.h:5361
#define __CR6_SO
Definition: altivec.h:24
static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a)
Definition: altivec.h:10360
static __inline__ vector signed char __ATTRS_o_ai vec_subs(vector signed char __a, vector signed char __b)
Definition: altivec.h:12149
static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b)
Definition: altivec.h:5589
static __inline__ vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a, vector signed char __b)
Definition: altivec.h:13375
static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, vector short __b)
Definition: altivec.h:5553
static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, vector float __b)
Definition: altivec.h:15981
static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a)
Definition: altivec.h:4026
static __inline__ vector signed char __ATTRS_o_ai vec_lvlx(int __a, const signed char *__b)
Definition: altivec.h:13759
static __inline__ vector short __ATTRS_o_ai vec_vrlh(vector short __a, vector unsigned short __b)
Definition: altivec.h:8446
static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, vector unsigned int __b)
Definition: altivec.h:8457
#define __CR6_LT_REV
Definition: altivec.h:21
static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, vector signed char __b)
Definition: altivec.h:15190
static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a)
Definition: altivec.h:10353
static __inline__ vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a, vector signed char __b)
Definition: altivec.h:5526
static __inline__ vector signed char __ATTRS_o_ai vec_adds(vector signed char __a, vector signed char __b)
Definition: altivec.h:626
#define __ATTRS_o_ai
Definition: altivec.h:46
static __inline__ vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Definition: altivec.h:12292
static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b)
Definition: altivec.h:14648
static __inline__ vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Definition: altivec.h:5029
static __inline__ vector signed char __ATTRS_o_ai vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition: altivec.h:7962
static __inline__ vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:5899
static __inline__ vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:10583
static __inline__ vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a, vector signed char __b)
Definition: altivec.h:11999
static __inline__ vector signed short __ATTRS_o_ai vec_mladd(vector signed short, vector signed short, vector signed short)
static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, signed char *__c)
Definition: altivec.h:14182
static __inline__ vector signed char __ATTRS_o_ai vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition: altivec.h:8588
static __inline__ vector signed char __ATTRS_o_ai vec_lvxl(long __a, const vector signed char *__b)
Definition: altivec.h:4402
static __inline__ vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a, vector signed char __b)
Definition: altivec.h:4978
static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a)
Definition: altivec.h:17315
static __inline__ vector float __ATTRS_o_ai vec_float(vector signed int __a)
Definition: altivec.h:3579
static __inline__ vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a)
Definition: altivec.h:10384
static __inline__ vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a, vector signed char __b)
Definition: altivec.h:5091
static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a)
Definition: altivec.h:12870
#define __CR6_EQ_REV
Definition: altivec.h:19
static __inline__ vector signed char __ATTRS_o_ai vec_lvebx(long __a, const signed char *__b)
Definition: altivec.h:4273
static __inline__ vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Definition: altivec.h:9374
static __inline__ vector signed char __ATTRS_o_ai vec_rl(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:8287
static __inline__ vector bool char __ATTRS_o_ai vec_cmplt(vector signed char __a, vector signed char __b)
Definition: altivec.h:2435
static __inline__ vector unsigned int __ATTRS_o_ai vec_unsigned(vector float __a)
Definition: altivec.h:3537
static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, vector unsigned int __b)
Definition: altivec.h:9005
static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, signed char *__c)
Definition: altivec.h:11447
static __inline__ vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:4995
static __inline__ vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a, vector int __b)
Definition: altivec.h:7922
static __inline__ vector short __ATTRS_o_ai vec_vsrh(vector short __a, vector unsigned short __b)
Definition: altivec.h:10501
static __inline__ vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a, vector signed char __b)
Definition: altivec.h:5263
static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a)
Definition: altivec.h:1674
static __inline__ vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a, vector signed char __b)
Definition: altivec.h:6792
static __inline__ vector signed char __ATTRS_o_ai vec_max(vector signed char __a, vector signed char __b)
Definition: altivec.h:4838
static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, vector signed char __b)
Definition: altivec.h:15558
static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, vector signed char __b)
Definition: altivec.h:16260
static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, int *__c)
Definition: altivec.h:11577
static __inline__ vector signed int __ATTRS_o_ai vec_adde(vector signed int __a, vector signed int __b, vector signed int __c)
Definition: altivec.h:383
static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b)
Definition: altivec.h:10278
static __inline__ vector signed char __ATTRS_o_ai vec_slo(vector signed char __a, vector signed char __b)
Definition: altivec.h:9884
static __inline__ int __ATTRS_o_ai vec_all_numeric(vector float __a)
Definition: altivec.h:16036
static __inline__ vector signed char __ATTRS_o_ai vec_nor(vector signed char __a, vector signed char __b)
Definition: altivec.h:6729
#define vec_xl_be
Definition: altivec.h:17880
static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b)
Definition: altivec.h:7595
static __inline__ vector bool char __ATTRS_o_ai vec_cmpge(vector signed char __a, vector signed char __b)
Definition: altivec.h:2243
static __inline__ vector signed char __ATTRS_o_ai vec_lvlxl(int __a, const signed char *__b)
Definition: altivec.h:13865
static __inline__ vector signed char __ATTRS_o_ai vec_pack(vector signed short __a, vector signed short __b)
Definition: altivec.h:7389
static __inline__ vector signed char __ATTRS_o_ai vec_ldl(long __a, const vector signed char *__b)
Definition: altivec.h:4313
static __inline__ vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a, vector short __b)
Definition: altivec.h:7844
static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, vector signed char __b)
Definition: altivec.h:6409
static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, vector float __b)
Definition: altivec.h:15963
static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b)
Definition: altivec.h:12066
static __inline__ vector signed char __ATTRS_o_ai vec_srl(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:10619
static vector float __ATTRS_o_ai vec_rsqrt(vector float __a)
Definition: altivec.h:8555
static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a)
Definition: altivec.h:8263
static __inline__ vector signed char __ATTRS_o_ai vec_min(vector signed char __a, vector signed char __b)
Definition: altivec.h:5742
static __inline__ vector signed char __ATTRS_o_ai vec_vand(vector signed char __a, vector signed char __b)
Definition: altivec.h:1068
static __inline__ vector signed char __ATTRS_o_ai vec_splat(vector signed char __a, unsigned const int __b)
Definition: altivec.h:10090
static __inline__ vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a, vector short __b)
Definition: altivec.h:7902
static __inline__ vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Definition: altivec.h:5967
static __inline__ vector signed char __ATTRS_o_ai vec_lvrxl(int __a, const signed char *__b)
Definition: altivec.h:14077
static vector float __ATTRS_o_ai vec_neg(vector float __a)
Definition: altivec.h:18235
static vector float __ATTRS_o_ai vec_nabs(vector float __a)
Definition: altivec.h:18264
static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, vector signed char __b)
Definition: altivec.h:6865
static __inline__ vector short __ATTRS_o_ai vec_unpackh(vector signed char __a)
Definition: altivec.h:12642
static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, vector short __b)
Definition: altivec.h:5290
static __inline__ vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:10806
static __inline__ vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:8882
static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, vector short __b)
Definition: altivec.h:509
static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a)
Definition: altivec.h:10337
static __inline__ vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a, vector signed char __b)
Definition: altivec.h:5882
static __inline__ vector signed char __ATTRS_o_ai vec_add(vector signed char __a, vector signed char __b)
Definition: altivec.h:200
static __inline__ vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition: altivec.h:8184
static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, const short *__b)
Definition: altivec.h:4284
static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, signed char *__c)
Definition: altivec.h:11523
static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, vector int __b)
Definition: altivec.h:785
static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, vector float __b)
Definition: altivec.h:17297
static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Definition: altivec.h:14531
static __inline__ vector signed char __ATTRS_o_ai vec_abs(vector signed char __a)
Definition: altivec.h:117
static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, signed char *__c)
Definition: altivec.h:14415
static __inline__ vector signed short __ATTRS_o_ai vec_madd(vector signed short __a, vector signed short __b, vector signed short __c)
Definition: altivec.h:4756
static __inline__ vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition: altivec.h:8762
static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, vector signed char __b)
Definition: altivec.h:16830
static __inline__ vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:13207
static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b)
Definition: altivec.h:5949
static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, vector signed char __b)
Definition: altivec.h:15010
static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a)
Definition: altivec.h:4041
static __inline__ vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Definition: altivec.h:803
static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b)
Definition: altivec.h:5045
static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a)
Definition: altivec.h:8541
static __inline__ int __ATTRS_o_ai vec_all_nle(vector float __a, vector float __b)
Definition: altivec.h:16000
static __inline__ vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Definition: altivec.h:12258
static __inline__ vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Definition: altivec.h:5933
static __inline__ vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a, unsigned char __b)
Definition: altivec.h:10220
static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a)
Definition: altivec.h:12597
static __inline__ vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a)
Definition: altivec.h:12851
static __inline__ vector bool char __ATTRS_o_ai vec_cmpgt(vector signed char __a, vector signed char __b)
Definition: altivec.h:2131
static __inline__ vector signed char __ATTRS_o_ai vec_insert(signed char __a, vector signed char __b, int __c)
Definition: altivec.h:13668
static __inline__ vector signed char __ATTRS_o_ai vec_sll(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:9524
static __inline__ vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:10487
static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, vector signed char __b)
Definition: altivec.h:16450
static __inline__ vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a, vector signed char __b)
Definition: altivec.h:11095
static __inline__ vector bool char __ATTRS_o_ai vec_cmple(vector signed char __a, vector signed char __b)
Definition: altivec.h:2369
static __inline__ vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a, vector unsigned char __b)
Definition: altivec.h:9711
static __inline__ vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a)
Definition: altivec.h:10376
static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, vector int __b)
Definition: altivec.h:543
#define __CR6_EQ
Definition: altivec.h:18
static __inline__ int __ATTRS_o_ai vec_all_nlt(vector float __a, vector float __b)
Definition: altivec.h:16018
static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, vector short __b)
Definition: altivec.h:7715
static __inline__ vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a)
Definition: altivec.h:10328
static __inline__ vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a, vector signed char __b)
Definition: altivec.h:10000
static __inline__ vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a, vector signed char __b)
Definition: altivec.h:718
static __inline__ vector signed char __ATTRS_o_ai vec_div(vector signed char __a, vector signed char __b)
Definition: altivec.h:3784
static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b, vector int __c)
Definition: altivec.h:6125
static __inline__ vector signed char __ATTRS_o_ai vec_vor(vector signed char __a, vector signed char __b)
Definition: altivec.h:7221
static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, vector signed char __b)
Definition: altivec.h:16052
static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a)
Definition: altivec.h:12612
static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, vector float __b)
Definition: altivec.h:17279
static __inline__ vector signed char __ATTRS_o_ai vec_sub(vector signed char __a, vector signed char __b)
Definition: altivec.h:11869
static __inline__ vector short __ATTRS_o_ai vec_vsrah(vector short __a, vector unsigned short __b)
Definition: altivec.h:10595
static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, vector float __b, vector float __c)
Definition: altivec.h:6699
static __inline__ vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a)
Definition: altivec.h:10368
static __inline__ vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Definition: altivec.h:12326
static __inline__ void int __a
Definition: emmintrin.h:4079
constexpr bool aligned(uintptr_t Value)
Definition: PrimType.h:135