[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / lib / Headers / altivec.h
blob0b1e76e81cc778f1acf279d7a4141e11511388ec
1 /*===---- altivec.h - Standard header for type generic math ---------------===*\
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
7 \*===----------------------------------------------------------------------===*/
9 #ifndef __ALTIVEC_H
10 #define __ALTIVEC_H
12 #ifndef __ALTIVEC__
13 #error "AltiVec support not enabled"
14 #endif
16 /* Constants for mapping CR6 bits to predicate result. */
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
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)
46 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
48 #include <stddef.h>
50 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
51 vector signed char __a, vector signed char __b, vector unsigned char __c);
53 static __inline__ vector unsigned char __ATTRS_o_ai
54 vec_perm(vector unsigned char __a, vector unsigned char __b,
55 vector unsigned char __c);
57 static __inline__ vector bool char __ATTRS_o_ai
58 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
60 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
61 vector signed short __b,
62 vector unsigned char __c);
64 static __inline__ vector unsigned short __ATTRS_o_ai
65 vec_perm(vector unsigned short __a, vector unsigned short __b,
66 vector unsigned char __c);
68 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
69 vector bool short __a, vector bool short __b, vector unsigned char __c);
71 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
72 vector pixel __b,
73 vector unsigned char __c);
75 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
76 vector signed int __b,
77 vector unsigned char __c);
79 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
80 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
82 static __inline__ vector bool int __ATTRS_o_ai
83 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
85 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
86 vector float __b,
87 vector unsigned char __c);
89 #ifdef __VSX__
90 static __inline__ vector long long __ATTRS_o_ai
91 vec_perm(vector signed long long __a, vector signed long long __b,
92 vector unsigned char __c);
94 static __inline__ vector unsigned long long __ATTRS_o_ai
95 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
96 vector unsigned char __c);
98 static __inline__ vector bool long long __ATTRS_o_ai
99 vec_perm(vector bool long long __a, vector bool long long __b,
100 vector unsigned char __c);
102 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
103 vector double __b,
104 vector unsigned char __c);
105 #endif
107 static __inline__ vector unsigned char __ATTRS_o_ai
108 vec_xor(vector unsigned char __a, vector unsigned char __b);
110 /* vec_abs */
112 #define __builtin_altivec_abs_v16qi vec_abs
113 #define __builtin_altivec_abs_v8hi vec_abs
114 #define __builtin_altivec_abs_v4si vec_abs
116 static __inline__ vector signed char __ATTRS_o_ai
117 vec_abs(vector signed char __a) {
118 return __builtin_altivec_vmaxsb(__a, -__a);
121 static __inline__ vector signed short __ATTRS_o_ai
122 vec_abs(vector signed short __a) {
123 return __builtin_altivec_vmaxsh(__a, -__a);
126 static __inline__ vector signed int __ATTRS_o_ai
127 vec_abs(vector signed int __a) {
128 return __builtin_altivec_vmaxsw(__a, -__a);
131 #ifdef __POWER8_VECTOR__
132 static __inline__ vector signed long long __ATTRS_o_ai
133 vec_abs(vector signed long long __a) {
134 return __builtin_altivec_vmaxsd(__a, -__a);
136 #endif
138 static __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
148 #ifdef __VSX__
149 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
150 return __builtin_vsx_xvabsdp(__a);
152 #endif
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
159 static __inline__ vector signed char __ATTRS_o_ai
160 vec_abss(vector signed char __a) {
161 return __builtin_altivec_vmaxsb(
162 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
165 static __inline__ vector signed short __ATTRS_o_ai
166 vec_abss(vector signed short __a) {
167 return __builtin_altivec_vmaxsh(
168 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
171 static __inline__ vector signed int __ATTRS_o_ai
172 vec_abss(vector signed int __a) {
173 return __builtin_altivec_vmaxsw(
174 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
177 /* vec_absd */
178 #if defined(__POWER9_VECTOR__)
180 static __inline__ vector unsigned char __ATTRS_o_ai
181 vec_absd(vector unsigned char __a, vector unsigned char __b) {
182 return __builtin_altivec_vabsdub(__a, __b);
185 static __inline__ vector unsigned short __ATTRS_o_ai
186 vec_absd(vector unsigned short __a, vector unsigned short __b) {
187 return __builtin_altivec_vabsduh(__a, __b);
190 static __inline__ vector unsigned int __ATTRS_o_ai
191 vec_absd(vector unsigned int __a, vector unsigned int __b) {
192 return __builtin_altivec_vabsduw(__a, __b);
195 #endif /* End __POWER9_VECTOR__ */
197 /* vec_add */
199 static __inline__ vector signed char __ATTRS_o_ai
200 vec_add(vector signed char __a, vector signed char __b) {
201 return __a + __b;
204 static __inline__ vector signed char __ATTRS_o_ai
205 vec_add(vector bool char __a, vector signed char __b) {
206 return (vector signed char)__a + __b;
209 static __inline__ vector signed char __ATTRS_o_ai
210 vec_add(vector signed char __a, vector bool char __b) {
211 return __a + (vector signed char)__b;
214 static __inline__ vector unsigned char __ATTRS_o_ai
215 vec_add(vector unsigned char __a, vector unsigned char __b) {
216 return __a + __b;
219 static __inline__ vector unsigned char __ATTRS_o_ai
220 vec_add(vector bool char __a, vector unsigned char __b) {
221 return (vector unsigned char)__a + __b;
224 static __inline__ vector unsigned char __ATTRS_o_ai
225 vec_add(vector unsigned char __a, vector bool char __b) {
226 return __a + (vector unsigned char)__b;
229 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
230 vector short __b) {
231 return __a + __b;
234 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
235 vector short __b) {
236 return (vector short)__a + __b;
239 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
240 vector bool short __b) {
241 return __a + (vector short)__b;
244 static __inline__ vector unsigned short __ATTRS_o_ai
245 vec_add(vector unsigned short __a, vector unsigned short __b) {
246 return __a + __b;
249 static __inline__ vector unsigned short __ATTRS_o_ai
250 vec_add(vector bool short __a, vector unsigned short __b) {
251 return (vector unsigned short)__a + __b;
254 static __inline__ vector unsigned short __ATTRS_o_ai
255 vec_add(vector unsigned short __a, vector bool short __b) {
256 return __a + (vector unsigned short)__b;
259 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
260 vector int __b) {
261 return __a + __b;
264 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
265 vector int __b) {
266 return (vector int)__a + __b;
269 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
270 vector bool int __b) {
271 return __a + (vector int)__b;
274 static __inline__ vector unsigned int __ATTRS_o_ai
275 vec_add(vector unsigned int __a, vector unsigned int __b) {
276 return __a + __b;
279 static __inline__ vector unsigned int __ATTRS_o_ai
280 vec_add(vector bool int __a, vector unsigned int __b) {
281 return (vector unsigned int)__a + __b;
284 static __inline__ vector unsigned int __ATTRS_o_ai
285 vec_add(vector unsigned int __a, vector bool int __b) {
286 return __a + (vector unsigned int)__b;
289 #ifdef __POWER8_VECTOR__
290 static __inline__ vector signed long long __ATTRS_o_ai
291 vec_add(vector signed long long __a, vector signed long long __b) {
292 return __a + __b;
295 static __inline__ vector unsigned long long __ATTRS_o_ai
296 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
297 return __a + __b;
300 #ifdef __SIZEOF_INT128__
301 static __inline__ vector signed __int128 __ATTRS_o_ai
302 vec_add(vector signed __int128 __a, vector signed __int128 __b) {
303 return __a + __b;
306 static __inline__ vector unsigned __int128 __ATTRS_o_ai
307 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
308 return __a + __b;
310 #endif
312 static __inline__ vector unsigned char __attribute__((__always_inline__))
313 vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
314 return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
316 #elif defined(__VSX__)
317 static __inline__ vector signed long long __ATTRS_o_ai
318 vec_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
335 static __inline__ vector unsigned long long __ATTRS_o_ai
336 vec_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);
340 #endif // __POWER8_VECTOR__
342 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
343 vector float __b) {
344 return __a + __b;
347 #ifdef __VSX__
348 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
349 vector double __b) {
350 return __a + __b;
352 #endif // __VSX__
354 /* vec_adde */
356 #ifdef __POWER8_VECTOR__
357 #ifdef __SIZEOF_INT128__
358 static __inline__ vector signed __int128 __ATTRS_o_ai
359 vec_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);
366 static __inline__ vector unsigned __int128 __ATTRS_o_ai
367 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
368 vector unsigned __int128 __c) {
369 return __builtin_altivec_vaddeuqm(__a, __b, __c);
371 #endif
373 static __inline__ vector unsigned char __attribute__((__always_inline__))
374 vec_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);
380 #endif
382 static __inline__ vector signed int __ATTRS_o_ai
383 vec_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);
390 static __inline__ vector unsigned int __ATTRS_o_ai
391 vec_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);
398 /* vec_addec */
400 #ifdef __POWER8_VECTOR__
401 #ifdef __SIZEOF_INT128__
402 static __inline__ vector signed __int128 __ATTRS_o_ai
403 vec_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);
410 static __inline__ vector unsigned __int128 __ATTRS_o_ai
411 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
412 vector unsigned __int128 __c) {
413 return __builtin_altivec_vaddecuq(__a, __b, __c);
415 #endif
417 static __inline__ vector unsigned char __attribute__((__always_inline__))
418 vec_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);
425 #ifdef __powerpc64__
426 static __inline__ vector signed int __ATTRS_o_ai
427 vec_addec(vector signed int __a, vector signed int __b,
428 vector signed int __c) {
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;
445 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
446 return ret;
449 static __inline__ vector unsigned int __ATTRS_o_ai
450 vec_addec(vector unsigned int __a, vector unsigned int __b,
451 vector unsigned int __c) {
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;
465 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
466 return ret;
468 #endif // __powerpc64__
469 #endif // __POWER8_VECTOR__
471 /* vec_vaddubm */
473 #define __builtin_altivec_vaddubm vec_vaddubm
475 static __inline__ vector signed char __ATTRS_o_ai
476 vec_vaddubm(vector signed char __a, vector signed char __b) {
477 return __a + __b;
480 static __inline__ vector signed char __ATTRS_o_ai
481 vec_vaddubm(vector bool char __a, vector signed char __b) {
482 return (vector signed char)__a + __b;
485 static __inline__ vector signed char __ATTRS_o_ai
486 vec_vaddubm(vector signed char __a, vector bool char __b) {
487 return __a + (vector signed char)__b;
490 static __inline__ vector unsigned char __ATTRS_o_ai
491 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
492 return __a + __b;
495 static __inline__ vector unsigned char __ATTRS_o_ai
496 vec_vaddubm(vector bool char __a, vector unsigned char __b) {
497 return (vector unsigned char)__a + __b;
500 static __inline__ vector unsigned char __ATTRS_o_ai
501 vec_vaddubm(vector unsigned char __a, vector bool char __b) {
502 return __a + (vector unsigned char)__b;
505 /* vec_vadduhm */
507 #define __builtin_altivec_vadduhm vec_vadduhm
509 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
510 vector short __b) {
511 return __a + __b;
514 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
515 vector short __b) {
516 return (vector short)__a + __b;
519 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
520 vector bool short __b) {
521 return __a + (vector short)__b;
524 static __inline__ vector unsigned short __ATTRS_o_ai
525 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
526 return __a + __b;
529 static __inline__ vector unsigned short __ATTRS_o_ai
530 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
531 return (vector unsigned short)__a + __b;
534 static __inline__ vector unsigned short __ATTRS_o_ai
535 vec_vadduhm(vector unsigned short __a, vector bool short __b) {
536 return __a + (vector unsigned short)__b;
539 /* vec_vadduwm */
541 #define __builtin_altivec_vadduwm vec_vadduwm
543 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
544 vector int __b) {
545 return __a + __b;
548 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
549 vector int __b) {
550 return (vector int)__a + __b;
553 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
554 vector bool int __b) {
555 return __a + (vector int)__b;
558 static __inline__ vector unsigned int __ATTRS_o_ai
559 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
560 return __a + __b;
563 static __inline__ vector unsigned int __ATTRS_o_ai
564 vec_vadduwm(vector bool int __a, vector unsigned int __b) {
565 return (vector unsigned int)__a + __b;
568 static __inline__ vector unsigned int __ATTRS_o_ai
569 vec_vadduwm(vector unsigned int __a, vector bool int __b) {
570 return __a + (vector unsigned int)__b;
573 /* vec_vaddfp */
575 #define __builtin_altivec_vaddfp vec_vaddfp
577 static __inline__ vector float __attribute__((__always_inline__))
578 vec_vaddfp(vector float __a, vector float __b) {
579 return __a + __b;
582 /* vec_addc */
584 static __inline__ vector signed int __ATTRS_o_ai
585 vec_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);
590 static __inline__ vector unsigned int __ATTRS_o_ai
591 vec_addc(vector unsigned int __a, vector unsigned int __b) {
592 return __builtin_altivec_vaddcuw(__a, __b);
595 #ifdef __POWER8_VECTOR__
596 #ifdef __SIZEOF_INT128__
597 static __inline__ vector signed __int128 __ATTRS_o_ai
598 vec_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);
603 static __inline__ vector unsigned __int128 __ATTRS_o_ai
604 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
605 return __builtin_altivec_vaddcuq(__a, __b);
607 #endif
609 static __inline__ vector unsigned char __attribute__((__always_inline__))
610 vec_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);
614 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
616 /* vec_vaddcuw */
618 static __inline__ vector unsigned int __attribute__((__always_inline__))
619 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
620 return __builtin_altivec_vaddcuw(__a, __b);
623 /* vec_adds */
625 static __inline__ vector signed char __ATTRS_o_ai
626 vec_adds(vector signed char __a, vector signed char __b) {
627 return __builtin_altivec_vaddsbs(__a, __b);
630 static __inline__ vector signed char __ATTRS_o_ai
631 vec_adds(vector bool char __a, vector signed char __b) {
632 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
635 static __inline__ vector signed char __ATTRS_o_ai
636 vec_adds(vector signed char __a, vector bool char __b) {
637 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
640 static __inline__ vector unsigned char __ATTRS_o_ai
641 vec_adds(vector unsigned char __a, vector unsigned char __b) {
642 return __builtin_altivec_vaddubs(__a, __b);
645 static __inline__ vector unsigned char __ATTRS_o_ai
646 vec_adds(vector bool char __a, vector unsigned char __b) {
647 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
650 static __inline__ vector unsigned char __ATTRS_o_ai
651 vec_adds(vector unsigned char __a, vector bool char __b) {
652 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
655 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
656 vector short __b) {
657 return __builtin_altivec_vaddshs(__a, __b);
660 static __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);
665 static __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);
670 static __inline__ vector unsigned short __ATTRS_o_ai
671 vec_adds(vector unsigned short __a, vector unsigned short __b) {
672 return __builtin_altivec_vadduhs(__a, __b);
675 static __inline__ vector unsigned short __ATTRS_o_ai
676 vec_adds(vector bool short __a, vector unsigned short __b) {
677 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
680 static __inline__ vector unsigned short __ATTRS_o_ai
681 vec_adds(vector unsigned short __a, vector bool short __b) {
682 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
685 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
686 vector int __b) {
687 return __builtin_altivec_vaddsws(__a, __b);
690 static __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);
695 static __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);
700 static __inline__ vector unsigned int __ATTRS_o_ai
701 vec_adds(vector unsigned int __a, vector unsigned int __b) {
702 return __builtin_altivec_vadduws(__a, __b);
705 static __inline__ vector unsigned int __ATTRS_o_ai
706 vec_adds(vector bool int __a, vector unsigned int __b) {
707 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
710 static __inline__ vector unsigned int __ATTRS_o_ai
711 vec_adds(vector unsigned int __a, vector bool int __b) {
712 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
715 /* vec_vaddsbs */
717 static __inline__ vector signed char __ATTRS_o_ai
718 vec_vaddsbs(vector signed char __a, vector signed char __b) {
719 return __builtin_altivec_vaddsbs(__a, __b);
722 static __inline__ vector signed char __ATTRS_o_ai
723 vec_vaddsbs(vector bool char __a, vector signed char __b) {
724 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
727 static __inline__ vector signed char __ATTRS_o_ai
728 vec_vaddsbs(vector signed char __a, vector bool char __b) {
729 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
732 /* vec_vaddubs */
734 static __inline__ vector unsigned char __ATTRS_o_ai
735 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
736 return __builtin_altivec_vaddubs(__a, __b);
739 static __inline__ vector unsigned char __ATTRS_o_ai
740 vec_vaddubs(vector bool char __a, vector unsigned char __b) {
741 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
744 static __inline__ vector unsigned char __ATTRS_o_ai
745 vec_vaddubs(vector unsigned char __a, vector bool char __b) {
746 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
749 /* vec_vaddshs */
751 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
752 vector short __b) {
753 return __builtin_altivec_vaddshs(__a, __b);
756 static __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);
761 static __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);
766 /* vec_vadduhs */
768 static __inline__ vector unsigned short __ATTRS_o_ai
769 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
770 return __builtin_altivec_vadduhs(__a, __b);
773 static __inline__ vector unsigned short __ATTRS_o_ai
774 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
775 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
778 static __inline__ vector unsigned short __ATTRS_o_ai
779 vec_vadduhs(vector unsigned short __a, vector bool short __b) {
780 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
783 /* vec_vaddsws */
785 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
786 vector int __b) {
787 return __builtin_altivec_vaddsws(__a, __b);
790 static __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);
795 static __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);
800 /* vec_vadduws */
802 static __inline__ vector unsigned int __ATTRS_o_ai
803 vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
804 return __builtin_altivec_vadduws(__a, __b);
807 static __inline__ vector unsigned int __ATTRS_o_ai
808 vec_vadduws(vector bool int __a, vector unsigned int __b) {
809 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
812 static __inline__ vector unsigned int __ATTRS_o_ai
813 vec_vadduws(vector unsigned int __a, vector bool int __b) {
814 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
817 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
818 defined(__SIZEOF_INT128__)
819 /* vec_vadduqm */
821 static __inline__ vector signed __int128 __ATTRS_o_ai
822 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
823 return __a + __b;
826 static __inline__ vector unsigned __int128 __ATTRS_o_ai
827 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
828 return __a + __b;
831 /* vec_vaddeuqm */
833 static __inline__ vector signed __int128 __ATTRS_o_ai
834 vec_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);
841 static __inline__ vector unsigned __int128 __ATTRS_o_ai
842 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
843 vector unsigned __int128 __c) {
844 return __builtin_altivec_vaddeuqm(__a, __b, __c);
847 /* vec_vaddcuq */
849 static __inline__ vector signed __int128 __ATTRS_o_ai
850 vec_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);
855 static __inline__ vector unsigned __int128 __ATTRS_o_ai
856 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
857 return __builtin_altivec_vaddcuq(__a, __b);
860 /* vec_vaddecuq */
862 static __inline__ vector signed __int128 __ATTRS_o_ai
863 vec_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);
870 static __inline__ vector unsigned __int128 __ATTRS_o_ai
871 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
872 vector unsigned __int128 __c) {
873 return __builtin_altivec_vaddecuq(__a, __b, __c);
875 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
877 /* vec_and */
879 #define __builtin_altivec_vand vec_and
881 static __inline__ vector signed char __ATTRS_o_ai
882 vec_and(vector signed char __a, vector signed char __b) {
883 return __a & __b;
886 static __inline__ vector signed char __ATTRS_o_ai
887 vec_and(vector bool char __a, vector signed char __b) {
888 return (vector signed char)__a & __b;
891 static __inline__ vector signed char __ATTRS_o_ai
892 vec_and(vector signed char __a, vector bool char __b) {
893 return __a & (vector signed char)__b;
896 static __inline__ vector unsigned char __ATTRS_o_ai
897 vec_and(vector unsigned char __a, vector unsigned char __b) {
898 return __a & __b;
901 static __inline__ vector unsigned char __ATTRS_o_ai
902 vec_and(vector bool char __a, vector unsigned char __b) {
903 return (vector unsigned char)__a & __b;
906 static __inline__ vector unsigned char __ATTRS_o_ai
907 vec_and(vector unsigned char __a, vector bool char __b) {
908 return __a & (vector unsigned char)__b;
911 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
912 vector bool char __b) {
913 return __a & __b;
916 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
917 vector short __b) {
918 return __a & __b;
921 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
922 vector short __b) {
923 return (vector short)__a & __b;
926 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
927 vector bool short __b) {
928 return __a & (vector short)__b;
931 static __inline__ vector unsigned short __ATTRS_o_ai
932 vec_and(vector unsigned short __a, vector unsigned short __b) {
933 return __a & __b;
936 static __inline__ vector unsigned short __ATTRS_o_ai
937 vec_and(vector bool short __a, vector unsigned short __b) {
938 return (vector unsigned short)__a & __b;
941 static __inline__ vector unsigned short __ATTRS_o_ai
942 vec_and(vector unsigned short __a, vector bool short __b) {
943 return __a & (vector unsigned short)__b;
946 static __inline__ vector bool short __ATTRS_o_ai
947 vec_and(vector bool short __a, vector bool short __b) {
948 return __a & __b;
951 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
952 vector int __b) {
953 return __a & __b;
956 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
957 vector int __b) {
958 return (vector int)__a & __b;
961 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
962 vector bool int __b) {
963 return __a & (vector int)__b;
966 static __inline__ vector unsigned int __ATTRS_o_ai
967 vec_and(vector unsigned int __a, vector unsigned int __b) {
968 return __a & __b;
971 static __inline__ vector unsigned int __ATTRS_o_ai
972 vec_and(vector bool int __a, vector unsigned int __b) {
973 return (vector unsigned int)__a & __b;
976 static __inline__ vector unsigned int __ATTRS_o_ai
977 vec_and(vector unsigned int __a, vector bool int __b) {
978 return __a & (vector unsigned int)__b;
981 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
982 vector bool int __b) {
983 return __a & __b;
986 static __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;
993 static __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;
1000 static __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;
1007 #ifdef __VSX__
1008 static __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;
1015 static __inline__ vector double __ATTRS_o_ai
1016 vec_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;
1022 static __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;
1029 static __inline__ vector signed long long __ATTRS_o_ai
1030 vec_and(vector signed long long __a, vector signed long long __b) {
1031 return __a & __b;
1034 static __inline__ vector signed long long __ATTRS_o_ai
1035 vec_and(vector bool long long __a, vector signed long long __b) {
1036 return (vector signed long long)__a & __b;
1039 static __inline__ vector signed long long __ATTRS_o_ai
1040 vec_and(vector signed long long __a, vector bool long long __b) {
1041 return __a & (vector signed long long)__b;
1044 static __inline__ vector unsigned long long __ATTRS_o_ai
1045 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
1046 return __a & __b;
1049 static __inline__ vector unsigned long long __ATTRS_o_ai
1050 vec_and(vector bool long long __a, vector unsigned long long __b) {
1051 return (vector unsigned long long)__a & __b;
1054 static __inline__ vector unsigned long long __ATTRS_o_ai
1055 vec_and(vector unsigned long long __a, vector bool long long __b) {
1056 return __a & (vector unsigned long long)__b;
1059 static __inline__ vector bool long long __ATTRS_o_ai
1060 vec_and(vector bool long long __a, vector bool long long __b) {
1061 return __a & __b;
1063 #endif
1065 /* vec_vand */
1067 static __inline__ vector signed char __ATTRS_o_ai
1068 vec_vand(vector signed char __a, vector signed char __b) {
1069 return __a & __b;
1072 static __inline__ vector signed char __ATTRS_o_ai
1073 vec_vand(vector bool char __a, vector signed char __b) {
1074 return (vector signed char)__a & __b;
1077 static __inline__ vector signed char __ATTRS_o_ai
1078 vec_vand(vector signed char __a, vector bool char __b) {
1079 return __a & (vector signed char)__b;
1082 static __inline__ vector unsigned char __ATTRS_o_ai
1083 vec_vand(vector unsigned char __a, vector unsigned char __b) {
1084 return __a & __b;
1087 static __inline__ vector unsigned char __ATTRS_o_ai
1088 vec_vand(vector bool char __a, vector unsigned char __b) {
1089 return (vector unsigned char)__a & __b;
1092 static __inline__ vector unsigned char __ATTRS_o_ai
1093 vec_vand(vector unsigned char __a, vector bool char __b) {
1094 return __a & (vector unsigned char)__b;
1097 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1098 vector bool char __b) {
1099 return __a & __b;
1102 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1103 vector short __b) {
1104 return __a & __b;
1107 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1108 vector short __b) {
1109 return (vector short)__a & __b;
1112 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1113 vector bool short __b) {
1114 return __a & (vector short)__b;
1117 static __inline__ vector unsigned short __ATTRS_o_ai
1118 vec_vand(vector unsigned short __a, vector unsigned short __b) {
1119 return __a & __b;
1122 static __inline__ vector unsigned short __ATTRS_o_ai
1123 vec_vand(vector bool short __a, vector unsigned short __b) {
1124 return (vector unsigned short)__a & __b;
1127 static __inline__ vector unsigned short __ATTRS_o_ai
1128 vec_vand(vector unsigned short __a, vector bool short __b) {
1129 return __a & (vector unsigned short)__b;
1132 static __inline__ vector bool short __ATTRS_o_ai
1133 vec_vand(vector bool short __a, vector bool short __b) {
1134 return __a & __b;
1137 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1138 vector int __b) {
1139 return __a & __b;
1142 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1143 vector int __b) {
1144 return (vector int)__a & __b;
1147 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1148 vector bool int __b) {
1149 return __a & (vector int)__b;
1152 static __inline__ vector unsigned int __ATTRS_o_ai
1153 vec_vand(vector unsigned int __a, vector unsigned int __b) {
1154 return __a & __b;
1157 static __inline__ vector unsigned int __ATTRS_o_ai
1158 vec_vand(vector bool int __a, vector unsigned int __b) {
1159 return (vector unsigned int)__a & __b;
1162 static __inline__ vector unsigned int __ATTRS_o_ai
1163 vec_vand(vector unsigned int __a, vector bool int __b) {
1164 return __a & (vector unsigned int)__b;
1167 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1168 vector bool int __b) {
1169 return __a & __b;
1172 static __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;
1179 static __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;
1186 static __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;
1193 #ifdef __VSX__
1194 static __inline__ vector signed long long __ATTRS_o_ai
1195 vec_vand(vector signed long long __a, vector signed long long __b) {
1196 return __a & __b;
1199 static __inline__ vector signed long long __ATTRS_o_ai
1200 vec_vand(vector bool long long __a, vector signed long long __b) {
1201 return (vector signed long long)__a & __b;
1204 static __inline__ vector signed long long __ATTRS_o_ai
1205 vec_vand(vector signed long long __a, vector bool long long __b) {
1206 return __a & (vector signed long long)__b;
1209 static __inline__ vector unsigned long long __ATTRS_o_ai
1210 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1211 return __a & __b;
1214 static __inline__ vector unsigned long long __ATTRS_o_ai
1215 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1216 return (vector unsigned long long)__a & __b;
1219 static __inline__ vector unsigned long long __ATTRS_o_ai
1220 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1221 return __a & (vector unsigned long long)__b;
1224 static __inline__ vector bool long long __ATTRS_o_ai
1225 vec_vand(vector bool long long __a, vector bool long long __b) {
1226 return __a & __b;
1228 #endif
1230 /* vec_andc */
1232 #define __builtin_altivec_vandc vec_andc
1234 static __inline__ vector signed char __ATTRS_o_ai
1235 vec_andc(vector signed char __a, vector signed char __b) {
1236 return __a & ~__b;
1239 static __inline__ vector signed char __ATTRS_o_ai
1240 vec_andc(vector bool char __a, vector signed char __b) {
1241 return (vector signed char)__a & ~__b;
1244 static __inline__ vector signed char __ATTRS_o_ai
1245 vec_andc(vector signed char __a, vector bool char __b) {
1246 return __a & ~(vector signed char)__b;
1249 static __inline__ vector unsigned char __ATTRS_o_ai
1250 vec_andc(vector unsigned char __a, vector unsigned char __b) {
1251 return __a & ~__b;
1254 static __inline__ vector unsigned char __ATTRS_o_ai
1255 vec_andc(vector bool char __a, vector unsigned char __b) {
1256 return (vector unsigned char)__a & ~__b;
1259 static __inline__ vector unsigned char __ATTRS_o_ai
1260 vec_andc(vector unsigned char __a, vector bool char __b) {
1261 return __a & ~(vector unsigned char)__b;
1264 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1265 vector bool char __b) {
1266 return __a & ~__b;
1269 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1270 vector short __b) {
1271 return __a & ~__b;
1274 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1275 vector short __b) {
1276 return (vector short)__a & ~__b;
1279 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1280 vector bool short __b) {
1281 return __a & ~(vector short)__b;
1284 static __inline__ vector unsigned short __ATTRS_o_ai
1285 vec_andc(vector unsigned short __a, vector unsigned short __b) {
1286 return __a & ~__b;
1289 static __inline__ vector unsigned short __ATTRS_o_ai
1290 vec_andc(vector bool short __a, vector unsigned short __b) {
1291 return (vector unsigned short)__a & ~__b;
1294 static __inline__ vector unsigned short __ATTRS_o_ai
1295 vec_andc(vector unsigned short __a, vector bool short __b) {
1296 return __a & ~(vector unsigned short)__b;
1299 static __inline__ vector bool short __ATTRS_o_ai
1300 vec_andc(vector bool short __a, vector bool short __b) {
1301 return __a & ~__b;
1304 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1305 vector int __b) {
1306 return __a & ~__b;
1309 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1310 vector int __b) {
1311 return (vector int)__a & ~__b;
1314 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1315 vector bool int __b) {
1316 return __a & ~(vector int)__b;
1319 static __inline__ vector unsigned int __ATTRS_o_ai
1320 vec_andc(vector unsigned int __a, vector unsigned int __b) {
1321 return __a & ~__b;
1324 static __inline__ vector unsigned int __ATTRS_o_ai
1325 vec_andc(vector bool int __a, vector unsigned int __b) {
1326 return (vector unsigned int)__a & ~__b;
1329 static __inline__ vector unsigned int __ATTRS_o_ai
1330 vec_andc(vector unsigned int __a, vector bool int __b) {
1331 return __a & ~(vector unsigned int)__b;
1334 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1335 vector bool int __b) {
1336 return __a & ~__b;
1339 static __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;
1346 static __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;
1353 static __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;
1360 #ifdef __VSX__
1361 static __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;
1368 static __inline__ vector double __ATTRS_o_ai
1369 vec_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;
1375 static __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;
1382 static __inline__ vector signed long long __ATTRS_o_ai
1383 vec_andc(vector signed long long __a, vector signed long long __b) {
1384 return __a & ~__b;
1387 static __inline__ vector signed long long __ATTRS_o_ai
1388 vec_andc(vector bool long long __a, vector signed long long __b) {
1389 return (vector signed long long)__a & ~__b;
1392 static __inline__ vector signed long long __ATTRS_o_ai
1393 vec_andc(vector signed long long __a, vector bool long long __b) {
1394 return __a & ~(vector signed long long)__b;
1397 static __inline__ vector unsigned long long __ATTRS_o_ai
1398 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1399 return __a & ~__b;
1402 static __inline__ vector unsigned long long __ATTRS_o_ai
1403 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1404 return (vector unsigned long long)__a & ~__b;
1407 static __inline__ vector unsigned long long __ATTRS_o_ai
1408 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1409 return __a & ~(vector unsigned long long)__b;
1412 static __inline__ vector bool long long __ATTRS_o_ai
1413 vec_andc(vector bool long long __a, vector bool long long __b) {
1414 return __a & ~__b;
1416 #endif
1418 /* vec_vandc */
1420 static __inline__ vector signed char __ATTRS_o_ai
1421 vec_vandc(vector signed char __a, vector signed char __b) {
1422 return __a & ~__b;
1425 static __inline__ vector signed char __ATTRS_o_ai
1426 vec_vandc(vector bool char __a, vector signed char __b) {
1427 return (vector signed char)__a & ~__b;
1430 static __inline__ vector signed char __ATTRS_o_ai
1431 vec_vandc(vector signed char __a, vector bool char __b) {
1432 return __a & ~(vector signed char)__b;
1435 static __inline__ vector unsigned char __ATTRS_o_ai
1436 vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1437 return __a & ~__b;
1440 static __inline__ vector unsigned char __ATTRS_o_ai
1441 vec_vandc(vector bool char __a, vector unsigned char __b) {
1442 return (vector unsigned char)__a & ~__b;
1445 static __inline__ vector unsigned char __ATTRS_o_ai
1446 vec_vandc(vector unsigned char __a, vector bool char __b) {
1447 return __a & ~(vector unsigned char)__b;
1450 static __inline__ vector bool char __ATTRS_o_ai
1451 vec_vandc(vector bool char __a, vector bool char __b) {
1452 return __a & ~__b;
1455 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1456 vector short __b) {
1457 return __a & ~__b;
1460 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1461 vector short __b) {
1462 return (vector short)__a & ~__b;
1465 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1466 vector bool short __b) {
1467 return __a & ~(vector short)__b;
1470 static __inline__ vector unsigned short __ATTRS_o_ai
1471 vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1472 return __a & ~__b;
1475 static __inline__ vector unsigned short __ATTRS_o_ai
1476 vec_vandc(vector bool short __a, vector unsigned short __b) {
1477 return (vector unsigned short)__a & ~__b;
1480 static __inline__ vector unsigned short __ATTRS_o_ai
1481 vec_vandc(vector unsigned short __a, vector bool short __b) {
1482 return __a & ~(vector unsigned short)__b;
1485 static __inline__ vector bool short __ATTRS_o_ai
1486 vec_vandc(vector bool short __a, vector bool short __b) {
1487 return __a & ~__b;
1490 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1491 vector int __b) {
1492 return __a & ~__b;
1495 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1496 vector int __b) {
1497 return (vector int)__a & ~__b;
1500 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1501 vector bool int __b) {
1502 return __a & ~(vector int)__b;
1505 static __inline__ vector unsigned int __ATTRS_o_ai
1506 vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1507 return __a & ~__b;
1510 static __inline__ vector unsigned int __ATTRS_o_ai
1511 vec_vandc(vector bool int __a, vector unsigned int __b) {
1512 return (vector unsigned int)__a & ~__b;
1515 static __inline__ vector unsigned int __ATTRS_o_ai
1516 vec_vandc(vector unsigned int __a, vector bool int __b) {
1517 return __a & ~(vector unsigned int)__b;
1520 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1521 vector bool int __b) {
1522 return __a & ~__b;
1525 static __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;
1532 static __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;
1539 static __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;
1546 #ifdef __VSX__
1547 static __inline__ vector signed long long __ATTRS_o_ai
1548 vec_vandc(vector signed long long __a, vector signed long long __b) {
1549 return __a & ~__b;
1552 static __inline__ vector signed long long __ATTRS_o_ai
1553 vec_vandc(vector bool long long __a, vector signed long long __b) {
1554 return (vector signed long long)__a & ~__b;
1557 static __inline__ vector signed long long __ATTRS_o_ai
1558 vec_vandc(vector signed long long __a, vector bool long long __b) {
1559 return __a & ~(vector signed long long)__b;
1562 static __inline__ vector unsigned long long __ATTRS_o_ai
1563 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1564 return __a & ~__b;
1567 static __inline__ vector unsigned long long __ATTRS_o_ai
1568 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1569 return (vector unsigned long long)__a & ~__b;
1572 static __inline__ vector unsigned long long __ATTRS_o_ai
1573 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1574 return __a & ~(vector unsigned long long)__b;
1577 static __inline__ vector bool long long __ATTRS_o_ai
1578 vec_vandc(vector bool long long __a, vector bool long long __b) {
1579 return __a & ~__b;
1581 #endif
1583 /* vec_avg */
1585 static __inline__ vector signed char __ATTRS_o_ai
1586 vec_avg(vector signed char __a, vector signed char __b) {
1587 return __builtin_altivec_vavgsb(__a, __b);
1590 static __inline__ vector unsigned char __ATTRS_o_ai
1591 vec_avg(vector unsigned char __a, vector unsigned char __b) {
1592 return __builtin_altivec_vavgub(__a, __b);
1595 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1596 vector short __b) {
1597 return __builtin_altivec_vavgsh(__a, __b);
1600 static __inline__ vector unsigned short __ATTRS_o_ai
1601 vec_avg(vector unsigned short __a, vector unsigned short __b) {
1602 return __builtin_altivec_vavguh(__a, __b);
1605 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1606 vector int __b) {
1607 return __builtin_altivec_vavgsw(__a, __b);
1610 static __inline__ vector unsigned int __ATTRS_o_ai
1611 vec_avg(vector unsigned int __a, vector unsigned int __b) {
1612 return __builtin_altivec_vavguw(__a, __b);
1615 /* vec_vavgsb */
1617 static __inline__ vector signed char __attribute__((__always_inline__))
1618 vec_vavgsb(vector signed char __a, vector signed char __b) {
1619 return __builtin_altivec_vavgsb(__a, __b);
1622 /* vec_vavgub */
1624 static __inline__ vector unsigned char __attribute__((__always_inline__))
1625 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1626 return __builtin_altivec_vavgub(__a, __b);
1629 /* vec_vavgsh */
1631 static __inline__ vector short __attribute__((__always_inline__))
1632 vec_vavgsh(vector short __a, vector short __b) {
1633 return __builtin_altivec_vavgsh(__a, __b);
1636 /* vec_vavguh */
1638 static __inline__ vector unsigned short __attribute__((__always_inline__))
1639 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1640 return __builtin_altivec_vavguh(__a, __b);
1643 /* vec_vavgsw */
1645 static __inline__ vector int __attribute__((__always_inline__))
1646 vec_vavgsw(vector int __a, vector int __b) {
1647 return __builtin_altivec_vavgsw(__a, __b);
1650 /* vec_vavguw */
1652 static __inline__ vector unsigned int __attribute__((__always_inline__))
1653 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1654 return __builtin_altivec_vavguw(__a, __b);
1657 /* vec_ceil */
1659 static __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
1667 #ifdef __VSX__
1668 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1669 return __builtin_vsx_xvrdpip(__a);
1671 #endif
1673 /* vec_roundp */
1674 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) {
1675 return vec_ceil(__a);
1678 #ifdef __VSX__
1679 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) {
1680 return vec_ceil(__a);
1682 #endif
1684 /* vec_vrfip */
1686 static __inline__ vector float __attribute__((__always_inline__))
1687 vec_vrfip(vector float __a) {
1688 return __builtin_altivec_vrfip(__a);
1691 /* vec_cmpb */
1693 static __inline__ vector int __attribute__((__always_inline__))
1694 vec_cmpb(vector float __a, vector float __b) {
1695 return __builtin_altivec_vcmpbfp(__a, __b);
1698 /* vec_vcmpbfp */
1700 static __inline__ vector int __attribute__((__always_inline__))
1701 vec_vcmpbfp(vector float __a, vector float __b) {
1702 return __builtin_altivec_vcmpbfp(__a, __b);
1705 /* vec_cmpeq */
1707 static __inline__ vector bool char __ATTRS_o_ai
1708 vec_cmpeq(vector signed char __a, vector signed char __b) {
1709 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1710 (vector char)__b);
1713 static __inline__ vector bool char __ATTRS_o_ai
1714 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1715 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1716 (vector char)__b);
1719 static __inline__ vector bool char __ATTRS_o_ai
1720 vec_cmpeq(vector bool char __a, vector bool char __b) {
1721 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1722 (vector char)__b);
1725 static __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);
1730 static __inline__ vector bool short __ATTRS_o_ai
1731 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1732 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1733 (vector short)__b);
1736 static __inline__ vector bool short __ATTRS_o_ai
1737 vec_cmpeq(vector bool short __a, vector bool short __b) {
1738 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1739 (vector short)__b);
1742 static __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);
1747 static __inline__ vector bool int __ATTRS_o_ai
1748 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1749 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1750 (vector int)__b);
1753 static __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);
1759 #ifdef __POWER8_VECTOR__
1760 static __inline__ vector bool long long __ATTRS_o_ai
1761 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1762 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1765 static __inline__ vector bool long long __ATTRS_o_ai
1766 vec_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);
1771 static __inline__ vector bool long long __ATTRS_o_ai
1772 vec_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);
1776 #elif defined(__VSX__)
1777 static __inline__ vector bool long long __ATTRS_o_ai
1778 vec_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
1792 static __inline__ vector bool long long __ATTRS_o_ai
1793 vec_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);
1797 static __inline__ vector bool long long __ATTRS_o_ai
1798 vec_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);
1801 #endif
1803 static __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
1812 #ifdef __VSX__
1813 static __inline__ vector bool long long __ATTRS_o_ai
1814 vec_cmpeq(vector double __a, vector double __b) {
1815 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1817 #endif
1819 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1820 static __inline__ vector bool __int128 __ATTRS_o_ai
1821 vec_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);
1826 static __inline__ vector bool __int128 __ATTRS_o_ai
1827 vec_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);
1832 static __inline__ vector bool __int128 __ATTRS_o_ai
1833 vec_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);
1837 #endif
1839 #ifdef __POWER9_VECTOR__
1840 /* vec_cmpne */
1842 static __inline__ vector bool char __ATTRS_o_ai
1843 vec_cmpne(vector bool char __a, vector bool char __b) {
1844 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1845 (vector char)__b);
1848 static __inline__ vector bool char __ATTRS_o_ai
1849 vec_cmpne(vector signed char __a, vector signed char __b) {
1850 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1851 (vector char)__b);
1854 static __inline__ vector bool char __ATTRS_o_ai
1855 vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1856 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1857 (vector char)__b);
1860 static __inline__ vector bool short __ATTRS_o_ai
1861 vec_cmpne(vector bool short __a, vector bool short __b) {
1862 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1863 (vector short)__b);
1866 static __inline__ vector bool short __ATTRS_o_ai
1867 vec_cmpne(vector signed short __a, vector signed short __b) {
1868 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1869 (vector short)__b);
1872 static __inline__ vector bool short __ATTRS_o_ai
1873 vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1874 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1875 (vector short)__b);
1878 static __inline__ vector bool int __ATTRS_o_ai
1879 vec_cmpne(vector bool int __a, vector bool int __b) {
1880 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1881 (vector int)__b);
1884 static __inline__ vector bool int __ATTRS_o_ai
1885 vec_cmpne(vector signed int __a, vector signed int __b) {
1886 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1887 (vector int)__b);
1890 static __inline__ vector bool int __ATTRS_o_ai
1891 vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1892 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1893 (vector int)__b);
1896 static __inline__ vector bool int __ATTRS_o_ai
1897 vec_cmpne(vector float __a, vector float __b) {
1898 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1899 (vector int)__b);
1902 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1903 static __inline__ vector bool __int128 __ATTRS_o_ai
1904 vec_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));
1909 static __inline__ vector bool __int128 __ATTRS_o_ai
1910 vec_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));
1915 static __inline__ vector bool __int128 __ATTRS_o_ai
1916 vec_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));
1920 #endif
1922 /* vec_cmpnez */
1924 static __inline__ vector bool char __ATTRS_o_ai
1925 vec_cmpnez(vector signed char __a, vector signed char __b) {
1926 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1927 (vector char)__b);
1930 static __inline__ vector bool char __ATTRS_o_ai
1931 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1932 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1933 (vector char)__b);
1936 static __inline__ vector bool short __ATTRS_o_ai
1937 vec_cmpnez(vector signed short __a, vector signed short __b) {
1938 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1939 (vector short)__b);
1942 static __inline__ vector bool short __ATTRS_o_ai
1943 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1944 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1945 (vector short)__b);
1948 static __inline__ vector bool int __ATTRS_o_ai
1949 vec_cmpnez(vector signed int __a, vector signed int __b) {
1950 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1951 (vector int)__b);
1954 static __inline__ vector bool int __ATTRS_o_ai
1955 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1956 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1957 (vector int)__b);
1960 static __inline__ signed int __ATTRS_o_ai
1961 vec_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
1969 static __inline__ signed int __ATTRS_o_ai
1970 vec_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
1978 static __inline__ signed int __ATTRS_o_ai
1979 vec_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
1987 static __inline__ signed int __ATTRS_o_ai
1988 vec_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
1996 static __inline__ vector unsigned int __ATTRS_o_ai
1997 vec_parity_lsbb(vector unsigned int __a) {
1998 return __builtin_altivec_vprtybw(__a);
2001 static __inline__ vector unsigned int __ATTRS_o_ai
2002 vec_parity_lsbb(vector signed int __a) {
2003 return __builtin_altivec_vprtybw((vector unsigned int)__a);
2006 #ifdef __SIZEOF_INT128__
2007 static __inline__ vector unsigned __int128 __ATTRS_o_ai
2008 vec_parity_lsbb(vector unsigned __int128 __a) {
2009 return __builtin_altivec_vprtybq(__a);
2012 static __inline__ vector unsigned __int128 __ATTRS_o_ai
2013 vec_parity_lsbb(vector signed __int128 __a) {
2014 return __builtin_altivec_vprtybq((vector unsigned __int128)__a);
2016 #endif
2018 static __inline__ vector unsigned long long __ATTRS_o_ai
2019 vec_parity_lsbb(vector unsigned long long __a) {
2020 return __builtin_altivec_vprtybd(__a);
2023 static __inline__ vector unsigned long long __ATTRS_o_ai
2024 vec_parity_lsbb(vector signed long long __a) {
2025 return __builtin_altivec_vprtybd((vector unsigned long long)__a);
2028 #else
2029 /* vec_cmpne */
2031 static __inline__ vector bool char __ATTRS_o_ai
2032 vec_cmpne(vector bool char __a, vector bool char __b) {
2033 return ~(vec_cmpeq(__a, __b));
2036 static __inline__ vector bool char __ATTRS_o_ai
2037 vec_cmpne(vector signed char __a, vector signed char __b) {
2038 return ~(vec_cmpeq(__a, __b));
2041 static __inline__ vector bool char __ATTRS_o_ai
2042 vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
2043 return ~(vec_cmpeq(__a, __b));
2046 static __inline__ vector bool short __ATTRS_o_ai
2047 vec_cmpne(vector bool short __a, vector bool short __b) {
2048 return ~(vec_cmpeq(__a, __b));
2051 static __inline__ vector bool short __ATTRS_o_ai
2052 vec_cmpne(vector signed short __a, vector signed short __b) {
2053 return ~(vec_cmpeq(__a, __b));
2056 static __inline__ vector bool short __ATTRS_o_ai
2057 vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
2058 return ~(vec_cmpeq(__a, __b));
2061 static __inline__ vector bool int __ATTRS_o_ai
2062 vec_cmpne(vector bool int __a, vector bool int __b) {
2063 return ~(vec_cmpeq(__a, __b));
2066 static __inline__ vector bool int __ATTRS_o_ai
2067 vec_cmpne(vector signed int __a, vector signed int __b) {
2068 return ~(vec_cmpeq(__a, __b));
2071 static __inline__ vector bool int __ATTRS_o_ai
2072 vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
2073 return ~(vec_cmpeq(__a, __b));
2076 static __inline__ vector bool int __ATTRS_o_ai
2077 vec_cmpne(vector float __a, vector float __b) {
2078 return ~(vec_cmpeq(__a, __b));
2080 #endif
2082 #ifdef __POWER8_VECTOR__
2083 static __inline__ vector bool long long __ATTRS_o_ai
2084 vec_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));
2089 static __inline__ vector bool long long __ATTRS_o_ai
2090 vec_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));
2095 static __inline__ vector bool long long __ATTRS_o_ai
2096 vec_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));
2100 #elif defined(__VSX__)
2101 static __inline__ vector bool long long __ATTRS_o_ai
2102 vec_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));
2107 static __inline__ vector bool long long __ATTRS_o_ai
2108 vec_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));
2113 static __inline__ vector bool long long __ATTRS_o_ai
2114 vec_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));
2118 #endif
2120 #ifdef __VSX__
2121 static __inline__ vector bool long long __ATTRS_o_ai
2122 vec_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));
2126 #endif
2128 /* vec_cmpgt */
2130 static __inline__ vector bool char __ATTRS_o_ai
2131 vec_cmpgt(vector signed char __a, vector signed char __b) {
2132 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2135 static __inline__ vector bool char __ATTRS_o_ai
2136 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
2137 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2140 static __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);
2145 static __inline__ vector bool short __ATTRS_o_ai
2146 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
2147 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2150 static __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);
2155 static __inline__ vector bool int __ATTRS_o_ai
2156 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
2157 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2160 #ifdef __POWER8_VECTOR__
2161 static __inline__ vector bool long long __ATTRS_o_ai
2162 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2163 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
2166 static __inline__ vector bool long long __ATTRS_o_ai
2167 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2168 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
2170 #elif defined(__VSX__)
2171 static __inline__ vector bool long long __ATTRS_o_ai
2172 vec_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,
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,
2189 #endif
2192 static __inline__ vector bool long long __ATTRS_o_ai
2193 vec_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,
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,
2208 #endif
2210 #endif
2212 static __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
2221 #ifdef __VSX__
2222 static __inline__ vector bool long long __ATTRS_o_ai
2223 vec_cmpgt(vector double __a, vector double __b) {
2224 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
2226 #endif
2228 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2229 static __inline__ vector bool __int128 __ATTRS_o_ai
2230 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) {
2231 return (vector bool __int128)__builtin_altivec_vcmpgtsq(__a, __b);
2234 static __inline__ vector bool __int128 __ATTRS_o_ai
2235 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2236 return (vector bool __int128)__builtin_altivec_vcmpgtuq(__a, __b);
2238 #endif
2240 /* vec_cmpge */
2242 static __inline__ vector bool char __ATTRS_o_ai
2243 vec_cmpge(vector signed char __a, vector signed char __b) {
2244 return ~(vec_cmpgt(__b, __a));
2247 static __inline__ vector bool char __ATTRS_o_ai
2248 vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
2249 return ~(vec_cmpgt(__b, __a));
2252 static __inline__ vector bool short __ATTRS_o_ai
2253 vec_cmpge(vector signed short __a, vector signed short __b) {
2254 return ~(vec_cmpgt(__b, __a));
2257 static __inline__ vector bool short __ATTRS_o_ai
2258 vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
2259 return ~(vec_cmpgt(__b, __a));
2262 static __inline__ vector bool int __ATTRS_o_ai
2263 vec_cmpge(vector signed int __a, vector signed int __b) {
2264 return ~(vec_cmpgt(__b, __a));
2267 static __inline__ vector bool int __ATTRS_o_ai
2268 vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2269 return ~(vec_cmpgt(__b, __a));
2272 static __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
2281 #ifdef __VSX__
2282 static __inline__ vector bool long long __ATTRS_o_ai
2283 vec_cmpge(vector double __a, vector double __b) {
2284 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2287 static __inline__ vector bool long long __ATTRS_o_ai
2288 vec_cmpge(vector signed long long __a, vector signed long long __b) {
2289 return ~(vec_cmpgt(__b, __a));
2292 static __inline__ vector bool long long __ATTRS_o_ai
2293 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2294 return ~(vec_cmpgt(__b, __a));
2296 #endif
2298 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2299 static __inline__ vector bool __int128 __ATTRS_o_ai
2300 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) {
2301 return ~(vec_cmpgt(__b, __a));
2304 static __inline__ vector bool __int128 __ATTRS_o_ai
2305 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2306 return ~(vec_cmpgt(__b, __a));
2308 #endif
2310 /* vec_vcmpgefp */
2312 static __inline__ vector bool int __attribute__((__always_inline__))
2313 vec_vcmpgefp(vector float __a, vector float __b) {
2314 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2317 /* vec_vcmpgtsb */
2319 static __inline__ vector bool char __attribute__((__always_inline__))
2320 vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2321 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2324 /* vec_vcmpgtub */
2326 static __inline__ vector bool char __attribute__((__always_inline__))
2327 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2328 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2331 /* vec_vcmpgtsh */
2333 static __inline__ vector bool short __attribute__((__always_inline__))
2334 vec_vcmpgtsh(vector short __a, vector short __b) {
2335 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2338 /* vec_vcmpgtuh */
2340 static __inline__ vector bool short __attribute__((__always_inline__))
2341 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2342 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2345 /* vec_vcmpgtsw */
2347 static __inline__ vector bool int __attribute__((__always_inline__))
2348 vec_vcmpgtsw(vector int __a, vector int __b) {
2349 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2352 /* vec_vcmpgtuw */
2354 static __inline__ vector bool int __attribute__((__always_inline__))
2355 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2356 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2359 /* vec_vcmpgtfp */
2361 static __inline__ vector bool int __attribute__((__always_inline__))
2362 vec_vcmpgtfp(vector float __a, vector float __b) {
2363 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2366 /* vec_cmple */
2368 static __inline__ vector bool char __ATTRS_o_ai
2369 vec_cmple(vector signed char __a, vector signed char __b) {
2370 return vec_cmpge(__b, __a);
2373 static __inline__ vector bool char __ATTRS_o_ai
2374 vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2375 return vec_cmpge(__b, __a);
2378 static __inline__ vector bool short __ATTRS_o_ai
2379 vec_cmple(vector signed short __a, vector signed short __b) {
2380 return vec_cmpge(__b, __a);
2383 static __inline__ vector bool short __ATTRS_o_ai
2384 vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2385 return vec_cmpge(__b, __a);
2388 static __inline__ vector bool int __ATTRS_o_ai
2389 vec_cmple(vector signed int __a, vector signed int __b) {
2390 return vec_cmpge(__b, __a);
2393 static __inline__ vector bool int __ATTRS_o_ai
2394 vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2395 return vec_cmpge(__b, __a);
2398 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2399 vector float __b) {
2400 return vec_cmpge(__b, __a);
2403 #ifdef __VSX__
2404 static __inline__ vector bool long long __ATTRS_o_ai
2405 vec_cmple(vector double __a, vector double __b) {
2406 return vec_cmpge(__b, __a);
2409 static __inline__ vector bool long long __ATTRS_o_ai
2410 vec_cmple(vector signed long long __a, vector signed long long __b) {
2411 return vec_cmpge(__b, __a);
2414 static __inline__ vector bool long long __ATTRS_o_ai
2415 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2416 return vec_cmpge(__b, __a);
2418 #endif
2420 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2421 static __inline__ vector bool __int128 __ATTRS_o_ai
2422 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) {
2423 return vec_cmpge(__b, __a);
2426 static __inline__ vector bool __int128 __ATTRS_o_ai
2427 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2428 return vec_cmpge(__b, __a);
2430 #endif
2432 /* vec_cmplt */
2434 static __inline__ vector bool char __ATTRS_o_ai
2435 vec_cmplt(vector signed char __a, vector signed char __b) {
2436 return vec_cmpgt(__b, __a);
2439 static __inline__ vector bool char __ATTRS_o_ai
2440 vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2441 return vec_cmpgt(__b, __a);
2444 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2445 vector short __b) {
2446 return vec_cmpgt(__b, __a);
2449 static __inline__ vector bool short __ATTRS_o_ai
2450 vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2451 return vec_cmpgt(__b, __a);
2454 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2455 vector int __b) {
2456 return vec_cmpgt(__b, __a);
2459 static __inline__ vector bool int __ATTRS_o_ai
2460 vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2461 return vec_cmpgt(__b, __a);
2464 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2465 vector float __b) {
2466 return vec_cmpgt(__b, __a);
2469 #ifdef __VSX__
2470 static __inline__ vector bool long long __ATTRS_o_ai
2471 vec_cmplt(vector double __a, vector double __b) {
2472 return vec_cmpgt(__b, __a);
2474 #endif
2476 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2477 static __inline__ vector bool __int128 __ATTRS_o_ai
2478 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) {
2479 return vec_cmpgt(__b, __a);
2482 static __inline__ vector bool __int128 __ATTRS_o_ai
2483 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2484 return vec_cmpgt(__b, __a);
2486 #endif
2488 #ifdef __VSX__
2489 static __inline__ vector bool long long __ATTRS_o_ai
2490 vec_cmplt(vector signed long long __a, vector signed long long __b) {
2491 return vec_cmpgt(__b, __a);
2494 static __inline__ vector bool long long __ATTRS_o_ai
2495 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2496 return vec_cmpgt(__b, __a);
2498 #endif
2500 #ifdef __POWER8_VECTOR__
2501 /* vec_popcnt */
2503 static __inline__ vector unsigned char __ATTRS_o_ai
2504 vec_popcnt(vector signed char __a) {
2505 return (vector unsigned char)__builtin_altivec_vpopcntb(
2506 (vector unsigned char)__a);
2508 static __inline__ vector unsigned char __ATTRS_o_ai
2509 vec_popcnt(vector unsigned char __a) {
2510 return __builtin_altivec_vpopcntb(__a);
2512 static __inline__ vector unsigned short __ATTRS_o_ai
2513 vec_popcnt(vector signed short __a) {
2514 return (vector unsigned short)__builtin_altivec_vpopcnth(
2515 (vector unsigned short)__a);
2517 static __inline__ vector unsigned short __ATTRS_o_ai
2518 vec_popcnt(vector unsigned short __a) {
2519 return __builtin_altivec_vpopcnth(__a);
2521 static __inline__ vector unsigned int __ATTRS_o_ai
2522 vec_popcnt(vector signed int __a) {
2523 return __builtin_altivec_vpopcntw((vector unsigned int)__a);
2525 static __inline__ vector unsigned int __ATTRS_o_ai
2526 vec_popcnt(vector unsigned int __a) {
2527 return __builtin_altivec_vpopcntw(__a);
2529 static __inline__ vector unsigned long long __ATTRS_o_ai
2530 vec_popcnt(vector signed long long __a) {
2531 return __builtin_altivec_vpopcntd((vector unsigned long long)__a);
2533 static __inline__ vector unsigned long long __ATTRS_o_ai
2534 vec_popcnt(vector unsigned long long __a) {
2535 return __builtin_altivec_vpopcntd(__a);
2538 #define vec_vclz vec_cntlz
2539 /* vec_cntlz */
2541 static __inline__ vector signed char __ATTRS_o_ai
2542 vec_cntlz(vector signed char __a) {
2543 return (vector signed char)__builtin_altivec_vclzb((vector unsigned char)__a);
2545 static __inline__ vector unsigned char __ATTRS_o_ai
2546 vec_cntlz(vector unsigned char __a) {
2547 return __builtin_altivec_vclzb(__a);
2549 static __inline__ vector signed short __ATTRS_o_ai
2550 vec_cntlz(vector signed short __a) {
2551 return (vector signed short)__builtin_altivec_vclzh(
2552 (vector unsigned short)__a);
2554 static __inline__ vector unsigned short __ATTRS_o_ai
2555 vec_cntlz(vector unsigned short __a) {
2556 return __builtin_altivec_vclzh(__a);
2558 static __inline__ vector signed int __ATTRS_o_ai
2559 vec_cntlz(vector signed int __a) {
2560 return (vector signed int)__builtin_altivec_vclzw((vector unsigned int)__a);
2562 static __inline__ vector unsigned int __ATTRS_o_ai
2563 vec_cntlz(vector unsigned int __a) {
2564 return __builtin_altivec_vclzw(__a);
2566 static __inline__ vector signed long long __ATTRS_o_ai
2567 vec_cntlz(vector signed long long __a) {
2568 return (vector signed long long)__builtin_altivec_vclzd(
2569 (vector unsigned long long)__a);
2571 static __inline__ vector unsigned long long __ATTRS_o_ai
2572 vec_cntlz(vector unsigned long long __a) {
2573 return __builtin_altivec_vclzd(__a);
2575 #endif
2577 #ifdef __POWER9_VECTOR__
2579 /* vec_cnttz */
2581 static __inline__ vector signed char __ATTRS_o_ai
2582 vec_cnttz(vector signed char __a) {
2583 return (vector signed char)__builtin_altivec_vctzb((vector unsigned char)__a);
2585 static __inline__ vector unsigned char __ATTRS_o_ai
2586 vec_cnttz(vector unsigned char __a) {
2587 return __builtin_altivec_vctzb(__a);
2589 static __inline__ vector signed short __ATTRS_o_ai
2590 vec_cnttz(vector signed short __a) {
2591 return (vector signed short)__builtin_altivec_vctzh(
2592 (vector unsigned short)__a);
2594 static __inline__ vector unsigned short __ATTRS_o_ai
2595 vec_cnttz(vector unsigned short __a) {
2596 return __builtin_altivec_vctzh(__a);
2598 static __inline__ vector signed int __ATTRS_o_ai
2599 vec_cnttz(vector signed int __a) {
2600 return (vector signed int)__builtin_altivec_vctzw((vector unsigned int)__a);
2602 static __inline__ vector unsigned int __ATTRS_o_ai
2603 vec_cnttz(vector unsigned int __a) {
2604 return __builtin_altivec_vctzw(__a);
2606 static __inline__ vector signed long long __ATTRS_o_ai
2607 vec_cnttz(vector signed long long __a) {
2608 return (vector signed long long)__builtin_altivec_vctzd(
2609 (vector unsigned long long)__a);
2611 static __inline__ vector unsigned long long __ATTRS_o_ai
2612 vec_cnttz(vector unsigned long long __a) {
2613 return __builtin_altivec_vctzd(__a);
2616 /* vec_first_match_index */
2618 static __inline__ unsigned __ATTRS_o_ai
2619 vec_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;
2629 return __res[0] >> 3;
2632 static __inline__ unsigned __ATTRS_o_ai
2633 vec_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;
2643 return __res[0] >> 3;
2646 static __inline__ unsigned __ATTRS_o_ai
2647 vec_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;
2657 return __res[0] >> 4;
2660 static __inline__ unsigned __ATTRS_o_ai
2661 vec_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;
2671 return __res[0] >> 4;
2674 static __inline__ unsigned __ATTRS_o_ai
2675 vec_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;
2685 return __res[0] >> 5;
2688 static __inline__ unsigned __ATTRS_o_ai
2689 vec_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;
2699 return __res[0] >> 5;
2702 /* vec_first_match_or_eos_index */
2704 static __inline__ unsigned __ATTRS_o_ai
2705 vec_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.
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);
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;
2724 return __res[0] >> 3;
2727 static __inline__ unsigned __ATTRS_o_ai
2728 vec_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);
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;
2744 return __res[0] >> 3;
2747 static __inline__ unsigned __ATTRS_o_ai
2748 vec_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);
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;
2763 return __res[0] >> 4;
2766 static __inline__ unsigned __ATTRS_o_ai
2767 vec_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);
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;
2783 return __res[0] >> 4;
2786 static __inline__ unsigned __ATTRS_o_ai
2787 vec_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);
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;
2801 return __res[0] >> 5;
2804 static __inline__ unsigned __ATTRS_o_ai
2805 vec_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);
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;
2820 return __res[0] >> 5;
2823 /* vec_first_mismatch_index */
2825 static __inline__ unsigned __ATTRS_o_ai
2826 vec_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;
2836 return __res[0] >> 3;
2839 static __inline__ unsigned __ATTRS_o_ai
2840 vec_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;
2850 return __res[0] >> 3;
2853 static __inline__ unsigned __ATTRS_o_ai
2854 vec_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;
2864 return __res[0] >> 4;
2867 static __inline__ unsigned __ATTRS_o_ai
2868 vec_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;
2878 return __res[0] >> 4;
2881 static __inline__ unsigned __ATTRS_o_ai
2882 vec_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;
2892 return __res[0] >> 5;
2895 static __inline__ unsigned __ATTRS_o_ai
2896 vec_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;
2906 return __res[0] >> 5;
2909 /* vec_first_mismatch_or_eos_index */
2911 static __inline__ unsigned __ATTRS_o_ai
2912 vec_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;
2923 return __res[0] >> 3;
2926 static __inline__ unsigned __ATTRS_o_ai
2927 vec_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;
2938 return __res[0] >> 3;
2941 static __inline__ unsigned __ATTRS_o_ai
2942 vec_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;
2953 return __res[0] >> 4;
2956 static __inline__ unsigned __ATTRS_o_ai
2957 vec_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;
2968 return __res[0] >> 4;
2971 static __inline__ unsigned __ATTRS_o_ai
2972 vec_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;
2982 return __res[0] >> 5;
2985 static __inline__ unsigned __ATTRS_o_ai
2986 vec_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;
2997 return __res[0] >> 5;
3000 static __inline__ vector double __ATTRS_o_ai
3001 vec_insert_exp(vector double __a, vector unsigned long long __b) {
3002 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
3005 static __inline__ vector double __ATTRS_o_ai
3006 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
3007 return __builtin_vsx_xviexpdp(__a,__b);
3010 static __inline__ vector float __ATTRS_o_ai
3011 vec_insert_exp(vector float __a, vector unsigned int __b) {
3012 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
3015 static __inline__ vector float __ATTRS_o_ai
3016 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
3017 return __builtin_vsx_xviexpsp(__a,__b);
3020 #if defined(__powerpc64__)
3021 static __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));
3026 static __inline__ vector unsigned char __ATTRS_o_ai
3027 vec_xl_len(const unsigned char *__a, size_t __b) {
3028 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
3031 static __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));
3036 static __inline__ vector unsigned short __ATTRS_o_ai
3037 vec_xl_len(const unsigned short *__a, size_t __b) {
3038 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
3041 static __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));
3046 static __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));
3051 static __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));
3055 #ifdef __SIZEOF_INT128__
3056 static __inline__ vector signed __int128 __ATTRS_o_ai
3057 vec_xl_len(const signed __int128 *__a, size_t __b) {
3058 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3061 static __inline__ vector unsigned __int128 __ATTRS_o_ai
3062 vec_xl_len(const unsigned __int128 *__a, size_t __b) {
3063 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3065 #endif
3067 static __inline__ vector signed long long __ATTRS_o_ai
3068 vec_xl_len(const signed long long *__a, size_t __b) {
3069 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
3072 static __inline__ vector unsigned long long __ATTRS_o_ai
3073 vec_xl_len(const unsigned long long *__a, size_t __b) {
3074 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
3077 static __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));
3082 static __inline__ vector unsigned char __ATTRS_o_ai
3083 vec_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);
3092 // vec_xst_len
3093 static __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));
3099 static __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));
3104 static __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));
3109 static __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));
3115 static __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));
3120 static __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));
3125 static __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));
3130 #ifdef __SIZEOF_INT128__
3131 static __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));
3137 static __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));
3142 #endif
3144 static __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));
3150 static __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));
3156 static __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));
3161 static __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));
3171 #endif
3172 #endif
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
3183 /* vec_cpsgn */
3185 #ifdef __VSX__
3186 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
3187 vector float __b) {
3188 return __builtin_vsx_xvcpsgnsp(__b, __a);
3191 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
3192 vector double __b) {
3193 return __builtin_vsx_xvcpsgndp(__b, __a);
3195 #endif
3197 /* vec_ctf */
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( \
3206 (__a), vector int \
3207 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3208 vector unsigned int \
3209 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3210 (__b)), \
3211 vector unsigned long long \
3212 : (vector float)(__builtin_vsx_xvcvuxdsp( \
3213 (vector unsigned long long)(__a)) * \
3214 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \
3215 vector signed long long \
3216 : (vector float)(__builtin_vsx_xvcvsxdsp( \
3217 (vector signed long long)(__a)) * \
3218 (vector float)(vector unsigned)((0x7f - (__b)) << 23)))
3219 #else // __XL_COMPAT_ALTIVEC__
3220 #define vec_ctf(__a, __b) \
3221 _Generic( \
3222 (__a), vector int \
3223 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3224 vector unsigned int \
3225 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3226 (__b)), \
3227 vector unsigned long long \
3228 : (vector float)(__builtin_convertvector( \
3229 (vector unsigned long long)(__a), vector double) * \
3230 (vector double)(vector unsigned long long)((0x3ffULL - \
3231 (__b)) \
3232 << 52)), \
3233 vector signed long long \
3234 : (vector float)(__builtin_convertvector((vector signed long long)(__a), \
3235 vector double) * \
3236 (vector double)(vector unsigned long long)((0x3ffULL - \
3237 (__b)) \
3238 << 52)))
3239 #endif // __XL_COMPAT_ALTIVEC__
3240 #else
3241 #define vec_ctf(__a, __b) \
3242 _Generic((__a), vector int \
3243 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3244 vector unsigned int \
3245 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3246 (__b)))
3247 #endif
3249 /* vec_ctd */
3250 #ifdef __VSX__
3251 #define vec_ctd(__a, __b) \
3252 _Generic((__a), vector signed int \
3253 : (vec_doublee((vector signed int)(__a)) * \
3254 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3255 << 52)), \
3256 vector unsigned int \
3257 : (vec_doublee((vector unsigned int)(__a)) * \
3258 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3259 << 52)), \
3260 vector unsigned long long \
3261 : (__builtin_convertvector((vector unsigned long long)(__a), \
3262 vector double) * \
3263 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3264 << 52)), \
3265 vector signed long long \
3266 : (__builtin_convertvector((vector signed long long)(__a), \
3267 vector double) * \
3268 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3269 << 52)))
3270 #endif // __VSX__
3272 /* vec_vcfsx */
3274 #define vec_vcfux __builtin_altivec_vcfux
3275 /* vec_vcfux */
3277 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
3279 /* vec_cts */
3281 #ifdef __VSX__
3282 #ifdef __XL_COMPAT_ALTIVEC__
3283 #define vec_cts(__a, __b) \
3284 _Generic((__a), vector float \
3285 : (vector signed int)__builtin_altivec_vctsxs((vector float)(__a), \
3286 (__b)), \
3287 vector double \
3288 : __extension__({ \
3289 vector double __ret = \
3290 (vector double)(__a) * \
3291 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3292 << 52); \
3293 (vector signed long long)__builtin_vsx_xvcvdpsxws(__ret); \
3295 #else // __XL_COMPAT_ALTIVEC__
3296 #define vec_cts(__a, __b) \
3297 _Generic((__a), vector float \
3298 : (vector signed int)__builtin_altivec_vctsxs((vector float)(__a), \
3299 (__b)), \
3300 vector double \
3301 : __extension__({ \
3302 vector double __ret = \
3303 (vector double)(__a) * \
3304 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3305 << 52); \
3306 (vector signed long long)__builtin_convertvector( \
3307 __ret, vector signed long long); \
3309 #endif // __XL_COMPAT_ALTIVEC__
3310 #else
3311 #define vec_cts __builtin_altivec_vctsxs
3312 #endif
3314 /* vec_vctsxs */
3316 #define vec_vctsxs __builtin_altivec_vctsxs
3318 /* vec_ctu */
3320 #ifdef __VSX__
3321 #ifdef __XL_COMPAT_ALTIVEC__
3322 #define vec_ctu(__a, __b) \
3323 _Generic((__a), vector float \
3324 : (vector unsigned int)__builtin_altivec_vctuxs( \
3325 (vector float)(__a), (__b)), \
3326 vector double \
3327 : __extension__({ \
3328 vector double __ret = \
3329 (vector double)(__a) * \
3330 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3331 << 52); \
3332 (vector unsigned long long)__builtin_vsx_xvcvdpuxws(__ret); \
3334 #else // __XL_COMPAT_ALTIVEC__
3335 #define vec_ctu(__a, __b) \
3336 _Generic((__a), vector float \
3337 : (vector unsigned int)__builtin_altivec_vctuxs( \
3338 (vector float)(__a), (__b)), \
3339 vector double \
3340 : __extension__({ \
3341 vector double __ret = \
3342 (vector double)(__a) * \
3343 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3344 << 52); \
3345 (vector unsigned long long)__builtin_convertvector( \
3346 __ret, vector unsigned long long); \
3348 #endif // __XL_COMPAT_ALTIVEC__
3349 #else
3350 #define vec_ctu __builtin_altivec_vctuxs
3351 #endif
3353 #ifdef __LITTLE_ENDIAN__
3354 /* vec_ctsl */
3356 #ifdef __VSX__
3357 #define vec_ctsl(__a, __b) \
3358 _Generic((__a), vector float \
3359 : __extension__({ \
3360 vector float __ret = \
3361 (vector float)(__a) * \
3362 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3363 __builtin_vsx_xvcvspsxds( \
3364 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3365 }), \
3366 vector double \
3367 : __extension__({ \
3368 vector double __ret = \
3369 (vector double)(__a) * \
3370 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3371 << 52); \
3372 __builtin_convertvector(__ret, vector signed long long); \
3375 /* vec_ctul */
3377 #define vec_ctul(__a, __b) \
3378 _Generic((__a), vector float \
3379 : __extension__({ \
3380 vector float __ret = \
3381 (vector float)(__a) * \
3382 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3383 __builtin_vsx_xvcvspuxds( \
3384 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3385 }), \
3386 vector double \
3387 : __extension__({ \
3388 vector double __ret = \
3389 (vector double)(__a) * \
3390 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3391 << 52); \
3392 __builtin_convertvector(__ret, vector unsigned long long); \
3394 #endif
3395 #else // __LITTLE_ENDIAN__
3396 /* vec_ctsl */
3398 #ifdef __VSX__
3399 #define vec_ctsl(__a, __b) \
3400 _Generic((__a), vector float \
3401 : __extension__({ \
3402 vector float __ret = \
3403 (vector float)(__a) * \
3404 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3405 __builtin_vsx_xvcvspsxds(__ret); \
3406 }), \
3407 vector double \
3408 : __extension__({ \
3409 vector double __ret = \
3410 (vector double)(__a) * \
3411 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3412 << 52); \
3413 __builtin_convertvector(__ret, vector signed long long); \
3416 /* vec_ctul */
3418 #define vec_ctul(__a, __b) \
3419 _Generic((__a), vector float \
3420 : __extension__({ \
3421 vector float __ret = \
3422 (vector float)(__a) * \
3423 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3424 __builtin_vsx_xvcvspuxds(__ret); \
3425 }), \
3426 vector double \
3427 : __extension__({ \
3428 vector double __ret = \
3429 (vector double)(__a) * \
3430 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3431 << 52); \
3432 __builtin_convertvector(__ret, vector unsigned long long); \
3434 #endif
3435 #endif // __LITTLE_ENDIAN__
3437 /* vec_vctuxs */
3439 #define vec_vctuxs __builtin_altivec_vctuxs
3441 /* vec_signext */
3443 #ifdef __POWER9_VECTOR__
3444 static __inline__ vector signed int __ATTRS_o_ai
3445 vec_signexti(vector signed char __a) {
3446 return __builtin_altivec_vextsb2w(__a);
3449 static __inline__ vector signed int __ATTRS_o_ai
3450 vec_signexti(vector signed short __a) {
3451 return __builtin_altivec_vextsh2w(__a);
3454 static __inline__ vector signed long long __ATTRS_o_ai
3455 vec_signextll(vector signed char __a) {
3456 return __builtin_altivec_vextsb2d(__a);
3459 static __inline__ vector signed long long __ATTRS_o_ai
3460 vec_signextll(vector signed short __a) {
3461 return __builtin_altivec_vextsh2d(__a);
3464 static __inline__ vector signed long long __ATTRS_o_ai
3465 vec_signextll(vector signed int __a) {
3466 return __builtin_altivec_vextsw2d(__a);
3468 #endif
3470 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3471 static __inline__ vector signed __int128 __ATTRS_o_ai
3472 vec_signextq(vector signed long long __a) {
3473 return __builtin_altivec_vextsd2q(__a);
3475 #endif
3477 /* vec_signed */
3479 static __inline__ vector signed int __ATTRS_o_ai
3480 vec_sld(vector signed int, vector signed int, unsigned const int __c);
3482 static __inline__ vector signed int __ATTRS_o_ai
3483 vec_signed(vector float __a) {
3484 return __builtin_convertvector(__a, vector signed int);
3487 #ifdef __VSX__
3488 static __inline__ vector signed long long __ATTRS_o_ai
3489 vec_signed(vector double __a) {
3490 return __builtin_convertvector(__a, vector signed long long);
3493 static __inline__ vector signed int __attribute__((__always_inline__))
3494 vec_signed2(vector double __a, vector double __b) {
3495 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
3498 static __inline__ vector signed int __ATTRS_o_ai
3499 vec_signede(vector double __a) {
3500 #ifdef __LITTLE_ENDIAN__
3501 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3502 return vec_sld(__ret, __ret, 12);
3503 #else
3504 return __builtin_vsx_xvcvdpsxws(__a);
3505 #endif
3508 static __inline__ vector signed int __ATTRS_o_ai
3509 vec_signedo(vector double __a) {
3510 #ifdef __LITTLE_ENDIAN__
3511 return __builtin_vsx_xvcvdpsxws(__a);
3512 #else
3513 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3514 return vec_sld(__ret, __ret, 12);
3515 #endif
3517 #endif
3519 /* vec_unsigned */
3521 static __inline__ vector unsigned int __ATTRS_o_ai
3522 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3524 static __inline__ vector unsigned int __ATTRS_o_ai
3525 vec_unsigned(vector float __a) {
3526 return __builtin_convertvector(__a, vector unsigned int);
3529 #ifdef __VSX__
3530 static __inline__ vector unsigned long long __ATTRS_o_ai
3531 vec_unsigned(vector double __a) {
3532 return __builtin_convertvector(__a, vector unsigned long long);
3535 static __inline__ vector unsigned int __attribute__((__always_inline__))
3536 vec_unsigned2(vector double __a, vector double __b) {
3537 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3540 static __inline__ vector unsigned int __ATTRS_o_ai
3541 vec_unsignede(vector double __a) {
3542 #ifdef __LITTLE_ENDIAN__
3543 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3544 return vec_sld(__ret, __ret, 12);
3545 #else
3546 return __builtin_vsx_xvcvdpuxws(__a);
3547 #endif
3550 static __inline__ vector unsigned int __ATTRS_o_ai
3551 vec_unsignedo(vector double __a) {
3552 #ifdef __LITTLE_ENDIAN__
3553 return __builtin_vsx_xvcvdpuxws(__a);
3554 #else
3555 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3556 return vec_sld(__ret, __ret, 12);
3557 #endif
3559 #endif
3561 /* vec_float */
3563 static __inline__ vector float __ATTRS_o_ai
3564 vec_sld(vector float, vector float, unsigned const int __c);
3566 static __inline__ vector float __ATTRS_o_ai
3567 vec_float(vector signed int __a) {
3568 return __builtin_convertvector(__a, vector float);
3571 static __inline__ vector float __ATTRS_o_ai
3572 vec_float(vector unsigned int __a) {
3573 return __builtin_convertvector(__a, vector float);
3576 #ifdef __VSX__
3577 static __inline__ vector float __ATTRS_o_ai
3578 vec_float2(vector signed long long __a, vector signed long long __b) {
3579 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3582 static __inline__ vector float __ATTRS_o_ai
3583 vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3584 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3587 static __inline__ vector float __ATTRS_o_ai
3588 vec_float2(vector double __a, vector double __b) {
3589 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3592 static __inline__ vector float __ATTRS_o_ai
3593 vec_floate(vector signed long long __a) {
3594 #ifdef __LITTLE_ENDIAN__
3595 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3596 return vec_sld(__ret, __ret, 12);
3597 #else
3598 return __builtin_vsx_xvcvsxdsp(__a);
3599 #endif
3602 static __inline__ vector float __ATTRS_o_ai
3603 vec_floate(vector unsigned long long __a) {
3604 #ifdef __LITTLE_ENDIAN__
3605 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3606 return vec_sld(__ret, __ret, 12);
3607 #else
3608 return __builtin_vsx_xvcvuxdsp(__a);
3609 #endif
3612 static __inline__ vector float __ATTRS_o_ai
3613 vec_floate(vector double __a) {
3614 #ifdef __LITTLE_ENDIAN__
3615 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3616 return vec_sld(__ret, __ret, 12);
3617 #else
3618 return __builtin_vsx_xvcvdpsp(__a);
3619 #endif
3622 static __inline__ vector float __ATTRS_o_ai
3623 vec_floato(vector signed long long __a) {
3624 #ifdef __LITTLE_ENDIAN__
3625 return __builtin_vsx_xvcvsxdsp(__a);
3626 #else
3627 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3628 return vec_sld(__ret, __ret, 12);
3629 #endif
3632 static __inline__ vector float __ATTRS_o_ai
3633 vec_floato(vector unsigned long long __a) {
3634 #ifdef __LITTLE_ENDIAN__
3635 return __builtin_vsx_xvcvuxdsp(__a);
3636 #else
3637 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3638 return vec_sld(__ret, __ret, 12);
3639 #endif
3642 static __inline__ vector float __ATTRS_o_ai
3643 vec_floato(vector double __a) {
3644 #ifdef __LITTLE_ENDIAN__
3645 return __builtin_vsx_xvcvdpsp(__a);
3646 #else
3647 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3648 return vec_sld(__ret, __ret, 12);
3649 #endif
3651 #endif
3653 /* vec_double */
3655 #ifdef __VSX__
3656 static __inline__ vector double __ATTRS_o_ai
3657 vec_double(vector signed long long __a) {
3658 return __builtin_convertvector(__a, vector double);
3661 static __inline__ vector double __ATTRS_o_ai
3662 vec_double(vector unsigned long long __a) {
3663 return __builtin_convertvector(__a, vector double);
3666 static __inline__ vector double __ATTRS_o_ai
3667 vec_doublee(vector signed int __a) {
3668 #ifdef __LITTLE_ENDIAN__
3669 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3670 #else
3671 return __builtin_vsx_xvcvsxwdp(__a);
3672 #endif
3675 static __inline__ vector double __ATTRS_o_ai
3676 vec_doublee(vector unsigned int __a) {
3677 #ifdef __LITTLE_ENDIAN__
3678 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3679 #else
3680 return __builtin_vsx_xvcvuxwdp(__a);
3681 #endif
3684 static __inline__ vector double __ATTRS_o_ai
3685 vec_doublee(vector float __a) {
3686 #ifdef __LITTLE_ENDIAN__
3687 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3688 #else
3689 return __builtin_vsx_xvcvspdp(__a);
3690 #endif
3693 static __inline__ vector double __ATTRS_o_ai
3694 vec_doubleh(vector signed int __a) {
3695 vector double __ret = {__a[0], __a[1]};
3696 return __ret;
3699 static __inline__ vector double __ATTRS_o_ai
3700 vec_doubleh(vector unsigned int __a) {
3701 vector double __ret = {__a[0], __a[1]};
3702 return __ret;
3705 static __inline__ vector double __ATTRS_o_ai
3706 vec_doubleh(vector float __a) {
3707 vector double __ret = {__a[0], __a[1]};
3708 return __ret;
3711 static __inline__ vector double __ATTRS_o_ai
3712 vec_doublel(vector signed int __a) {
3713 vector double __ret = {__a[2], __a[3]};
3714 return __ret;
3717 static __inline__ vector double __ATTRS_o_ai
3718 vec_doublel(vector unsigned int __a) {
3719 vector double __ret = {__a[2], __a[3]};
3720 return __ret;
3723 static __inline__ vector double __ATTRS_o_ai
3724 vec_doublel(vector float __a) {
3725 vector double __ret = {__a[2], __a[3]};
3726 return __ret;
3729 static __inline__ vector double __ATTRS_o_ai
3730 vec_doubleo(vector signed int __a) {
3731 #ifdef __LITTLE_ENDIAN__
3732 return __builtin_vsx_xvcvsxwdp(__a);
3733 #else
3734 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3735 #endif
3738 static __inline__ vector double __ATTRS_o_ai
3739 vec_doubleo(vector unsigned int __a) {
3740 #ifdef __LITTLE_ENDIAN__
3741 return __builtin_vsx_xvcvuxwdp(__a);
3742 #else
3743 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3744 #endif
3747 static __inline__ vector double __ATTRS_o_ai
3748 vec_doubleo(vector float __a) {
3749 #ifdef __LITTLE_ENDIAN__
3750 return __builtin_vsx_xvcvspdp(__a);
3751 #else
3752 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3753 #endif
3756 /* vec_cvf */
3757 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) {
3758 return vec_doublee(__a);
3761 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) {
3762 return vec_floate(__a);
3764 #endif
3766 /* vec_div */
3768 /* Integer vector divides (vectors are scalarized, elements divided
3769 and the vectors reassembled).
3771 static __inline__ vector signed char __ATTRS_o_ai
3772 vec_div(vector signed char __a, vector signed char __b) {
3773 return __a / __b;
3776 static __inline__ vector unsigned char __ATTRS_o_ai
3777 vec_div(vector unsigned char __a, vector unsigned char __b) {
3778 return __a / __b;
3781 static __inline__ vector signed short __ATTRS_o_ai
3782 vec_div(vector signed short __a, vector signed short __b) {
3783 return __a / __b;
3786 static __inline__ vector unsigned short __ATTRS_o_ai
3787 vec_div(vector unsigned short __a, vector unsigned short __b) {
3788 return __a / __b;
3791 static __inline__ vector signed int __ATTRS_o_ai
3792 vec_div(vector signed int __a, vector signed int __b) {
3793 return __a / __b;
3796 static __inline__ vector unsigned int __ATTRS_o_ai
3797 vec_div(vector unsigned int __a, vector unsigned int __b) {
3798 return __a / __b;
3801 #ifdef __VSX__
3802 static __inline__ vector signed long long __ATTRS_o_ai
3803 vec_div(vector signed long long __a, vector signed long long __b) {
3804 return __a / __b;
3807 static __inline__ vector unsigned long long __ATTRS_o_ai
3808 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3809 return __a / __b;
3812 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3813 vector float __b) {
3814 return __a / __b;
3817 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3818 vector double __b) {
3819 return __a / __b;
3821 #endif
3823 /* vec_dive */
3825 #ifdef __POWER10_VECTOR__
3826 static __inline__ vector signed int __ATTRS_o_ai
3827 vec_dive(vector signed int __a, vector signed int __b) {
3828 return __builtin_altivec_vdivesw(__a, __b);
3831 static __inline__ vector unsigned int __ATTRS_o_ai
3832 vec_dive(vector unsigned int __a, vector unsigned int __b) {
3833 return __builtin_altivec_vdiveuw(__a, __b);
3836 static __inline__ vector signed long long __ATTRS_o_ai
3837 vec_dive(vector signed long long __a, vector signed long long __b) {
3838 return __builtin_altivec_vdivesd(__a, __b);
3841 static __inline__ vector unsigned long long __ATTRS_o_ai
3842 vec_dive(vector unsigned long long __a, vector unsigned long long __b) {
3843 return __builtin_altivec_vdiveud(__a, __b);
3846 #ifdef __SIZEOF_INT128__
3847 static __inline__ vector unsigned __int128 __ATTRS_o_ai
3848 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3849 return __builtin_altivec_vdiveuq(__a, __b);
3852 static __inline__ vector signed __int128 __ATTRS_o_ai
3853 vec_dive(vector signed __int128 __a, vector signed __int128 __b) {
3854 return __builtin_altivec_vdivesq(__a, __b);
3856 #endif
3857 #endif
3859 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3860 static __inline__ vector unsigned __int128 __ATTRS_o_ai
3861 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3862 return __a / __b;
3865 static __inline__ vector signed __int128 __ATTRS_o_ai
3866 vec_div(vector signed __int128 __a, vector signed __int128 __b) {
3867 return __a / __b;
3869 #endif /* __POWER10_VECTOR__ */
3871 /* vec_xvtdiv */
3873 #ifdef __VSX__
3874 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a,
3875 vector double __b) {
3876 return __builtin_vsx_xvtdivdp(__a, __b);
3879 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a,
3880 vector float __b) {
3881 return __builtin_vsx_xvtdivsp(__a, __b);
3883 #endif
3885 /* vec_dss */
3887 #define vec_dss __builtin_altivec_dss
3889 /* vec_dssall */
3891 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3892 __builtin_altivec_dssall();
3895 /* vec_dst */
3896 #define vec_dst(__PTR, __CW, __STR) \
3897 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3899 /* vec_dstst */
3900 #define vec_dstst(__PTR, __CW, __STR) \
3901 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3903 /* vec_dststt */
3904 #define vec_dststt(__PTR, __CW, __STR) \
3905 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3907 /* vec_dstt */
3908 #define vec_dstt(__PTR, __CW, __STR) \
3909 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3911 /* vec_eqv */
3913 #ifdef __POWER8_VECTOR__
3914 static __inline__ vector signed char __ATTRS_o_ai
3915 vec_eqv(vector signed char __a, vector signed char __b) {
3916 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3917 (vector unsigned int)__b);
3920 static __inline__ vector unsigned char __ATTRS_o_ai
3921 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3922 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3923 (vector unsigned int)__b);
3926 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3927 vector bool char __b) {
3928 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3929 (vector unsigned int)__b);
3932 static __inline__ vector signed short __ATTRS_o_ai
3933 vec_eqv(vector signed short __a, vector signed short __b) {
3934 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3935 (vector unsigned int)__b);
3938 static __inline__ vector unsigned short __ATTRS_o_ai
3939 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3940 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3941 (vector unsigned int)__b);
3944 static __inline__ vector bool short __ATTRS_o_ai
3945 vec_eqv(vector bool short __a, vector bool short __b) {
3946 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3947 (vector unsigned int)__b);
3950 static __inline__ vector signed int __ATTRS_o_ai
3951 vec_eqv(vector signed int __a, vector signed int __b) {
3952 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3953 (vector unsigned int)__b);
3956 static __inline__ vector unsigned int __ATTRS_o_ai
3957 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3958 return __builtin_vsx_xxleqv(__a, __b);
3961 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3962 vector bool int __b) {
3963 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3964 (vector unsigned int)__b);
3967 static __inline__ vector signed long long __ATTRS_o_ai
3968 vec_eqv(vector signed long long __a, vector signed long long __b) {
3969 return (vector signed long long)__builtin_vsx_xxleqv(
3970 (vector unsigned int)__a, (vector unsigned int)__b);
3973 static __inline__ vector unsigned long long __ATTRS_o_ai
3974 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3975 return (vector unsigned long long)__builtin_vsx_xxleqv(
3976 (vector unsigned int)__a, (vector unsigned int)__b);
3979 static __inline__ vector bool long long __ATTRS_o_ai
3980 vec_eqv(vector bool long long __a, vector bool long long __b) {
3981 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3982 (vector unsigned int)__b);
3985 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3986 vector float __b) {
3987 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3988 (vector unsigned int)__b);
3991 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3992 vector double __b) {
3993 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3994 (vector unsigned int)__b);
3996 #endif
3998 /* vec_expte */
4000 static __inline__ vector float __attribute__((__always_inline__))
4001 vec_expte(vector float __a) {
4002 return __builtin_altivec_vexptefp(__a);
4005 /* vec_vexptefp */
4007 static __inline__ vector float __attribute__((__always_inline__))
4008 vec_vexptefp(vector float __a) {
4009 return __builtin_altivec_vexptefp(__a);
4012 /* vec_floor */
4014 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
4015 #ifdef __VSX__
4016 return __builtin_vsx_xvrspim(__a);
4017 #else
4018 return __builtin_altivec_vrfim(__a);
4019 #endif
4022 #ifdef __VSX__
4023 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
4024 return __builtin_vsx_xvrdpim(__a);
4026 #endif
4028 /* vec_roundm */
4029 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) {
4030 return vec_floor(__a);
4033 #ifdef __VSX__
4034 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) {
4035 return vec_floor(__a);
4037 #endif
4039 /* vec_vrfim */
4041 static __inline__ vector float __attribute__((__always_inline__))
4042 vec_vrfim(vector float __a) {
4043 return __builtin_altivec_vrfim(__a);
4046 /* vec_ld */
4048 static __inline__ vector signed char __ATTRS_o_ai
4049 vec_ld(long __a, const vector signed char *__b) {
4050 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4053 static __inline__ vector signed char __ATTRS_o_ai
4054 vec_ld(long __a, const signed char *__b) {
4055 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4058 static __inline__ vector unsigned char __ATTRS_o_ai
4059 vec_ld(long __a, const vector unsigned char *__b) {
4060 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4063 static __inline__ vector unsigned char __ATTRS_o_ai
4064 vec_ld(long __a, const unsigned char *__b) {
4065 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4068 static __inline__ vector bool char __ATTRS_o_ai
4069 vec_ld(long __a, const vector bool char *__b) {
4070 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4073 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a,
4074 const vector short *__b) {
4075 return (vector short)__builtin_altivec_lvx(__a, __b);
4078 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) {
4079 return (vector short)__builtin_altivec_lvx(__a, __b);
4082 static __inline__ vector unsigned short __ATTRS_o_ai
4083 vec_ld(long __a, const vector unsigned short *__b) {
4084 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4087 static __inline__ vector unsigned short __ATTRS_o_ai
4088 vec_ld(long __a, const unsigned short *__b) {
4089 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4092 static __inline__ vector bool short __ATTRS_o_ai
4093 vec_ld(long __a, const vector bool short *__b) {
4094 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4097 static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a,
4098 const vector pixel *__b) {
4099 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4102 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a,
4103 const vector int *__b) {
4104 return (vector int)__builtin_altivec_lvx(__a, __b);
4107 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) {
4108 return (vector int)__builtin_altivec_lvx(__a, __b);
4111 static __inline__ vector unsigned int __ATTRS_o_ai
4112 vec_ld(long __a, const vector unsigned int *__b) {
4113 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4116 static __inline__ vector unsigned int __ATTRS_o_ai
4117 vec_ld(long __a, const unsigned int *__b) {
4118 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4121 static __inline__ vector bool int __ATTRS_o_ai
4122 vec_ld(long __a, const vector bool int *__b) {
4123 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4126 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a,
4127 const vector float *__b) {
4128 return (vector float)__builtin_altivec_lvx(__a, __b);
4131 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) {
4132 return (vector float)__builtin_altivec_lvx(__a, __b);
4135 /* vec_lvx */
4137 static __inline__ vector signed char __ATTRS_o_ai
4138 vec_lvx(long __a, const vector signed char *__b) {
4139 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4142 static __inline__ vector signed char __ATTRS_o_ai
4143 vec_lvx(long __a, const signed char *__b) {
4144 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4147 static __inline__ vector unsigned char __ATTRS_o_ai
4148 vec_lvx(long __a, const vector unsigned char *__b) {
4149 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4152 static __inline__ vector unsigned char __ATTRS_o_ai
4153 vec_lvx(long __a, const unsigned char *__b) {
4154 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4157 static __inline__ vector bool char __ATTRS_o_ai
4158 vec_lvx(long __a, const vector bool char *__b) {
4159 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4162 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a,
4163 const vector short *__b) {
4164 return (vector short)__builtin_altivec_lvx(__a, __b);
4167 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) {
4168 return (vector short)__builtin_altivec_lvx(__a, __b);
4171 static __inline__ vector unsigned short __ATTRS_o_ai
4172 vec_lvx(long __a, const vector unsigned short *__b) {
4173 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4176 static __inline__ vector unsigned short __ATTRS_o_ai
4177 vec_lvx(long __a, const unsigned short *__b) {
4178 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4181 static __inline__ vector bool short __ATTRS_o_ai
4182 vec_lvx(long __a, const vector bool short *__b) {
4183 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4186 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a,
4187 const vector pixel *__b) {
4188 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4191 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a,
4192 const vector int *__b) {
4193 return (vector int)__builtin_altivec_lvx(__a, __b);
4196 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) {
4197 return (vector int)__builtin_altivec_lvx(__a, __b);
4200 static __inline__ vector unsigned int __ATTRS_o_ai
4201 vec_lvx(long __a, const vector unsigned int *__b) {
4202 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4205 static __inline__ vector unsigned int __ATTRS_o_ai
4206 vec_lvx(long __a, const unsigned int *__b) {
4207 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4210 static __inline__ vector bool int __ATTRS_o_ai
4211 vec_lvx(long __a, const vector bool int *__b) {
4212 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4215 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a,
4216 const vector float *__b) {
4217 return (vector float)__builtin_altivec_lvx(__a, __b);
4220 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) {
4221 return (vector float)__builtin_altivec_lvx(__a, __b);
4224 /* vec_lde */
4226 static __inline__ vector signed char __ATTRS_o_ai
4227 vec_lde(long __a, const signed char *__b) {
4228 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4231 static __inline__ vector unsigned char __ATTRS_o_ai
4232 vec_lde(long __a, const unsigned char *__b) {
4233 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4236 static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) {
4237 return (vector short)__builtin_altivec_lvehx(__a, __b);
4240 static __inline__ vector unsigned short __ATTRS_o_ai
4241 vec_lde(long __a, const unsigned short *__b) {
4242 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4245 static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) {
4246 return (vector int)__builtin_altivec_lvewx(__a, __b);
4249 static __inline__ vector unsigned int __ATTRS_o_ai
4250 vec_lde(long __a, const unsigned int *__b) {
4251 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4254 static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) {
4255 return (vector float)__builtin_altivec_lvewx(__a, __b);
4258 /* vec_lvebx */
4260 static __inline__ vector signed char __ATTRS_o_ai
4261 vec_lvebx(long __a, const signed char *__b) {
4262 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4265 static __inline__ vector unsigned char __ATTRS_o_ai
4266 vec_lvebx(long __a, const unsigned char *__b) {
4267 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4270 /* vec_lvehx */
4272 static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a,
4273 const short *__b) {
4274 return (vector short)__builtin_altivec_lvehx(__a, __b);
4277 static __inline__ vector unsigned short __ATTRS_o_ai
4278 vec_lvehx(long __a, const unsigned short *__b) {
4279 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4282 /* vec_lvewx */
4284 static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) {
4285 return (vector int)__builtin_altivec_lvewx(__a, __b);
4288 static __inline__ vector unsigned int __ATTRS_o_ai
4289 vec_lvewx(long __a, const unsigned int *__b) {
4290 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4293 static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a,
4294 const float *__b) {
4295 return (vector float)__builtin_altivec_lvewx(__a, __b);
4298 /* vec_ldl */
4300 static __inline__ vector signed char __ATTRS_o_ai
4301 vec_ldl(long __a, const vector signed char *__b) {
4302 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4305 static __inline__ vector signed char __ATTRS_o_ai
4306 vec_ldl(long __a, const signed char *__b) {
4307 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4310 static __inline__ vector unsigned char __ATTRS_o_ai
4311 vec_ldl(long __a, const vector unsigned char *__b) {
4312 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4315 static __inline__ vector unsigned char __ATTRS_o_ai
4316 vec_ldl(long __a, const unsigned char *__b) {
4317 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4320 static __inline__ vector bool char __ATTRS_o_ai
4321 vec_ldl(long __a, const vector bool char *__b) {
4322 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4325 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a,
4326 const vector short *__b) {
4327 return (vector short)__builtin_altivec_lvxl(__a, __b);
4330 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) {
4331 return (vector short)__builtin_altivec_lvxl(__a, __b);
4334 static __inline__ vector unsigned short __ATTRS_o_ai
4335 vec_ldl(long __a, const vector unsigned short *__b) {
4336 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4339 static __inline__ vector unsigned short __ATTRS_o_ai
4340 vec_ldl(long __a, const unsigned short *__b) {
4341 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4344 static __inline__ vector bool short __ATTRS_o_ai
4345 vec_ldl(long __a, const vector bool short *__b) {
4346 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4349 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a,
4350 const vector pixel *__b) {
4351 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
4354 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a,
4355 const vector int *__b) {
4356 return (vector int)__builtin_altivec_lvxl(__a, __b);
4359 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) {
4360 return (vector int)__builtin_altivec_lvxl(__a, __b);
4363 static __inline__ vector unsigned int __ATTRS_o_ai
4364 vec_ldl(long __a, const vector unsigned int *__b) {
4365 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4368 static __inline__ vector unsigned int __ATTRS_o_ai
4369 vec_ldl(long __a, const unsigned int *__b) {
4370 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4373 static __inline__ vector bool int __ATTRS_o_ai
4374 vec_ldl(long __a, const vector bool int *__b) {
4375 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4378 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a,
4379 const vector float *__b) {
4380 return (vector float)__builtin_altivec_lvxl(__a, __b);
4383 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) {
4384 return (vector float)__builtin_altivec_lvxl(__a, __b);
4387 /* vec_lvxl */
4389 static __inline__ vector signed char __ATTRS_o_ai
4390 vec_lvxl(long __a, const vector signed char *__b) {
4391 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4394 static __inline__ vector signed char __ATTRS_o_ai
4395 vec_lvxl(long __a, const signed char *__b) {
4396 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4399 static __inline__ vector unsigned char __ATTRS_o_ai
4400 vec_lvxl(long __a, const vector unsigned char *__b) {
4401 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4404 static __inline__ vector unsigned char __ATTRS_o_ai
4405 vec_lvxl(long __a, const unsigned char *__b) {
4406 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4409 static __inline__ vector bool char __ATTRS_o_ai
4410 vec_lvxl(long __a, const vector bool char *__b) {
4411 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4414 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4415 const vector short *__b) {
4416 return (vector short)__builtin_altivec_lvxl(__a, __b);
4419 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4420 const short *__b) {
4421 return (vector short)__builtin_altivec_lvxl(__a, __b);
4424 static __inline__ vector unsigned short __ATTRS_o_ai
4425 vec_lvxl(long __a, const vector unsigned short *__b) {
4426 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4429 static __inline__ vector unsigned short __ATTRS_o_ai
4430 vec_lvxl(long __a, const unsigned short *__b) {
4431 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4434 static __inline__ vector bool short __ATTRS_o_ai
4435 vec_lvxl(long __a, const vector bool short *__b) {
4436 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4439 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a,
4440 const vector pixel *__b) {
4441 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
4444 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a,
4445 const vector int *__b) {
4446 return (vector int)__builtin_altivec_lvxl(__a, __b);
4449 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) {
4450 return (vector int)__builtin_altivec_lvxl(__a, __b);
4453 static __inline__ vector unsigned int __ATTRS_o_ai
4454 vec_lvxl(long __a, const vector unsigned int *__b) {
4455 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4458 static __inline__ vector unsigned int __ATTRS_o_ai
4459 vec_lvxl(long __a, const unsigned int *__b) {
4460 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4463 static __inline__ vector bool int __ATTRS_o_ai
4464 vec_lvxl(long __a, const vector bool int *__b) {
4465 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4468 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4469 const vector float *__b) {
4470 return (vector float)__builtin_altivec_lvxl(__a, __b);
4473 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4474 const float *__b) {
4475 return (vector float)__builtin_altivec_lvxl(__a, __b);
4478 /* vec_loge */
4480 static __inline__ vector float __attribute__((__always_inline__))
4481 vec_loge(vector float __a) {
4482 return __builtin_altivec_vlogefp(__a);
4485 /* vec_vlogefp */
4487 static __inline__ vector float __attribute__((__always_inline__))
4488 vec_vlogefp(vector float __a) {
4489 return __builtin_altivec_vlogefp(__a);
4492 /* vec_lvsl */
4494 #ifdef __LITTLE_ENDIAN__
4495 static __inline__ vector unsigned char __ATTRS_o_ai
4496 __attribute__((__deprecated__("use assignment for unaligned little endian \
4497 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
4498 vector unsigned char mask =
4499 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4500 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4501 7, 6, 5, 4, 3, 2, 1, 0};
4502 return vec_perm(mask, mask, reverse);
4504 #else
4505 static __inline__ vector unsigned char __ATTRS_o_ai
4506 vec_lvsl(int __a, const signed char *__b) {
4507 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4509 #endif
4511 #ifdef __LITTLE_ENDIAN__
4512 static __inline__ vector unsigned char __ATTRS_o_ai
4513 __attribute__((__deprecated__("use assignment for unaligned little endian \
4514 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
4515 vector unsigned char mask =
4516 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4517 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4518 7, 6, 5, 4, 3, 2, 1, 0};
4519 return vec_perm(mask, mask, reverse);
4521 #else
4522 static __inline__ vector unsigned char __ATTRS_o_ai
4523 vec_lvsl(int __a, const unsigned char *__b) {
4524 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4526 #endif
4528 #ifdef __LITTLE_ENDIAN__
4529 static __inline__ vector unsigned char __ATTRS_o_ai
4530 __attribute__((__deprecated__("use assignment for unaligned little endian \
4531 loads/stores"))) vec_lvsl(int __a, const short *__b) {
4532 vector unsigned char mask =
4533 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4534 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4535 7, 6, 5, 4, 3, 2, 1, 0};
4536 return vec_perm(mask, mask, reverse);
4538 #else
4539 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4540 const short *__b) {
4541 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4543 #endif
4545 #ifdef __LITTLE_ENDIAN__
4546 static __inline__ vector unsigned char __ATTRS_o_ai
4547 __attribute__((__deprecated__("use assignment for unaligned little endian \
4548 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
4549 vector unsigned char mask =
4550 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4551 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4552 7, 6, 5, 4, 3, 2, 1, 0};
4553 return vec_perm(mask, mask, reverse);
4555 #else
4556 static __inline__ vector unsigned char __ATTRS_o_ai
4557 vec_lvsl(int __a, const unsigned short *__b) {
4558 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4560 #endif
4562 #ifdef __LITTLE_ENDIAN__
4563 static __inline__ vector unsigned char __ATTRS_o_ai
4564 __attribute__((__deprecated__("use assignment for unaligned little endian \
4565 loads/stores"))) vec_lvsl(int __a, const int *__b) {
4566 vector unsigned char mask =
4567 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4568 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4569 7, 6, 5, 4, 3, 2, 1, 0};
4570 return vec_perm(mask, mask, reverse);
4572 #else
4573 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4574 const int *__b) {
4575 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4577 #endif
4579 #ifdef __LITTLE_ENDIAN__
4580 static __inline__ vector unsigned char __ATTRS_o_ai
4581 __attribute__((__deprecated__("use assignment for unaligned little endian \
4582 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
4583 vector unsigned char mask =
4584 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4585 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4586 7, 6, 5, 4, 3, 2, 1, 0};
4587 return vec_perm(mask, mask, reverse);
4589 #else
4590 static __inline__ vector unsigned char __ATTRS_o_ai
4591 vec_lvsl(int __a, const unsigned int *__b) {
4592 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4594 #endif
4596 #ifdef __LITTLE_ENDIAN__
4597 static __inline__ vector unsigned char __ATTRS_o_ai
4598 __attribute__((__deprecated__("use assignment for unaligned little endian \
4599 loads/stores"))) vec_lvsl(int __a, const float *__b) {
4600 vector unsigned char mask =
4601 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4602 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4603 7, 6, 5, 4, 3, 2, 1, 0};
4604 return vec_perm(mask, mask, reverse);
4606 #else
4607 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4608 const float *__b) {
4609 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4611 #endif
4613 /* vec_lvsr */
4615 #ifdef __LITTLE_ENDIAN__
4616 static __inline__ vector unsigned char __ATTRS_o_ai
4617 __attribute__((__deprecated__("use assignment for unaligned little endian \
4618 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4619 vector unsigned char mask =
4620 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4621 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4622 7, 6, 5, 4, 3, 2, 1, 0};
4623 return vec_perm(mask, mask, reverse);
4625 #else
4626 static __inline__ vector unsigned char __ATTRS_o_ai
4627 vec_lvsr(int __a, const signed char *__b) {
4628 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4630 #endif
4632 #ifdef __LITTLE_ENDIAN__
4633 static __inline__ vector unsigned char __ATTRS_o_ai
4634 __attribute__((__deprecated__("use assignment for unaligned little endian \
4635 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4636 vector unsigned char mask =
4637 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4638 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4639 7, 6, 5, 4, 3, 2, 1, 0};
4640 return vec_perm(mask, mask, reverse);
4642 #else
4643 static __inline__ vector unsigned char __ATTRS_o_ai
4644 vec_lvsr(int __a, const unsigned char *__b) {
4645 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4647 #endif
4649 #ifdef __LITTLE_ENDIAN__
4650 static __inline__ vector unsigned char __ATTRS_o_ai
4651 __attribute__((__deprecated__("use assignment for unaligned little endian \
4652 loads/stores"))) vec_lvsr(int __a, const short *__b) {
4653 vector unsigned char mask =
4654 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4655 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4656 7, 6, 5, 4, 3, 2, 1, 0};
4657 return vec_perm(mask, mask, reverse);
4659 #else
4660 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4661 const short *__b) {
4662 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4664 #endif
4666 #ifdef __LITTLE_ENDIAN__
4667 static __inline__ vector unsigned char __ATTRS_o_ai
4668 __attribute__((__deprecated__("use assignment for unaligned little endian \
4669 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4670 vector unsigned char mask =
4671 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4672 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4673 7, 6, 5, 4, 3, 2, 1, 0};
4674 return vec_perm(mask, mask, reverse);
4676 #else
4677 static __inline__ vector unsigned char __ATTRS_o_ai
4678 vec_lvsr(int __a, const unsigned short *__b) {
4679 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4681 #endif
4683 #ifdef __LITTLE_ENDIAN__
4684 static __inline__ vector unsigned char __ATTRS_o_ai
4685 __attribute__((__deprecated__("use assignment for unaligned little endian \
4686 loads/stores"))) vec_lvsr(int __a, const int *__b) {
4687 vector unsigned char mask =
4688 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4689 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4690 7, 6, 5, 4, 3, 2, 1, 0};
4691 return vec_perm(mask, mask, reverse);
4693 #else
4694 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4695 const int *__b) {
4696 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4698 #endif
4700 #ifdef __LITTLE_ENDIAN__
4701 static __inline__ vector unsigned char __ATTRS_o_ai
4702 __attribute__((__deprecated__("use assignment for unaligned little endian \
4703 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4704 vector unsigned char mask =
4705 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4706 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4707 7, 6, 5, 4, 3, 2, 1, 0};
4708 return vec_perm(mask, mask, reverse);
4710 #else
4711 static __inline__ vector unsigned char __ATTRS_o_ai
4712 vec_lvsr(int __a, const unsigned int *__b) {
4713 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4715 #endif
4717 #ifdef __LITTLE_ENDIAN__
4718 static __inline__ vector unsigned char __ATTRS_o_ai
4719 __attribute__((__deprecated__("use assignment for unaligned little endian \
4720 loads/stores"))) vec_lvsr(int __a, const float *__b) {
4721 vector unsigned char mask =
4722 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4723 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4724 7, 6, 5, 4, 3, 2, 1, 0};
4725 return vec_perm(mask, mask, reverse);
4727 #else
4728 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4729 const float *__b) {
4730 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4732 #endif
4734 /* vec_madd */
4735 static __inline__ vector signed short __ATTRS_o_ai
4736 vec_mladd(vector signed short, vector signed short, vector signed short);
4737 static __inline__ vector signed short __ATTRS_o_ai
4738 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4739 static __inline__ vector signed short __ATTRS_o_ai
4740 vec_mladd(vector unsigned short, vector signed short, vector signed short);
4741 static __inline__ vector unsigned short __ATTRS_o_ai
4742 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4744 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4745 vector signed short __a, vector signed short __b, vector signed short __c) {
4746 return vec_mladd(__a, __b, __c);
4749 static __inline__ vector signed short __ATTRS_o_ai
4750 vec_madd(vector signed short __a, vector unsigned short __b,
4751 vector unsigned short __c) {
4752 return vec_mladd(__a, __b, __c);
4755 static __inline__ vector signed short __ATTRS_o_ai
4756 vec_madd(vector unsigned short __a, vector signed short __b,
4757 vector signed short __c) {
4758 return vec_mladd(__a, __b, __c);
4761 static __inline__ vector unsigned short __ATTRS_o_ai
4762 vec_madd(vector unsigned short __a, vector unsigned short __b,
4763 vector unsigned short __c) {
4764 return vec_mladd(__a, __b, __c);
4767 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4768 vector float __b,
4769 vector float __c) {
4770 #ifdef __VSX__
4771 return __builtin_vsx_xvmaddasp(__a, __b, __c);
4772 #else
4773 return __builtin_altivec_vmaddfp(__a, __b, __c);
4774 #endif
4777 #ifdef __VSX__
4778 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4779 vector double __b,
4780 vector double __c) {
4781 return __builtin_vsx_xvmaddadp(__a, __b, __c);
4783 #endif
4785 /* vec_vmaddfp */
4787 static __inline__ vector float __attribute__((__always_inline__))
4788 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4789 return __builtin_altivec_vmaddfp(__a, __b, __c);
4792 /* vec_madds */
4794 static __inline__ vector signed short __attribute__((__always_inline__))
4795 vec_madds(vector signed short __a, vector signed short __b,
4796 vector signed short __c) {
4797 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4800 /* vec_vmhaddshs */
4801 static __inline__ vector signed short __attribute__((__always_inline__))
4802 vec_vmhaddshs(vector signed short __a, vector signed short __b,
4803 vector signed short __c) {
4804 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4807 /* vec_msub */
4809 #ifdef __VSX__
4810 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4811 vector float __b,
4812 vector float __c) {
4813 return __builtin_vsx_xvmsubasp(__a, __b, __c);
4816 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4817 vector double __b,
4818 vector double __c) {
4819 return __builtin_vsx_xvmsubadp(__a, __b, __c);
4821 #endif
4823 /* vec_max */
4825 static __inline__ vector signed char __ATTRS_o_ai
4826 vec_max(vector signed char __a, vector signed char __b) {
4827 return __builtin_altivec_vmaxsb(__a, __b);
4830 static __inline__ vector signed char __ATTRS_o_ai
4831 vec_max(vector bool char __a, vector signed char __b) {
4832 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4835 static __inline__ vector signed char __ATTRS_o_ai
4836 vec_max(vector signed char __a, vector bool char __b) {
4837 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4840 static __inline__ vector unsigned char __ATTRS_o_ai
4841 vec_max(vector unsigned char __a, vector unsigned char __b) {
4842 return __builtin_altivec_vmaxub(__a, __b);
4845 static __inline__ vector unsigned char __ATTRS_o_ai
4846 vec_max(vector bool char __a, vector unsigned char __b) {
4847 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4850 static __inline__ vector unsigned char __ATTRS_o_ai
4851 vec_max(vector unsigned char __a, vector bool char __b) {
4852 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4855 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4856 vector short __b) {
4857 return __builtin_altivec_vmaxsh(__a, __b);
4860 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4861 vector short __b) {
4862 return __builtin_altivec_vmaxsh((vector short)__a, __b);
4865 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4866 vector bool short __b) {
4867 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4870 static __inline__ vector unsigned short __ATTRS_o_ai
4871 vec_max(vector unsigned short __a, vector unsigned short __b) {
4872 return __builtin_altivec_vmaxuh(__a, __b);
4875 static __inline__ vector unsigned short __ATTRS_o_ai
4876 vec_max(vector bool short __a, vector unsigned short __b) {
4877 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4880 static __inline__ vector unsigned short __ATTRS_o_ai
4881 vec_max(vector unsigned short __a, vector bool short __b) {
4882 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4885 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4886 vector int __b) {
4887 return __builtin_altivec_vmaxsw(__a, __b);
4890 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4891 vector int __b) {
4892 return __builtin_altivec_vmaxsw((vector int)__a, __b);
4895 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4896 vector bool int __b) {
4897 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4900 static __inline__ vector unsigned int __ATTRS_o_ai
4901 vec_max(vector unsigned int __a, vector unsigned int __b) {
4902 return __builtin_altivec_vmaxuw(__a, __b);
4905 static __inline__ vector unsigned int __ATTRS_o_ai
4906 vec_max(vector bool int __a, vector unsigned int __b) {
4907 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4910 static __inline__ vector unsigned int __ATTRS_o_ai
4911 vec_max(vector unsigned int __a, vector bool int __b) {
4912 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4915 #ifdef __POWER8_VECTOR__
4916 static __inline__ vector signed long long __ATTRS_o_ai
4917 vec_max(vector signed long long __a, vector signed long long __b) {
4918 return __builtin_altivec_vmaxsd(__a, __b);
4921 static __inline__ vector signed long long __ATTRS_o_ai
4922 vec_max(vector bool long long __a, vector signed long long __b) {
4923 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4926 static __inline__ vector signed long long __ATTRS_o_ai
4927 vec_max(vector signed long long __a, vector bool long long __b) {
4928 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4931 static __inline__ vector unsigned long long __ATTRS_o_ai
4932 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4933 return __builtin_altivec_vmaxud(__a, __b);
4936 static __inline__ vector unsigned long long __ATTRS_o_ai
4937 vec_max(vector bool long long __a, vector unsigned long long __b) {
4938 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4941 static __inline__ vector unsigned long long __ATTRS_o_ai
4942 vec_max(vector unsigned long long __a, vector bool long long __b) {
4943 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4945 #endif
4947 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4948 vector float __b) {
4949 #ifdef __VSX__
4950 return __builtin_vsx_xvmaxsp(__a, __b);
4951 #else
4952 return __builtin_altivec_vmaxfp(__a, __b);
4953 #endif
4956 #ifdef __VSX__
4957 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4958 vector double __b) {
4959 return __builtin_vsx_xvmaxdp(__a, __b);
4961 #endif
4963 /* vec_vmaxsb */
4965 static __inline__ vector signed char __ATTRS_o_ai
4966 vec_vmaxsb(vector signed char __a, vector signed char __b) {
4967 return __builtin_altivec_vmaxsb(__a, __b);
4970 static __inline__ vector signed char __ATTRS_o_ai
4971 vec_vmaxsb(vector bool char __a, vector signed char __b) {
4972 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4975 static __inline__ vector signed char __ATTRS_o_ai
4976 vec_vmaxsb(vector signed char __a, vector bool char __b) {
4977 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4980 /* vec_vmaxub */
4982 static __inline__ vector unsigned char __ATTRS_o_ai
4983 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4984 return __builtin_altivec_vmaxub(__a, __b);
4987 static __inline__ vector unsigned char __ATTRS_o_ai
4988 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4989 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4992 static __inline__ vector unsigned char __ATTRS_o_ai
4993 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4994 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4997 /* vec_vmaxsh */
4999 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5000 vector short __b) {
5001 return __builtin_altivec_vmaxsh(__a, __b);
5004 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
5005 vector short __b) {
5006 return __builtin_altivec_vmaxsh((vector short)__a, __b);
5009 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5010 vector bool short __b) {
5011 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
5014 /* vec_vmaxuh */
5016 static __inline__ vector unsigned short __ATTRS_o_ai
5017 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
5018 return __builtin_altivec_vmaxuh(__a, __b);
5021 static __inline__ vector unsigned short __ATTRS_o_ai
5022 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
5023 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
5026 static __inline__ vector unsigned short __ATTRS_o_ai
5027 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
5028 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
5031 /* vec_vmaxsw */
5033 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5034 vector int __b) {
5035 return __builtin_altivec_vmaxsw(__a, __b);
5038 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
5039 vector int __b) {
5040 return __builtin_altivec_vmaxsw((vector int)__a, __b);
5043 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5044 vector bool int __b) {
5045 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
5048 /* vec_vmaxuw */
5050 static __inline__ vector unsigned int __ATTRS_o_ai
5051 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
5052 return __builtin_altivec_vmaxuw(__a, __b);
5055 static __inline__ vector unsigned int __ATTRS_o_ai
5056 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
5057 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
5060 static __inline__ vector unsigned int __ATTRS_o_ai
5061 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
5062 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
5065 /* vec_vmaxfp */
5067 static __inline__ vector float __attribute__((__always_inline__))
5068 vec_vmaxfp(vector float __a, vector float __b) {
5069 #ifdef __VSX__
5070 return __builtin_vsx_xvmaxsp(__a, __b);
5071 #else
5072 return __builtin_altivec_vmaxfp(__a, __b);
5073 #endif
5076 /* vec_mergeh */
5078 static __inline__ vector signed char __ATTRS_o_ai
5079 vec_mergeh(vector signed char __a, vector signed char __b) {
5080 return vec_perm(__a, __b,
5081 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5082 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5083 0x06, 0x16, 0x07, 0x17));
5086 static __inline__ vector unsigned char __ATTRS_o_ai
5087 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
5088 return vec_perm(__a, __b,
5089 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5090 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5091 0x06, 0x16, 0x07, 0x17));
5094 static __inline__ vector bool char __ATTRS_o_ai
5095 vec_mergeh(vector bool char __a, vector bool char __b) {
5096 return vec_perm(__a, __b,
5097 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5098 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5099 0x06, 0x16, 0x07, 0x17));
5102 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
5103 vector short __b) {
5104 return vec_perm(__a, __b,
5105 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5106 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5107 0x06, 0x07, 0x16, 0x17));
5110 static __inline__ vector unsigned short __ATTRS_o_ai
5111 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
5112 return vec_perm(__a, __b,
5113 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5114 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5115 0x06, 0x07, 0x16, 0x17));
5118 static __inline__ vector bool short __ATTRS_o_ai
5119 vec_mergeh(vector bool short __a, vector bool short __b) {
5120 return vec_perm(__a, __b,
5121 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5122 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5123 0x06, 0x07, 0x16, 0x17));
5126 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
5127 vector pixel __b) {
5128 return vec_perm(__a, __b,
5129 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5130 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5131 0x06, 0x07, 0x16, 0x17));
5134 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
5135 vector int __b) {
5136 return vec_perm(__a, __b,
5137 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5138 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5139 0x14, 0x15, 0x16, 0x17));
5142 static __inline__ vector unsigned int __ATTRS_o_ai
5143 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
5144 return vec_perm(__a, __b,
5145 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5146 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5147 0x14, 0x15, 0x16, 0x17));
5150 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
5151 vector bool int __b) {
5152 return vec_perm(__a, __b,
5153 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5154 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5155 0x14, 0x15, 0x16, 0x17));
5158 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
5159 vector float __b) {
5160 return vec_perm(__a, __b,
5161 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5162 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5163 0x14, 0x15, 0x16, 0x17));
5166 #ifdef __VSX__
5167 static __inline__ vector signed long long __ATTRS_o_ai
5168 vec_mergeh(vector signed long long __a, vector signed long long __b) {
5169 return vec_perm(__a, __b,
5170 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5171 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5172 0x14, 0x15, 0x16, 0x17));
5175 static __inline__ vector signed long long __ATTRS_o_ai
5176 vec_mergeh(vector signed long long __a, vector bool long long __b) {
5177 return vec_perm(__a, (vector signed long long)__b,
5178 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5179 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5180 0x14, 0x15, 0x16, 0x17));
5183 static __inline__ vector signed long long __ATTRS_o_ai
5184 vec_mergeh(vector bool long long __a, vector signed long long __b) {
5185 return vec_perm((vector signed long long)__a, __b,
5186 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5187 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5188 0x14, 0x15, 0x16, 0x17));
5191 static __inline__ vector unsigned long long __ATTRS_o_ai
5192 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
5193 return vec_perm(__a, __b,
5194 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5195 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5196 0x14, 0x15, 0x16, 0x17));
5199 static __inline__ vector unsigned long long __ATTRS_o_ai
5200 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
5201 return vec_perm(__a, (vector unsigned long long)__b,
5202 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5203 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5204 0x14, 0x15, 0x16, 0x17));
5207 static __inline__ vector unsigned long long __ATTRS_o_ai
5208 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
5209 return vec_perm((vector unsigned long long)__a, __b,
5210 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5211 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5212 0x14, 0x15, 0x16, 0x17));
5215 static __inline__ vector bool long long __ATTRS_o_ai
5216 vec_mergeh(vector bool long long __a, vector bool long long __b) {
5217 return vec_perm(__a, __b,
5218 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5219 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5220 0x14, 0x15, 0x16, 0x17));
5223 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
5224 vector double __b) {
5225 return vec_perm(__a, __b,
5226 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5227 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5228 0x14, 0x15, 0x16, 0x17));
5230 static __inline__ vector double __ATTRS_o_ai
5231 vec_mergeh(vector double __a, vector bool long long __b) {
5232 return vec_perm(__a, (vector double)__b,
5233 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5234 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5235 0x14, 0x15, 0x16, 0x17));
5237 static __inline__ vector double __ATTRS_o_ai
5238 vec_mergeh(vector bool long long __a, vector double __b) {
5239 return vec_perm((vector double)__a, __b,
5240 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5241 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5242 0x14, 0x15, 0x16, 0x17));
5244 #endif
5246 /* vec_vmrghb */
5248 #define __builtin_altivec_vmrghb vec_vmrghb
5250 static __inline__ vector signed char __ATTRS_o_ai
5251 vec_vmrghb(vector signed char __a, vector signed char __b) {
5252 return vec_perm(__a, __b,
5253 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5254 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5255 0x06, 0x16, 0x07, 0x17));
5258 static __inline__ vector unsigned char __ATTRS_o_ai
5259 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
5260 return vec_perm(__a, __b,
5261 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5262 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5263 0x06, 0x16, 0x07, 0x17));
5266 static __inline__ vector bool char __ATTRS_o_ai
5267 vec_vmrghb(vector bool char __a, vector bool char __b) {
5268 return vec_perm(__a, __b,
5269 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5270 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5271 0x06, 0x16, 0x07, 0x17));
5274 /* vec_vmrghh */
5276 #define __builtin_altivec_vmrghh vec_vmrghh
5278 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
5279 vector short __b) {
5280 return vec_perm(__a, __b,
5281 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5282 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5283 0x06, 0x07, 0x16, 0x17));
5286 static __inline__ vector unsigned short __ATTRS_o_ai
5287 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
5288 return vec_perm(__a, __b,
5289 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5290 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5291 0x06, 0x07, 0x16, 0x17));
5294 static __inline__ vector bool short __ATTRS_o_ai
5295 vec_vmrghh(vector bool short __a, vector bool short __b) {
5296 return vec_perm(__a, __b,
5297 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5298 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5299 0x06, 0x07, 0x16, 0x17));
5302 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
5303 vector pixel __b) {
5304 return vec_perm(__a, __b,
5305 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5306 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5307 0x06, 0x07, 0x16, 0x17));
5310 /* vec_vmrghw */
5312 #define __builtin_altivec_vmrghw vec_vmrghw
5314 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
5315 vector int __b) {
5316 return vec_perm(__a, __b,
5317 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5318 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5319 0x14, 0x15, 0x16, 0x17));
5322 static __inline__ vector unsigned int __ATTRS_o_ai
5323 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
5324 return vec_perm(__a, __b,
5325 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5326 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5327 0x14, 0x15, 0x16, 0x17));
5330 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
5331 vector bool int __b) {
5332 return vec_perm(__a, __b,
5333 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5334 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5335 0x14, 0x15, 0x16, 0x17));
5338 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
5339 vector float __b) {
5340 return vec_perm(__a, __b,
5341 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5342 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5343 0x14, 0x15, 0x16, 0x17));
5346 /* vec_mergel */
5348 static __inline__ vector signed char __ATTRS_o_ai
5349 vec_mergel(vector signed char __a, vector signed char __b) {
5350 return vec_perm(__a, __b,
5351 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5352 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5353 0x0E, 0x1E, 0x0F, 0x1F));
5356 static __inline__ vector unsigned char __ATTRS_o_ai
5357 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
5358 return vec_perm(__a, __b,
5359 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5360 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5361 0x0E, 0x1E, 0x0F, 0x1F));
5364 static __inline__ vector bool char __ATTRS_o_ai
5365 vec_mergel(vector bool char __a, vector bool char __b) {
5366 return vec_perm(__a, __b,
5367 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5368 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5369 0x0E, 0x1E, 0x0F, 0x1F));
5372 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
5373 vector short __b) {
5374 return vec_perm(__a, __b,
5375 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5376 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5377 0x0E, 0x0F, 0x1E, 0x1F));
5380 static __inline__ vector unsigned short __ATTRS_o_ai
5381 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
5382 return vec_perm(__a, __b,
5383 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5384 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5385 0x0E, 0x0F, 0x1E, 0x1F));
5388 static __inline__ vector bool short __ATTRS_o_ai
5389 vec_mergel(vector bool short __a, vector bool short __b) {
5390 return vec_perm(__a, __b,
5391 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5392 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5393 0x0E, 0x0F, 0x1E, 0x1F));
5396 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
5397 vector pixel __b) {
5398 return vec_perm(__a, __b,
5399 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5400 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5401 0x0E, 0x0F, 0x1E, 0x1F));
5404 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
5405 vector int __b) {
5406 return vec_perm(__a, __b,
5407 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5408 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5409 0x1C, 0x1D, 0x1E, 0x1F));
5412 static __inline__ vector unsigned int __ATTRS_o_ai
5413 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
5414 return vec_perm(__a, __b,
5415 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5416 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5417 0x1C, 0x1D, 0x1E, 0x1F));
5420 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
5421 vector bool int __b) {
5422 return vec_perm(__a, __b,
5423 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5424 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5425 0x1C, 0x1D, 0x1E, 0x1F));
5428 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
5429 vector float __b) {
5430 return vec_perm(__a, __b,
5431 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5432 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5433 0x1C, 0x1D, 0x1E, 0x1F));
5436 #ifdef __VSX__
5437 static __inline__ vector signed long long __ATTRS_o_ai
5438 vec_mergel(vector signed long long __a, vector signed long long __b) {
5439 return vec_perm(__a, __b,
5440 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5441 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5442 0x1C, 0x1D, 0x1E, 0x1F));
5444 static __inline__ vector signed long long __ATTRS_o_ai
5445 vec_mergel(vector signed long long __a, vector bool long long __b) {
5446 return vec_perm(__a, (vector signed long long)__b,
5447 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5448 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5449 0x1C, 0x1D, 0x1E, 0x1F));
5451 static __inline__ vector signed long long __ATTRS_o_ai
5452 vec_mergel(vector bool long long __a, vector signed long long __b) {
5453 return vec_perm((vector signed long long)__a, __b,
5454 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5455 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5456 0x1C, 0x1D, 0x1E, 0x1F));
5458 static __inline__ vector unsigned long long __ATTRS_o_ai
5459 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
5460 return vec_perm(__a, __b,
5461 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5462 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5463 0x1C, 0x1D, 0x1E, 0x1F));
5465 static __inline__ vector unsigned long long __ATTRS_o_ai
5466 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
5467 return vec_perm(__a, (vector unsigned long long)__b,
5468 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5469 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5470 0x1C, 0x1D, 0x1E, 0x1F));
5472 static __inline__ vector unsigned long long __ATTRS_o_ai
5473 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
5474 return vec_perm((vector unsigned long long)__a, __b,
5475 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5476 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5477 0x1C, 0x1D, 0x1E, 0x1F));
5479 static __inline__ vector bool long long __ATTRS_o_ai
5480 vec_mergel(vector bool long long __a, vector bool long long __b) {
5481 return vec_perm(__a, __b,
5482 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5483 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5484 0x1C, 0x1D, 0x1E, 0x1F));
5486 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
5487 vector double __b) {
5488 return vec_perm(__a, __b,
5489 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5490 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5491 0x1C, 0x1D, 0x1E, 0x1F));
5493 static __inline__ vector double __ATTRS_o_ai
5494 vec_mergel(vector double __a, vector bool long long __b) {
5495 return vec_perm(__a, (vector double)__b,
5496 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5497 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5498 0x1C, 0x1D, 0x1E, 0x1F));
5500 static __inline__ vector double __ATTRS_o_ai
5501 vec_mergel(vector bool long long __a, vector double __b) {
5502 return vec_perm((vector double)__a, __b,
5503 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5504 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5505 0x1C, 0x1D, 0x1E, 0x1F));
5507 #endif
5509 /* vec_vmrglb */
5511 #define __builtin_altivec_vmrglb vec_vmrglb
5513 static __inline__ vector signed char __ATTRS_o_ai
5514 vec_vmrglb(vector signed char __a, vector signed char __b) {
5515 return vec_perm(__a, __b,
5516 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5517 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5518 0x0E, 0x1E, 0x0F, 0x1F));
5521 static __inline__ vector unsigned char __ATTRS_o_ai
5522 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
5523 return vec_perm(__a, __b,
5524 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5525 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5526 0x0E, 0x1E, 0x0F, 0x1F));
5529 static __inline__ vector bool char __ATTRS_o_ai
5530 vec_vmrglb(vector bool char __a, vector bool char __b) {
5531 return vec_perm(__a, __b,
5532 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5533 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5534 0x0E, 0x1E, 0x0F, 0x1F));
5537 /* vec_vmrglh */
5539 #define __builtin_altivec_vmrglh vec_vmrglh
5541 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
5542 vector short __b) {
5543 return vec_perm(__a, __b,
5544 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5545 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5546 0x0E, 0x0F, 0x1E, 0x1F));
5549 static __inline__ vector unsigned short __ATTRS_o_ai
5550 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
5551 return vec_perm(__a, __b,
5552 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5553 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5554 0x0E, 0x0F, 0x1E, 0x1F));
5557 static __inline__ vector bool short __ATTRS_o_ai
5558 vec_vmrglh(vector bool short __a, vector bool short __b) {
5559 return vec_perm(__a, __b,
5560 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5561 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5562 0x0E, 0x0F, 0x1E, 0x1F));
5565 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
5566 vector pixel __b) {
5567 return vec_perm(__a, __b,
5568 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5569 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5570 0x0E, 0x0F, 0x1E, 0x1F));
5573 /* vec_vmrglw */
5575 #define __builtin_altivec_vmrglw vec_vmrglw
5577 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
5578 vector int __b) {
5579 return vec_perm(__a, __b,
5580 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5581 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5582 0x1C, 0x1D, 0x1E, 0x1F));
5585 static __inline__ vector unsigned int __ATTRS_o_ai
5586 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
5587 return vec_perm(__a, __b,
5588 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5589 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5590 0x1C, 0x1D, 0x1E, 0x1F));
5593 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5594 vector bool int __b) {
5595 return vec_perm(__a, __b,
5596 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5597 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5598 0x1C, 0x1D, 0x1E, 0x1F));
5601 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5602 vector float __b) {
5603 return vec_perm(__a, __b,
5604 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5605 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5606 0x1C, 0x1D, 0x1E, 0x1F));
5609 #ifdef __POWER8_VECTOR__
5610 /* vec_mergee */
5612 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5613 vector bool int __b) {
5614 return vec_perm(__a, __b,
5615 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5616 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5617 0x18, 0x19, 0x1A, 0x1B));
5620 static __inline__ vector signed int __ATTRS_o_ai
5621 vec_mergee(vector signed int __a, vector signed int __b) {
5622 return vec_perm(__a, __b,
5623 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5624 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5625 0x18, 0x19, 0x1A, 0x1B));
5628 static __inline__ vector unsigned int __ATTRS_o_ai
5629 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5630 return vec_perm(__a, __b,
5631 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5632 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5633 0x18, 0x19, 0x1A, 0x1B));
5636 static __inline__ vector bool long long __ATTRS_o_ai
5637 vec_mergee(vector bool long long __a, vector bool long long __b) {
5638 return vec_mergeh(__a, __b);
5641 static __inline__ vector signed long long __ATTRS_o_ai
5642 vec_mergee(vector signed long long __a, vector signed long long __b) {
5643 return vec_mergeh(__a, __b);
5646 static __inline__ vector unsigned long long __ATTRS_o_ai
5647 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5648 return vec_mergeh(__a, __b);
5651 static __inline__ vector float __ATTRS_o_ai
5652 vec_mergee(vector float __a, vector float __b) {
5653 return vec_perm(__a, __b,
5654 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5655 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5656 0x18, 0x19, 0x1A, 0x1B));
5659 static __inline__ vector double __ATTRS_o_ai
5660 vec_mergee(vector double __a, vector double __b) {
5661 return vec_mergeh(__a, __b);
5664 /* vec_mergeo */
5666 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5667 vector bool int __b) {
5668 return vec_perm(__a, __b,
5669 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5670 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5671 0x1C, 0x1D, 0x1E, 0x1F));
5674 static __inline__ vector signed int __ATTRS_o_ai
5675 vec_mergeo(vector signed int __a, vector signed int __b) {
5676 return vec_perm(__a, __b,
5677 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5678 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5679 0x1C, 0x1D, 0x1E, 0x1F));
5682 static __inline__ vector unsigned int __ATTRS_o_ai
5683 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5684 return vec_perm(__a, __b,
5685 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5686 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5687 0x1C, 0x1D, 0x1E, 0x1F));
5690 static __inline__ vector bool long long __ATTRS_o_ai
5691 vec_mergeo(vector bool long long __a, vector bool long long __b) {
5692 return vec_mergel(__a, __b);
5695 static __inline__ vector signed long long __ATTRS_o_ai
5696 vec_mergeo(vector signed long long __a, vector signed long long __b) {
5697 return vec_mergel(__a, __b);
5700 static __inline__ vector unsigned long long __ATTRS_o_ai
5701 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5702 return vec_mergel(__a, __b);
5705 static __inline__ vector float __ATTRS_o_ai
5706 vec_mergeo(vector float __a, vector float __b) {
5707 return vec_perm(__a, __b,
5708 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5709 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5710 0x1C, 0x1D, 0x1E, 0x1F));
5713 static __inline__ vector double __ATTRS_o_ai
5714 vec_mergeo(vector double __a, vector double __b) {
5715 return vec_mergel(__a, __b);
5718 #endif
5720 /* vec_mfvscr */
5722 static __inline__ vector unsigned short __attribute__((__always_inline__))
5723 vec_mfvscr(void) {
5724 return __builtin_altivec_mfvscr();
5727 /* vec_min */
5729 static __inline__ vector signed char __ATTRS_o_ai
5730 vec_min(vector signed char __a, vector signed char __b) {
5731 return __builtin_altivec_vminsb(__a, __b);
5734 static __inline__ vector signed char __ATTRS_o_ai
5735 vec_min(vector bool char __a, vector signed char __b) {
5736 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5739 static __inline__ vector signed char __ATTRS_o_ai
5740 vec_min(vector signed char __a, vector bool char __b) {
5741 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5744 static __inline__ vector unsigned char __ATTRS_o_ai
5745 vec_min(vector unsigned char __a, vector unsigned char __b) {
5746 return __builtin_altivec_vminub(__a, __b);
5749 static __inline__ vector unsigned char __ATTRS_o_ai
5750 vec_min(vector bool char __a, vector unsigned char __b) {
5751 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5754 static __inline__ vector unsigned char __ATTRS_o_ai
5755 vec_min(vector unsigned char __a, vector bool char __b) {
5756 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5759 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5760 vector short __b) {
5761 return __builtin_altivec_vminsh(__a, __b);
5764 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5765 vector short __b) {
5766 return __builtin_altivec_vminsh((vector short)__a, __b);
5769 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5770 vector bool short __b) {
5771 return __builtin_altivec_vminsh(__a, (vector short)__b);
5774 static __inline__ vector unsigned short __ATTRS_o_ai
5775 vec_min(vector unsigned short __a, vector unsigned short __b) {
5776 return __builtin_altivec_vminuh(__a, __b);
5779 static __inline__ vector unsigned short __ATTRS_o_ai
5780 vec_min(vector bool short __a, vector unsigned short __b) {
5781 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5784 static __inline__ vector unsigned short __ATTRS_o_ai
5785 vec_min(vector unsigned short __a, vector bool short __b) {
5786 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5789 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5790 vector int __b) {
5791 return __builtin_altivec_vminsw(__a, __b);
5794 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5795 vector int __b) {
5796 return __builtin_altivec_vminsw((vector int)__a, __b);
5799 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5800 vector bool int __b) {
5801 return __builtin_altivec_vminsw(__a, (vector int)__b);
5804 static __inline__ vector unsigned int __ATTRS_o_ai
5805 vec_min(vector unsigned int __a, vector unsigned int __b) {
5806 return __builtin_altivec_vminuw(__a, __b);
5809 static __inline__ vector unsigned int __ATTRS_o_ai
5810 vec_min(vector bool int __a, vector unsigned int __b) {
5811 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5814 static __inline__ vector unsigned int __ATTRS_o_ai
5815 vec_min(vector unsigned int __a, vector bool int __b) {
5816 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5819 #ifdef __POWER8_VECTOR__
5820 static __inline__ vector signed long long __ATTRS_o_ai
5821 vec_min(vector signed long long __a, vector signed long long __b) {
5822 return __builtin_altivec_vminsd(__a, __b);
5825 static __inline__ vector signed long long __ATTRS_o_ai
5826 vec_min(vector bool long long __a, vector signed long long __b) {
5827 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5830 static __inline__ vector signed long long __ATTRS_o_ai
5831 vec_min(vector signed long long __a, vector bool long long __b) {
5832 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5835 static __inline__ vector unsigned long long __ATTRS_o_ai
5836 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5837 return __builtin_altivec_vminud(__a, __b);
5840 static __inline__ vector unsigned long long __ATTRS_o_ai
5841 vec_min(vector bool long long __a, vector unsigned long long __b) {
5842 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5845 static __inline__ vector unsigned long long __ATTRS_o_ai
5846 vec_min(vector unsigned long long __a, vector bool long long __b) {
5847 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5849 #endif
5851 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5852 vector float __b) {
5853 #ifdef __VSX__
5854 return __builtin_vsx_xvminsp(__a, __b);
5855 #else
5856 return __builtin_altivec_vminfp(__a, __b);
5857 #endif
5860 #ifdef __VSX__
5861 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5862 vector double __b) {
5863 return __builtin_vsx_xvmindp(__a, __b);
5865 #endif
5867 /* vec_vminsb */
5869 static __inline__ vector signed char __ATTRS_o_ai
5870 vec_vminsb(vector signed char __a, vector signed char __b) {
5871 return __builtin_altivec_vminsb(__a, __b);
5874 static __inline__ vector signed char __ATTRS_o_ai
5875 vec_vminsb(vector bool char __a, vector signed char __b) {
5876 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5879 static __inline__ vector signed char __ATTRS_o_ai
5880 vec_vminsb(vector signed char __a, vector bool char __b) {
5881 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5884 /* vec_vminub */
5886 static __inline__ vector unsigned char __ATTRS_o_ai
5887 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5888 return __builtin_altivec_vminub(__a, __b);
5891 static __inline__ vector unsigned char __ATTRS_o_ai
5892 vec_vminub(vector bool char __a, vector unsigned char __b) {
5893 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5896 static __inline__ vector unsigned char __ATTRS_o_ai
5897 vec_vminub(vector unsigned char __a, vector bool char __b) {
5898 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5901 /* vec_vminsh */
5903 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5904 vector short __b) {
5905 return __builtin_altivec_vminsh(__a, __b);
5908 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5909 vector short __b) {
5910 return __builtin_altivec_vminsh((vector short)__a, __b);
5913 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5914 vector bool short __b) {
5915 return __builtin_altivec_vminsh(__a, (vector short)__b);
5918 /* vec_vminuh */
5920 static __inline__ vector unsigned short __ATTRS_o_ai
5921 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5922 return __builtin_altivec_vminuh(__a, __b);
5925 static __inline__ vector unsigned short __ATTRS_o_ai
5926 vec_vminuh(vector bool short __a, vector unsigned short __b) {
5927 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5930 static __inline__ vector unsigned short __ATTRS_o_ai
5931 vec_vminuh(vector unsigned short __a, vector bool short __b) {
5932 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5935 /* vec_vminsw */
5937 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5938 vector int __b) {
5939 return __builtin_altivec_vminsw(__a, __b);
5942 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5943 vector int __b) {
5944 return __builtin_altivec_vminsw((vector int)__a, __b);
5947 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5948 vector bool int __b) {
5949 return __builtin_altivec_vminsw(__a, (vector int)__b);
5952 /* vec_vminuw */
5954 static __inline__ vector unsigned int __ATTRS_o_ai
5955 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5956 return __builtin_altivec_vminuw(__a, __b);
5959 static __inline__ vector unsigned int __ATTRS_o_ai
5960 vec_vminuw(vector bool int __a, vector unsigned int __b) {
5961 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5964 static __inline__ vector unsigned int __ATTRS_o_ai
5965 vec_vminuw(vector unsigned int __a, vector bool int __b) {
5966 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5969 /* vec_vminfp */
5971 static __inline__ vector float __attribute__((__always_inline__))
5972 vec_vminfp(vector float __a, vector float __b) {
5973 #ifdef __VSX__
5974 return __builtin_vsx_xvminsp(__a, __b);
5975 #else
5976 return __builtin_altivec_vminfp(__a, __b);
5977 #endif
5980 /* vec_mladd */
5982 #define __builtin_altivec_vmladduhm vec_mladd
5984 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5985 vector short __b,
5986 vector short __c) {
5987 return __a * __b + __c;
5990 static __inline__ vector short __ATTRS_o_ai vec_mladd(
5991 vector short __a, vector unsigned short __b, vector unsigned short __c) {
5992 return __a * (vector short)__b + (vector short)__c;
5995 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5996 vector short __b,
5997 vector short __c) {
5998 return (vector short)__a * __b + __c;
6001 static __inline__ vector unsigned short __ATTRS_o_ai
6002 vec_mladd(vector unsigned short __a, vector unsigned short __b,
6003 vector unsigned short __c) {
6004 return __a * __b + __c;
6007 /* vec_vmladduhm */
6009 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
6010 vector short __b,
6011 vector short __c) {
6012 return __a * __b + __c;
6015 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
6016 vector short __a, vector unsigned short __b, vector unsigned short __c) {
6017 return __a * (vector short)__b + (vector short)__c;
6020 static __inline__ vector short __ATTRS_o_ai
6021 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
6022 return (vector short)__a * __b + __c;
6025 static __inline__ vector unsigned short __ATTRS_o_ai
6026 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
6027 vector unsigned short __c) {
6028 return __a * __b + __c;
6031 /* vec_mradds */
6033 static __inline__ vector short __attribute__((__always_inline__))
6034 vec_mradds(vector short __a, vector short __b, vector short __c) {
6035 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6038 /* vec_vmhraddshs */
6040 static __inline__ vector short __attribute__((__always_inline__))
6041 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
6042 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6045 /* vec_msum */
6047 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
6048 vector unsigned char __b,
6049 vector int __c) {
6050 return __builtin_altivec_vmsummbm(__a, __b, __c);
6053 static __inline__ vector unsigned int __ATTRS_o_ai
6054 vec_msum(vector unsigned char __a, vector unsigned char __b,
6055 vector unsigned int __c) {
6056 return __builtin_altivec_vmsumubm(__a, __b, __c);
6059 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
6060 vector short __b,
6061 vector int __c) {
6062 return __builtin_altivec_vmsumshm(__a, __b, __c);
6065 static __inline__ vector unsigned int __ATTRS_o_ai
6066 vec_msum(vector unsigned short __a, vector unsigned short __b,
6067 vector unsigned int __c) {
6068 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6071 /* vec_msumc */
6073 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6074 static __inline__ vector unsigned __int128 __ATTRS_o_ai
6075 vec_msumc(vector unsigned long long __a, vector unsigned long long __b,
6076 vector unsigned __int128 __c) {
6077 return __builtin_altivec_vmsumcud(__a, __b, __c);
6079 #endif
6081 /* vec_vmsummbm */
6083 static __inline__ vector int __attribute__((__always_inline__))
6084 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
6085 return __builtin_altivec_vmsummbm(__a, __b, __c);
6088 /* vec_vmsumubm */
6090 static __inline__ vector unsigned int __attribute__((__always_inline__))
6091 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
6092 vector unsigned int __c) {
6093 return __builtin_altivec_vmsumubm(__a, __b, __c);
6096 /* vec_vmsumshm */
6098 static __inline__ vector int __attribute__((__always_inline__))
6099 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
6100 return __builtin_altivec_vmsumshm(__a, __b, __c);
6103 /* vec_vmsumuhm */
6105 static __inline__ vector unsigned int __attribute__((__always_inline__))
6106 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
6107 vector unsigned int __c) {
6108 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6111 /* vec_msums */
6113 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
6114 vector short __b,
6115 vector int __c) {
6116 return __builtin_altivec_vmsumshs(__a, __b, __c);
6119 static __inline__ vector unsigned int __ATTRS_o_ai
6120 vec_msums(vector unsigned short __a, vector unsigned short __b,
6121 vector unsigned int __c) {
6122 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6125 /* vec_vmsumshs */
6127 static __inline__ vector int __attribute__((__always_inline__))
6128 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
6129 return __builtin_altivec_vmsumshs(__a, __b, __c);
6132 /* vec_vmsumuhs */
6134 static __inline__ vector unsigned int __attribute__((__always_inline__))
6135 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
6136 vector unsigned int __c) {
6137 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6140 /* vec_mtvscr */
6142 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
6143 __builtin_altivec_mtvscr((vector int)__a);
6146 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
6147 __builtin_altivec_mtvscr((vector int)__a);
6150 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
6151 __builtin_altivec_mtvscr((vector int)__a);
6154 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
6155 __builtin_altivec_mtvscr((vector int)__a);
6158 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
6159 __builtin_altivec_mtvscr((vector int)__a);
6162 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
6163 __builtin_altivec_mtvscr((vector int)__a);
6166 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
6167 __builtin_altivec_mtvscr((vector int)__a);
6170 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
6171 __builtin_altivec_mtvscr((vector int)__a);
6174 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
6175 __builtin_altivec_mtvscr((vector int)__a);
6178 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
6179 __builtin_altivec_mtvscr((vector int)__a);
6182 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
6183 __builtin_altivec_mtvscr((vector int)__a);
6186 /* vec_mul */
6188 /* Integer vector multiplication will involve multiplication of the odd/even
6189 elements separately, then truncating the results and moving to the
6190 result vector.
6192 static __inline__ vector signed char __ATTRS_o_ai
6193 vec_mul(vector signed char __a, vector signed char __b) {
6194 return __a * __b;
6197 static __inline__ vector unsigned char __ATTRS_o_ai
6198 vec_mul(vector unsigned char __a, vector unsigned char __b) {
6199 return __a * __b;
6202 static __inline__ vector signed short __ATTRS_o_ai
6203 vec_mul(vector signed short __a, vector signed short __b) {
6204 return __a * __b;
6207 static __inline__ vector unsigned short __ATTRS_o_ai
6208 vec_mul(vector unsigned short __a, vector unsigned short __b) {
6209 return __a * __b;
6212 static __inline__ vector signed int __ATTRS_o_ai
6213 vec_mul(vector signed int __a, vector signed int __b) {
6214 return __a * __b;
6217 static __inline__ vector unsigned int __ATTRS_o_ai
6218 vec_mul(vector unsigned int __a, vector unsigned int __b) {
6219 return __a * __b;
6222 #ifdef __VSX__
6223 static __inline__ vector signed long long __ATTRS_o_ai
6224 vec_mul(vector signed long long __a, vector signed long long __b) {
6225 return __a * __b;
6228 static __inline__ vector unsigned long long __ATTRS_o_ai
6229 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
6230 return __a * __b;
6232 #endif
6234 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
6235 vector float __b) {
6236 return __a * __b;
6239 #ifdef __VSX__
6240 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
6241 vector double __b) {
6242 return __a * __b;
6244 #endif
6246 /* The vmulos* and vmules* instructions have a big endian bias, so
6247 we must reverse the meaning of "even" and "odd" for little endian. */
6249 /* vec_mule */
6251 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
6252 vector signed char __b) {
6253 #ifdef __LITTLE_ENDIAN__
6254 return __builtin_altivec_vmulosb(__a, __b);
6255 #else
6256 return __builtin_altivec_vmulesb(__a, __b);
6257 #endif
6260 static __inline__ vector unsigned short __ATTRS_o_ai
6261 vec_mule(vector unsigned char __a, vector unsigned char __b) {
6262 #ifdef __LITTLE_ENDIAN__
6263 return __builtin_altivec_vmuloub(__a, __b);
6264 #else
6265 return __builtin_altivec_vmuleub(__a, __b);
6266 #endif
6269 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
6270 vector short __b) {
6271 #ifdef __LITTLE_ENDIAN__
6272 return __builtin_altivec_vmulosh(__a, __b);
6273 #else
6274 return __builtin_altivec_vmulesh(__a, __b);
6275 #endif
6278 static __inline__ vector unsigned int __ATTRS_o_ai
6279 vec_mule(vector unsigned short __a, vector unsigned short __b) {
6280 #ifdef __LITTLE_ENDIAN__
6281 return __builtin_altivec_vmulouh(__a, __b);
6282 #else
6283 return __builtin_altivec_vmuleuh(__a, __b);
6284 #endif
6287 #ifdef __POWER8_VECTOR__
6288 static __inline__ vector signed long long __ATTRS_o_ai
6289 vec_mule(vector signed int __a, vector signed int __b) {
6290 #ifdef __LITTLE_ENDIAN__
6291 return __builtin_altivec_vmulosw(__a, __b);
6292 #else
6293 return __builtin_altivec_vmulesw(__a, __b);
6294 #endif
6297 static __inline__ vector unsigned long long __ATTRS_o_ai
6298 vec_mule(vector unsigned int __a, vector unsigned int __b) {
6299 #ifdef __LITTLE_ENDIAN__
6300 return __builtin_altivec_vmulouw(__a, __b);
6301 #else
6302 return __builtin_altivec_vmuleuw(__a, __b);
6303 #endif
6305 #endif
6307 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6308 static __inline__ vector signed __int128 __ATTRS_o_ai
6309 vec_mule(vector signed long long __a, vector signed long long __b) {
6310 #ifdef __LITTLE_ENDIAN__
6311 return __builtin_altivec_vmulosd(__a, __b);
6312 #else
6313 return __builtin_altivec_vmulesd(__a, __b);
6314 #endif
6317 static __inline__ vector unsigned __int128 __ATTRS_o_ai
6318 vec_mule(vector unsigned long long __a, vector unsigned long long __b) {
6319 #ifdef __LITTLE_ENDIAN__
6320 return __builtin_altivec_vmuloud(__a, __b);
6321 #else
6322 return __builtin_altivec_vmuleud(__a, __b);
6323 #endif
6325 #endif
6327 /* vec_vmulesb */
6329 static __inline__ vector short __attribute__((__always_inline__))
6330 vec_vmulesb(vector signed char __a, vector signed char __b) {
6331 #ifdef __LITTLE_ENDIAN__
6332 return __builtin_altivec_vmulosb(__a, __b);
6333 #else
6334 return __builtin_altivec_vmulesb(__a, __b);
6335 #endif
6338 /* vec_vmuleub */
6340 static __inline__ vector unsigned short __attribute__((__always_inline__))
6341 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
6342 #ifdef __LITTLE_ENDIAN__
6343 return __builtin_altivec_vmuloub(__a, __b);
6344 #else
6345 return __builtin_altivec_vmuleub(__a, __b);
6346 #endif
6349 /* vec_vmulesh */
6351 static __inline__ vector int __attribute__((__always_inline__))
6352 vec_vmulesh(vector short __a, vector short __b) {
6353 #ifdef __LITTLE_ENDIAN__
6354 return __builtin_altivec_vmulosh(__a, __b);
6355 #else
6356 return __builtin_altivec_vmulesh(__a, __b);
6357 #endif
6360 /* vec_vmuleuh */
6362 static __inline__ vector unsigned int __attribute__((__always_inline__))
6363 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
6364 #ifdef __LITTLE_ENDIAN__
6365 return __builtin_altivec_vmulouh(__a, __b);
6366 #else
6367 return __builtin_altivec_vmuleuh(__a, __b);
6368 #endif
6371 /* vec_mulh */
6373 #ifdef __POWER10_VECTOR__
6374 static __inline__ vector signed int __ATTRS_o_ai
6375 vec_mulh(vector signed int __a, vector signed int __b) {
6376 return __builtin_altivec_vmulhsw(__a, __b);
6379 static __inline__ vector unsigned int __ATTRS_o_ai
6380 vec_mulh(vector unsigned int __a, vector unsigned int __b) {
6381 return __builtin_altivec_vmulhuw(__a, __b);
6384 static __inline__ vector signed long long __ATTRS_o_ai
6385 vec_mulh(vector signed long long __a, vector signed long long __b) {
6386 return __builtin_altivec_vmulhsd(__a, __b);
6389 static __inline__ vector unsigned long long __ATTRS_o_ai
6390 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) {
6391 return __builtin_altivec_vmulhud(__a, __b);
6393 #endif
6395 /* vec_mulo */
6397 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
6398 vector signed char __b) {
6399 #ifdef __LITTLE_ENDIAN__
6400 return __builtin_altivec_vmulesb(__a, __b);
6401 #else
6402 return __builtin_altivec_vmulosb(__a, __b);
6403 #endif
6406 static __inline__ vector unsigned short __ATTRS_o_ai
6407 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
6408 #ifdef __LITTLE_ENDIAN__
6409 return __builtin_altivec_vmuleub(__a, __b);
6410 #else
6411 return __builtin_altivec_vmuloub(__a, __b);
6412 #endif
6415 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
6416 vector short __b) {
6417 #ifdef __LITTLE_ENDIAN__
6418 return __builtin_altivec_vmulesh(__a, __b);
6419 #else
6420 return __builtin_altivec_vmulosh(__a, __b);
6421 #endif
6424 static __inline__ vector unsigned int __ATTRS_o_ai
6425 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
6426 #ifdef __LITTLE_ENDIAN__
6427 return __builtin_altivec_vmuleuh(__a, __b);
6428 #else
6429 return __builtin_altivec_vmulouh(__a, __b);
6430 #endif
6433 #ifdef __POWER8_VECTOR__
6434 static __inline__ vector signed long long __ATTRS_o_ai
6435 vec_mulo(vector signed int __a, vector signed int __b) {
6436 #ifdef __LITTLE_ENDIAN__
6437 return __builtin_altivec_vmulesw(__a, __b);
6438 #else
6439 return __builtin_altivec_vmulosw(__a, __b);
6440 #endif
6443 static __inline__ vector unsigned long long __ATTRS_o_ai
6444 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
6445 #ifdef __LITTLE_ENDIAN__
6446 return __builtin_altivec_vmuleuw(__a, __b);
6447 #else
6448 return __builtin_altivec_vmulouw(__a, __b);
6449 #endif
6451 #endif
6453 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6454 static __inline__ vector signed __int128 __ATTRS_o_ai
6455 vec_mulo(vector signed long long __a, vector signed long long __b) {
6456 #ifdef __LITTLE_ENDIAN__
6457 return __builtin_altivec_vmulesd(__a, __b);
6458 #else
6459 return __builtin_altivec_vmulosd(__a, __b);
6460 #endif
6463 static __inline__ vector unsigned __int128 __ATTRS_o_ai
6464 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) {
6465 #ifdef __LITTLE_ENDIAN__
6466 return __builtin_altivec_vmuleud(__a, __b);
6467 #else
6468 return __builtin_altivec_vmuloud(__a, __b);
6469 #endif
6471 #endif
6473 /* vec_vmulosb */
6475 static __inline__ vector short __attribute__((__always_inline__))
6476 vec_vmulosb(vector signed char __a, vector signed char __b) {
6477 #ifdef __LITTLE_ENDIAN__
6478 return __builtin_altivec_vmulesb(__a, __b);
6479 #else
6480 return __builtin_altivec_vmulosb(__a, __b);
6481 #endif
6484 /* vec_vmuloub */
6486 static __inline__ vector unsigned short __attribute__((__always_inline__))
6487 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
6488 #ifdef __LITTLE_ENDIAN__
6489 return __builtin_altivec_vmuleub(__a, __b);
6490 #else
6491 return __builtin_altivec_vmuloub(__a, __b);
6492 #endif
6495 /* vec_vmulosh */
6497 static __inline__ vector int __attribute__((__always_inline__))
6498 vec_vmulosh(vector short __a, vector short __b) {
6499 #ifdef __LITTLE_ENDIAN__
6500 return __builtin_altivec_vmulesh(__a, __b);
6501 #else
6502 return __builtin_altivec_vmulosh(__a, __b);
6503 #endif
6506 /* vec_vmulouh */
6508 static __inline__ vector unsigned int __attribute__((__always_inline__))
6509 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
6510 #ifdef __LITTLE_ENDIAN__
6511 return __builtin_altivec_vmuleuh(__a, __b);
6512 #else
6513 return __builtin_altivec_vmulouh(__a, __b);
6514 #endif
6517 /* vec_nand */
6519 #ifdef __POWER8_VECTOR__
6520 static __inline__ vector signed char __ATTRS_o_ai
6521 vec_nand(vector signed char __a, vector signed char __b) {
6522 return ~(__a & __b);
6525 static __inline__ vector signed char __ATTRS_o_ai
6526 vec_nand(vector signed char __a, vector bool char __b) {
6527 return ~(__a & (vector signed char)__b);
6530 static __inline__ vector signed char __ATTRS_o_ai
6531 vec_nand(vector bool char __a, vector signed char __b) {
6532 return (vector signed char)~(__a & (vector bool char)__b);
6535 static __inline__ vector unsigned char __ATTRS_o_ai
6536 vec_nand(vector unsigned char __a, vector unsigned char __b) {
6537 return ~(__a & __b);
6540 static __inline__ vector unsigned char __ATTRS_o_ai
6541 vec_nand(vector unsigned char __a, vector bool char __b) {
6542 return ~(__a & (vector unsigned char)__b);
6545 static __inline__ vector unsigned char __ATTRS_o_ai
6546 vec_nand(vector bool char __a, vector unsigned char __b) {
6547 return (vector unsigned char)~(__a & (vector bool char)__b);
6550 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
6551 vector bool char __b) {
6552 return ~(__a & __b);
6555 static __inline__ vector signed short __ATTRS_o_ai
6556 vec_nand(vector signed short __a, vector signed short __b) {
6557 return ~(__a & __b);
6560 static __inline__ vector signed short __ATTRS_o_ai
6561 vec_nand(vector signed short __a, vector bool short __b) {
6562 return ~(__a & (vector signed short)__b);
6565 static __inline__ vector signed short __ATTRS_o_ai
6566 vec_nand(vector bool short __a, vector signed short __b) {
6567 return (vector signed short)~(__a & (vector bool short)__b);
6570 static __inline__ vector unsigned short __ATTRS_o_ai
6571 vec_nand(vector unsigned short __a, vector unsigned short __b) {
6572 return ~(__a & __b);
6575 static __inline__ vector unsigned short __ATTRS_o_ai
6576 vec_nand(vector unsigned short __a, vector bool short __b) {
6577 return ~(__a & (vector unsigned short)__b);
6580 static __inline__ vector bool short __ATTRS_o_ai
6581 vec_nand(vector bool short __a, vector bool short __b) {
6582 return ~(__a & __b);
6585 static __inline__ vector signed int __ATTRS_o_ai
6586 vec_nand(vector signed int __a, vector signed int __b) {
6587 return ~(__a & __b);
6590 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
6591 vector bool int __b) {
6592 return ~(__a & (vector signed int)__b);
6595 static __inline__ vector signed int __ATTRS_o_ai
6596 vec_nand(vector bool int __a, vector signed int __b) {
6597 return (vector signed int)~(__a & (vector bool int)__b);
6600 static __inline__ vector unsigned int __ATTRS_o_ai
6601 vec_nand(vector unsigned int __a, vector unsigned int __b) {
6602 return ~(__a & __b);
6605 static __inline__ vector unsigned int __ATTRS_o_ai
6606 vec_nand(vector unsigned int __a, vector bool int __b) {
6607 return ~(__a & (vector unsigned int)__b);
6610 static __inline__ vector unsigned int __ATTRS_o_ai
6611 vec_nand(vector bool int __a, vector unsigned int __b) {
6612 return (vector unsigned int)~(__a & (vector bool int)__b);
6615 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
6616 vector bool int __b) {
6617 return ~(__a & __b);
6620 static __inline__ vector float __ATTRS_o_ai
6621 vec_nand(vector float __a, vector float __b) {
6622 return (vector float)(~((vector unsigned int)__a &
6623 (vector unsigned int)__b));
6626 static __inline__ vector signed long long __ATTRS_o_ai
6627 vec_nand(vector signed long long __a, vector signed long long __b) {
6628 return ~(__a & __b);
6631 static __inline__ vector signed long long __ATTRS_o_ai
6632 vec_nand(vector signed long long __a, vector bool long long __b) {
6633 return ~(__a & (vector signed long long)__b);
6636 static __inline__ vector signed long long __ATTRS_o_ai
6637 vec_nand(vector bool long long __a, vector signed long long __b) {
6638 return (vector signed long long)~(__a & (vector bool long long)__b);
6641 static __inline__ vector unsigned long long __ATTRS_o_ai
6642 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
6643 return ~(__a & __b);
6646 static __inline__ vector unsigned long long __ATTRS_o_ai
6647 vec_nand(vector unsigned long long __a, vector bool long long __b) {
6648 return ~(__a & (vector unsigned long long)__b);
6651 static __inline__ vector unsigned long long __ATTRS_o_ai
6652 vec_nand(vector bool long long __a, vector unsigned long long __b) {
6653 return (vector unsigned long long)~(__a & (vector bool long long)__b);
6656 static __inline__ vector bool long long __ATTRS_o_ai
6657 vec_nand(vector bool long long __a, vector bool long long __b) {
6658 return ~(__a & __b);
6661 static __inline__ vector double __ATTRS_o_ai
6662 vec_nand(vector double __a, vector double __b) {
6663 return (vector double)(~((vector unsigned long long)__a &
6664 (vector unsigned long long)__b));
6667 #endif
6669 /* vec_nmadd */
6671 #ifdef __VSX__
6672 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6673 vector float __b,
6674 vector float __c) {
6675 return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6678 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6679 vector double __b,
6680 vector double __c) {
6681 return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6683 #endif
6685 /* vec_nmsub */
6687 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6688 vector float __b,
6689 vector float __c) {
6690 #ifdef __VSX__
6691 return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6692 #else
6693 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6694 #endif
6697 #ifdef __VSX__
6698 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6699 vector double __b,
6700 vector double __c) {
6701 return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6703 #endif
6705 /* vec_vnmsubfp */
6707 static __inline__ vector float __attribute__((__always_inline__))
6708 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6709 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6712 /* vec_nor */
6714 #define __builtin_altivec_vnor vec_nor
6716 static __inline__ vector signed char __ATTRS_o_ai
6717 vec_nor(vector signed char __a, vector signed char __b) {
6718 return ~(__a | __b);
6721 static __inline__ vector unsigned char __ATTRS_o_ai
6722 vec_nor(vector unsigned char __a, vector unsigned char __b) {
6723 return ~(__a | __b);
6726 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6727 vector bool char __b) {
6728 return ~(__a | __b);
6731 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6732 vector short __b) {
6733 return ~(__a | __b);
6736 static __inline__ vector unsigned short __ATTRS_o_ai
6737 vec_nor(vector unsigned short __a, vector unsigned short __b) {
6738 return ~(__a | __b);
6741 static __inline__ vector bool short __ATTRS_o_ai
6742 vec_nor(vector bool short __a, vector bool short __b) {
6743 return ~(__a | __b);
6746 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6747 vector int __b) {
6748 return ~(__a | __b);
6751 static __inline__ vector unsigned int __ATTRS_o_ai
6752 vec_nor(vector unsigned int __a, vector unsigned int __b) {
6753 return ~(__a | __b);
6756 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6757 vector bool int __b) {
6758 return ~(__a | __b);
6761 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6762 vector float __b) {
6763 vector unsigned int __res =
6764 ~((vector unsigned int)__a | (vector unsigned int)__b);
6765 return (vector float)__res;
6768 #ifdef __VSX__
6769 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6770 vector double __b) {
6771 vector unsigned long long __res =
6772 ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6773 return (vector double)__res;
6775 #endif
6777 /* vec_vnor */
6779 static __inline__ vector signed char __ATTRS_o_ai
6780 vec_vnor(vector signed char __a, vector signed char __b) {
6781 return ~(__a | __b);
6784 static __inline__ vector unsigned char __ATTRS_o_ai
6785 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6786 return ~(__a | __b);
6789 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6790 vector bool char __b) {
6791 return ~(__a | __b);
6794 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6795 vector short __b) {
6796 return ~(__a | __b);
6799 static __inline__ vector unsigned short __ATTRS_o_ai
6800 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6801 return ~(__a | __b);
6804 static __inline__ vector bool short __ATTRS_o_ai
6805 vec_vnor(vector bool short __a, vector bool short __b) {
6806 return ~(__a | __b);
6809 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6810 vector int __b) {
6811 return ~(__a | __b);
6814 static __inline__ vector unsigned int __ATTRS_o_ai
6815 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6816 return ~(__a | __b);
6819 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6820 vector bool int __b) {
6821 return ~(__a | __b);
6824 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6825 vector float __b) {
6826 vector unsigned int __res =
6827 ~((vector unsigned int)__a | (vector unsigned int)__b);
6828 return (vector float)__res;
6831 #ifdef __VSX__
6832 static __inline__ vector signed long long __ATTRS_o_ai
6833 vec_nor(vector signed long long __a, vector signed long long __b) {
6834 return ~(__a | __b);
6837 static __inline__ vector unsigned long long __ATTRS_o_ai
6838 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6839 return ~(__a | __b);
6842 static __inline__ vector bool long long __ATTRS_o_ai
6843 vec_nor(vector bool long long __a, vector bool long long __b) {
6844 return ~(__a | __b);
6846 #endif
6848 /* vec_or */
6850 #define __builtin_altivec_vor vec_or
6852 static __inline__ vector signed char __ATTRS_o_ai
6853 vec_or(vector signed char __a, vector signed char __b) {
6854 return __a | __b;
6857 static __inline__ vector signed char __ATTRS_o_ai
6858 vec_or(vector bool char __a, vector signed char __b) {
6859 return (vector signed char)__a | __b;
6862 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6863 vector bool char __b) {
6864 return __a | (vector signed char)__b;
6867 static __inline__ vector unsigned char __ATTRS_o_ai
6868 vec_or(vector unsigned char __a, vector unsigned char __b) {
6869 return __a | __b;
6872 static __inline__ vector unsigned char __ATTRS_o_ai
6873 vec_or(vector bool char __a, vector unsigned char __b) {
6874 return (vector unsigned char)__a | __b;
6877 static __inline__ vector unsigned char __ATTRS_o_ai
6878 vec_or(vector unsigned char __a, vector bool char __b) {
6879 return __a | (vector unsigned char)__b;
6882 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6883 vector bool char __b) {
6884 return __a | __b;
6887 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6888 vector short __b) {
6889 return __a | __b;
6892 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6893 vector short __b) {
6894 return (vector short)__a | __b;
6897 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6898 vector bool short __b) {
6899 return __a | (vector short)__b;
6902 static __inline__ vector unsigned short __ATTRS_o_ai
6903 vec_or(vector unsigned short __a, vector unsigned short __b) {
6904 return __a | __b;
6907 static __inline__ vector unsigned short __ATTRS_o_ai
6908 vec_or(vector bool short __a, vector unsigned short __b) {
6909 return (vector unsigned short)__a | __b;
6912 static __inline__ vector unsigned short __ATTRS_o_ai
6913 vec_or(vector unsigned short __a, vector bool short __b) {
6914 return __a | (vector unsigned short)__b;
6917 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6918 vector bool short __b) {
6919 return __a | __b;
6922 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6923 vector int __b) {
6924 return __a | __b;
6927 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6928 vector int __b) {
6929 return (vector int)__a | __b;
6932 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6933 vector bool int __b) {
6934 return __a | (vector int)__b;
6937 static __inline__ vector unsigned int __ATTRS_o_ai
6938 vec_or(vector unsigned int __a, vector unsigned int __b) {
6939 return __a | __b;
6942 static __inline__ vector unsigned int __ATTRS_o_ai
6943 vec_or(vector bool int __a, vector unsigned int __b) {
6944 return (vector unsigned int)__a | __b;
6947 static __inline__ vector unsigned int __ATTRS_o_ai
6948 vec_or(vector unsigned int __a, vector bool int __b) {
6949 return __a | (vector unsigned int)__b;
6952 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6953 vector bool int __b) {
6954 return __a | __b;
6957 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6958 vector float __b) {
6959 vector unsigned int __res =
6960 (vector unsigned int)__a | (vector unsigned int)__b;
6961 return (vector float)__res;
6964 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6965 vector float __b) {
6966 vector unsigned int __res =
6967 (vector unsigned int)__a | (vector unsigned int)__b;
6968 return (vector float)__res;
6971 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6972 vector bool int __b) {
6973 vector unsigned int __res =
6974 (vector unsigned int)__a | (vector unsigned int)__b;
6975 return (vector float)__res;
6978 #ifdef __VSX__
6979 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6980 vector double __b) {
6981 return (vector double)((vector unsigned long long)__a |
6982 (vector unsigned long long)__b);
6985 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6986 vector bool long long __b) {
6987 return (vector double)((vector unsigned long long)__a |
6988 (vector unsigned long long)__b);
6991 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6992 vector double __b) {
6993 return (vector double)((vector unsigned long long)__a |
6994 (vector unsigned long long)__b);
6997 static __inline__ vector signed long long __ATTRS_o_ai
6998 vec_or(vector signed long long __a, vector signed long long __b) {
6999 return __a | __b;
7002 static __inline__ vector signed long long __ATTRS_o_ai
7003 vec_or(vector bool long long __a, vector signed long long __b) {
7004 return (vector signed long long)__a | __b;
7007 static __inline__ vector signed long long __ATTRS_o_ai
7008 vec_or(vector signed long long __a, vector bool long long __b) {
7009 return __a | (vector signed long long)__b;
7012 static __inline__ vector unsigned long long __ATTRS_o_ai
7013 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
7014 return __a | __b;
7017 static __inline__ vector unsigned long long __ATTRS_o_ai
7018 vec_or(vector bool long long __a, vector unsigned long long __b) {
7019 return (vector unsigned long long)__a | __b;
7022 static __inline__ vector unsigned long long __ATTRS_o_ai
7023 vec_or(vector unsigned long long __a, vector bool long long __b) {
7024 return __a | (vector unsigned long long)__b;
7027 static __inline__ vector bool long long __ATTRS_o_ai
7028 vec_or(vector bool long long __a, vector bool long long __b) {
7029 return __a | __b;
7031 #endif
7033 #ifdef __POWER8_VECTOR__
7034 static __inline__ vector signed char __ATTRS_o_ai
7035 vec_orc(vector signed char __a, vector signed char __b) {
7036 return __a | ~__b;
7039 static __inline__ vector signed char __ATTRS_o_ai
7040 vec_orc(vector signed char __a, vector bool char __b) {
7041 return __a | (vector signed char)~__b;
7044 static __inline__ vector signed char __ATTRS_o_ai
7045 vec_orc(vector bool char __a, vector signed char __b) {
7046 return (vector signed char)(__a | (vector bool char)~__b);
7049 static __inline__ vector unsigned char __ATTRS_o_ai
7050 vec_orc(vector unsigned char __a, vector unsigned char __b) {
7051 return __a | ~__b;
7054 static __inline__ vector unsigned char __ATTRS_o_ai
7055 vec_orc(vector unsigned char __a, vector bool char __b) {
7056 return __a | (vector unsigned char)~__b;
7059 static __inline__ vector unsigned char __ATTRS_o_ai
7060 vec_orc(vector bool char __a, vector unsigned char __b) {
7061 return (vector unsigned char)(__a | (vector bool char)~__b);
7064 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
7065 vector bool char __b) {
7066 return __a | ~__b;
7069 static __inline__ vector signed short __ATTRS_o_ai
7070 vec_orc(vector signed short __a, vector signed short __b) {
7071 return __a | ~__b;
7074 static __inline__ vector signed short __ATTRS_o_ai
7075 vec_orc(vector signed short __a, vector bool short __b) {
7076 return __a | (vector signed short)~__b;
7079 static __inline__ vector signed short __ATTRS_o_ai
7080 vec_orc(vector bool short __a, vector signed short __b) {
7081 return (vector signed short)(__a | (vector bool short)~__b);
7084 static __inline__ vector unsigned short __ATTRS_o_ai
7085 vec_orc(vector unsigned short __a, vector unsigned short __b) {
7086 return __a | ~__b;
7089 static __inline__ vector unsigned short __ATTRS_o_ai
7090 vec_orc(vector unsigned short __a, vector bool short __b) {
7091 return __a | (vector unsigned short)~__b;
7094 static __inline__ vector unsigned short __ATTRS_o_ai
7095 vec_orc(vector bool short __a, vector unsigned short __b) {
7096 return (vector unsigned short)(__a | (vector bool short)~__b);
7099 static __inline__ vector bool short __ATTRS_o_ai
7100 vec_orc(vector bool short __a, vector bool short __b) {
7101 return __a | ~__b;
7104 static __inline__ vector signed int __ATTRS_o_ai
7105 vec_orc(vector signed int __a, vector signed int __b) {
7106 return __a | ~__b;
7109 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
7110 vector bool int __b) {
7111 return __a | (vector signed int)~__b;
7114 static __inline__ vector signed int __ATTRS_o_ai
7115 vec_orc(vector bool int __a, vector signed int __b) {
7116 return (vector signed int)(__a | (vector bool int)~__b);
7119 static __inline__ vector unsigned int __ATTRS_o_ai
7120 vec_orc(vector unsigned int __a, vector unsigned int __b) {
7121 return __a | ~__b;
7124 static __inline__ vector unsigned int __ATTRS_o_ai
7125 vec_orc(vector unsigned int __a, vector bool int __b) {
7126 return __a | (vector unsigned int)~__b;
7129 static __inline__ vector unsigned int __ATTRS_o_ai
7130 vec_orc(vector bool int __a, vector unsigned int __b) {
7131 return (vector unsigned int)(__a | (vector bool int)~__b);
7134 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
7135 vector bool int __b) {
7136 return __a | ~__b;
7139 static __inline__ vector float __ATTRS_o_ai
7140 vec_orc(vector bool int __a, vector float __b) {
7141 return (vector float)(__a | ~(vector bool int)__b);
7144 static __inline__ vector float __ATTRS_o_ai
7145 vec_orc(vector float __a, vector bool int __b) {
7146 return (vector float)((vector bool int)__a | ~__b);
7149 static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a,
7150 vector float __b) {
7151 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b);
7154 static __inline__ vector signed long long __ATTRS_o_ai
7155 vec_orc(vector signed long long __a, vector signed long long __b) {
7156 return __a | ~__b;
7159 static __inline__ vector signed long long __ATTRS_o_ai
7160 vec_orc(vector signed long long __a, vector bool long long __b) {
7161 return __a | (vector signed long long)~__b;
7164 static __inline__ vector signed long long __ATTRS_o_ai
7165 vec_orc(vector bool long long __a, vector signed long long __b) {
7166 return (vector signed long long)(__a | (vector bool long long)~__b);
7169 static __inline__ vector unsigned long long __ATTRS_o_ai
7170 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
7171 return __a | ~__b;
7174 static __inline__ vector unsigned long long __ATTRS_o_ai
7175 vec_orc(vector unsigned long long __a, vector bool long long __b) {
7176 return __a | (vector unsigned long long)~__b;
7179 static __inline__ vector unsigned long long __ATTRS_o_ai
7180 vec_orc(vector bool long long __a, vector unsigned long long __b) {
7181 return (vector unsigned long long)(__a | (vector bool long long)~__b);
7184 static __inline__ vector bool long long __ATTRS_o_ai
7185 vec_orc(vector bool long long __a, vector bool long long __b) {
7186 return __a | ~__b;
7189 static __inline__ vector double __ATTRS_o_ai
7190 vec_orc(vector double __a, vector bool long long __b) {
7191 return (vector double)((vector bool long long)__a | ~__b);
7194 static __inline__ vector double __ATTRS_o_ai
7195 vec_orc(vector bool long long __a, vector double __b) {
7196 return (vector double)(__a | ~(vector bool long long)__b);
7199 static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a,
7200 vector double __b) {
7201 return (vector double)((vector unsigned long long)__a |
7202 ~(vector unsigned long long)__b);
7204 #endif
7206 /* vec_vor */
7208 static __inline__ vector signed char __ATTRS_o_ai
7209 vec_vor(vector signed char __a, vector signed char __b) {
7210 return __a | __b;
7213 static __inline__ vector signed char __ATTRS_o_ai
7214 vec_vor(vector bool char __a, vector signed char __b) {
7215 return (vector signed char)__a | __b;
7218 static __inline__ vector signed char __ATTRS_o_ai
7219 vec_vor(vector signed char __a, vector bool char __b) {
7220 return __a | (vector signed char)__b;
7223 static __inline__ vector unsigned char __ATTRS_o_ai
7224 vec_vor(vector unsigned char __a, vector unsigned char __b) {
7225 return __a | __b;
7228 static __inline__ vector unsigned char __ATTRS_o_ai
7229 vec_vor(vector bool char __a, vector unsigned char __b) {
7230 return (vector unsigned char)__a | __b;
7233 static __inline__ vector unsigned char __ATTRS_o_ai
7234 vec_vor(vector unsigned char __a, vector bool char __b) {
7235 return __a | (vector unsigned char)__b;
7238 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
7239 vector bool char __b) {
7240 return __a | __b;
7243 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7244 vector short __b) {
7245 return __a | __b;
7248 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
7249 vector short __b) {
7250 return (vector short)__a | __b;
7253 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7254 vector bool short __b) {
7255 return __a | (vector short)__b;
7258 static __inline__ vector unsigned short __ATTRS_o_ai
7259 vec_vor(vector unsigned short __a, vector unsigned short __b) {
7260 return __a | __b;
7263 static __inline__ vector unsigned short __ATTRS_o_ai
7264 vec_vor(vector bool short __a, vector unsigned short __b) {
7265 return (vector unsigned short)__a | __b;
7268 static __inline__ vector unsigned short __ATTRS_o_ai
7269 vec_vor(vector unsigned short __a, vector bool short __b) {
7270 return __a | (vector unsigned short)__b;
7273 static __inline__ vector bool short __ATTRS_o_ai
7274 vec_vor(vector bool short __a, vector bool short __b) {
7275 return __a | __b;
7278 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7279 vector int __b) {
7280 return __a | __b;
7283 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
7284 vector int __b) {
7285 return (vector int)__a | __b;
7288 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7289 vector bool int __b) {
7290 return __a | (vector int)__b;
7293 static __inline__ vector unsigned int __ATTRS_o_ai
7294 vec_vor(vector unsigned int __a, vector unsigned int __b) {
7295 return __a | __b;
7298 static __inline__ vector unsigned int __ATTRS_o_ai
7299 vec_vor(vector bool int __a, vector unsigned int __b) {
7300 return (vector unsigned int)__a | __b;
7303 static __inline__ vector unsigned int __ATTRS_o_ai
7304 vec_vor(vector unsigned int __a, vector bool int __b) {
7305 return __a | (vector unsigned int)__b;
7308 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
7309 vector bool int __b) {
7310 return __a | __b;
7313 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7314 vector float __b) {
7315 vector unsigned int __res =
7316 (vector unsigned int)__a | (vector unsigned int)__b;
7317 return (vector float)__res;
7320 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
7321 vector float __b) {
7322 vector unsigned int __res =
7323 (vector unsigned int)__a | (vector unsigned int)__b;
7324 return (vector float)__res;
7327 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7328 vector bool int __b) {
7329 vector unsigned int __res =
7330 (vector unsigned int)__a | (vector unsigned int)__b;
7331 return (vector float)__res;
7334 #ifdef __VSX__
7335 static __inline__ vector signed long long __ATTRS_o_ai
7336 vec_vor(vector signed long long __a, vector signed long long __b) {
7337 return __a | __b;
7340 static __inline__ vector signed long long __ATTRS_o_ai
7341 vec_vor(vector bool long long __a, vector signed long long __b) {
7342 return (vector signed long long)__a | __b;
7345 static __inline__ vector signed long long __ATTRS_o_ai
7346 vec_vor(vector signed long long __a, vector bool long long __b) {
7347 return __a | (vector signed long long)__b;
7350 static __inline__ vector unsigned long long __ATTRS_o_ai
7351 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
7352 return __a | __b;
7355 static __inline__ vector unsigned long long __ATTRS_o_ai
7356 vec_vor(vector bool long long __a, vector unsigned long long __b) {
7357 return (vector unsigned long long)__a | __b;
7360 static __inline__ vector unsigned long long __ATTRS_o_ai
7361 vec_vor(vector unsigned long long __a, vector bool long long __b) {
7362 return __a | (vector unsigned long long)__b;
7365 static __inline__ vector bool long long __ATTRS_o_ai
7366 vec_vor(vector bool long long __a, vector bool long long __b) {
7367 return __a | __b;
7369 #endif
7371 /* vec_pack */
7373 /* The various vector pack instructions have a big-endian bias, so for
7374 little endian we must handle reversed element numbering. */
7376 static __inline__ vector signed char __ATTRS_o_ai
7377 vec_pack(vector signed short __a, vector signed short __b) {
7378 #ifdef __LITTLE_ENDIAN__
7379 return (vector signed char)vec_perm(
7380 __a, __b,
7381 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7382 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7383 #else
7384 return (vector signed char)vec_perm(
7385 __a, __b,
7386 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7387 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7388 #endif
7391 static __inline__ vector unsigned char __ATTRS_o_ai
7392 vec_pack(vector unsigned short __a, vector unsigned short __b) {
7393 #ifdef __LITTLE_ENDIAN__
7394 return (vector unsigned char)vec_perm(
7395 __a, __b,
7396 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7397 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7398 #else
7399 return (vector unsigned char)vec_perm(
7400 __a, __b,
7401 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7402 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7403 #endif
7406 static __inline__ vector bool char __ATTRS_o_ai
7407 vec_pack(vector bool short __a, vector bool short __b) {
7408 #ifdef __LITTLE_ENDIAN__
7409 return (vector bool char)vec_perm(
7410 __a, __b,
7411 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7412 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7413 #else
7414 return (vector bool char)vec_perm(
7415 __a, __b,
7416 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7417 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7418 #endif
7421 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
7422 vector int __b) {
7423 #ifdef __LITTLE_ENDIAN__
7424 return (vector short)vec_perm(
7425 __a, __b,
7426 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7427 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7428 #else
7429 return (vector short)vec_perm(
7430 __a, __b,
7431 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7432 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7433 #endif
7436 static __inline__ vector unsigned short __ATTRS_o_ai
7437 vec_pack(vector unsigned int __a, vector unsigned int __b) {
7438 #ifdef __LITTLE_ENDIAN__
7439 return (vector unsigned short)vec_perm(
7440 __a, __b,
7441 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7442 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7443 #else
7444 return (vector unsigned short)vec_perm(
7445 __a, __b,
7446 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7447 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7448 #endif
7451 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
7452 vector bool int __b) {
7453 #ifdef __LITTLE_ENDIAN__
7454 return (vector bool short)vec_perm(
7455 __a, __b,
7456 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7457 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7458 #else
7459 return (vector bool short)vec_perm(
7460 __a, __b,
7461 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7462 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7463 #endif
7466 #ifdef __VSX__
7467 static __inline__ vector signed int __ATTRS_o_ai
7468 vec_pack(vector signed long long __a, vector signed long long __b) {
7469 #ifdef __LITTLE_ENDIAN__
7470 return (vector signed int)vec_perm(
7471 __a, __b,
7472 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7473 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7474 #else
7475 return (vector signed int)vec_perm(
7476 __a, __b,
7477 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7478 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7479 #endif
7481 static __inline__ vector unsigned int __ATTRS_o_ai
7482 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
7483 #ifdef __LITTLE_ENDIAN__
7484 return (vector unsigned int)vec_perm(
7485 __a, __b,
7486 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7487 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7488 #else
7489 return (vector unsigned int)vec_perm(
7490 __a, __b,
7491 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7492 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7493 #endif
7496 static __inline__ vector bool int __ATTRS_o_ai
7497 vec_pack(vector bool long long __a, vector bool long long __b) {
7498 #ifdef __LITTLE_ENDIAN__
7499 return (vector bool int)vec_perm(
7500 __a, __b,
7501 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7502 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7503 #else
7504 return (vector bool int)vec_perm(
7505 __a, __b,
7506 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7507 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7508 #endif
7511 static __inline__ vector float __ATTRS_o_ai
7512 vec_pack(vector double __a, vector double __b) {
7513 return (vector float) (__a[0], __a[1], __b[0], __b[1]);
7515 #endif
7517 #ifdef __POWER9_VECTOR__
7518 static __inline__ vector unsigned short __ATTRS_o_ai
7519 vec_pack_to_short_fp32(vector float __a, vector float __b) {
7520 vector float __resa = __builtin_vsx_xvcvsphp(__a);
7521 vector float __resb = __builtin_vsx_xvcvsphp(__b);
7522 #ifdef __LITTLE_ENDIAN__
7523 return (vector unsigned short)vec_mergee(__resa, __resb);
7524 #else
7525 return (vector unsigned short)vec_mergeo(__resa, __resb);
7526 #endif
7529 #endif
7530 /* vec_vpkuhum */
7532 #define __builtin_altivec_vpkuhum vec_vpkuhum
7534 static __inline__ vector signed char __ATTRS_o_ai
7535 vec_vpkuhum(vector signed short __a, vector signed short __b) {
7536 #ifdef __LITTLE_ENDIAN__
7537 return (vector signed char)vec_perm(
7538 __a, __b,
7539 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7540 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7541 #else
7542 return (vector signed char)vec_perm(
7543 __a, __b,
7544 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7545 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7546 #endif
7549 static __inline__ vector unsigned char __ATTRS_o_ai
7550 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
7551 #ifdef __LITTLE_ENDIAN__
7552 return (vector unsigned char)vec_perm(
7553 __a, __b,
7554 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7555 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7556 #else
7557 return (vector unsigned char)vec_perm(
7558 __a, __b,
7559 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7560 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7561 #endif
7564 static __inline__ vector bool char __ATTRS_o_ai
7565 vec_vpkuhum(vector bool short __a, vector bool short __b) {
7566 #ifdef __LITTLE_ENDIAN__
7567 return (vector bool char)vec_perm(
7568 __a, __b,
7569 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7570 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7571 #else
7572 return (vector bool char)vec_perm(
7573 __a, __b,
7574 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7575 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7576 #endif
7579 /* vec_vpkuwum */
7581 #define __builtin_altivec_vpkuwum vec_vpkuwum
7583 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
7584 vector int __b) {
7585 #ifdef __LITTLE_ENDIAN__
7586 return (vector short)vec_perm(
7587 __a, __b,
7588 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7589 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7590 #else
7591 return (vector short)vec_perm(
7592 __a, __b,
7593 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7594 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7595 #endif
7598 static __inline__ vector unsigned short __ATTRS_o_ai
7599 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
7600 #ifdef __LITTLE_ENDIAN__
7601 return (vector unsigned short)vec_perm(
7602 __a, __b,
7603 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7604 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7605 #else
7606 return (vector unsigned short)vec_perm(
7607 __a, __b,
7608 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7609 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7610 #endif
7613 static __inline__ vector bool short __ATTRS_o_ai
7614 vec_vpkuwum(vector bool int __a, vector bool int __b) {
7615 #ifdef __LITTLE_ENDIAN__
7616 return (vector bool short)vec_perm(
7617 __a, __b,
7618 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7619 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7620 #else
7621 return (vector bool short)vec_perm(
7622 __a, __b,
7623 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7624 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7625 #endif
7628 /* vec_vpkudum */
7630 #ifdef __POWER8_VECTOR__
7631 #define __builtin_altivec_vpkudum vec_vpkudum
7633 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
7634 vector long long __b) {
7635 #ifdef __LITTLE_ENDIAN__
7636 return (vector int)vec_perm(
7637 __a, __b,
7638 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7639 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7640 #else
7641 return (vector int)vec_perm(
7642 __a, __b,
7643 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7644 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7645 #endif
7648 static __inline__ vector unsigned int __ATTRS_o_ai
7649 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
7650 #ifdef __LITTLE_ENDIAN__
7651 return (vector unsigned int)vec_perm(
7652 __a, __b,
7653 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7654 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7655 #else
7656 return (vector unsigned int)vec_perm(
7657 __a, __b,
7658 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7659 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7660 #endif
7663 static __inline__ vector bool int __ATTRS_o_ai
7664 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
7665 #ifdef __LITTLE_ENDIAN__
7666 return (vector bool int)vec_perm(
7667 (vector long long)__a, (vector long long)__b,
7668 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7669 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7670 #else
7671 return (vector bool int)vec_perm(
7672 (vector long long)__a, (vector long long)__b,
7673 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7674 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7675 #endif
7677 #endif
7679 /* vec_packpx */
7681 static __inline__ vector pixel __attribute__((__always_inline__))
7682 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7683 #ifdef __LITTLE_ENDIAN__
7684 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7685 #else
7686 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7687 #endif
7690 /* vec_vpkpx */
7692 static __inline__ vector pixel __attribute__((__always_inline__))
7693 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7694 #ifdef __LITTLE_ENDIAN__
7695 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7696 #else
7697 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7698 #endif
7701 /* vec_packs */
7703 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7704 vector short __b) {
7705 #ifdef __LITTLE_ENDIAN__
7706 return __builtin_altivec_vpkshss(__b, __a);
7707 #else
7708 return __builtin_altivec_vpkshss(__a, __b);
7709 #endif
7712 static __inline__ vector unsigned char __ATTRS_o_ai
7713 vec_packs(vector unsigned short __a, vector unsigned short __b) {
7714 #ifdef __LITTLE_ENDIAN__
7715 return __builtin_altivec_vpkuhus(__b, __a);
7716 #else
7717 return __builtin_altivec_vpkuhus(__a, __b);
7718 #endif
7721 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7722 vector int __b) {
7723 #ifdef __LITTLE_ENDIAN__
7724 return __builtin_altivec_vpkswss(__b, __a);
7725 #else
7726 return __builtin_altivec_vpkswss(__a, __b);
7727 #endif
7730 static __inline__ vector unsigned short __ATTRS_o_ai
7731 vec_packs(vector unsigned int __a, vector unsigned int __b) {
7732 #ifdef __LITTLE_ENDIAN__
7733 return __builtin_altivec_vpkuwus(__b, __a);
7734 #else
7735 return __builtin_altivec_vpkuwus(__a, __b);
7736 #endif
7739 #ifdef __POWER8_VECTOR__
7740 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7741 vector long long __b) {
7742 #ifdef __LITTLE_ENDIAN__
7743 return __builtin_altivec_vpksdss(__b, __a);
7744 #else
7745 return __builtin_altivec_vpksdss(__a, __b);
7746 #endif
7749 static __inline__ vector unsigned int __ATTRS_o_ai
7750 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7751 #ifdef __LITTLE_ENDIAN__
7752 return __builtin_altivec_vpkudus(__b, __a);
7753 #else
7754 return __builtin_altivec_vpkudus(__a, __b);
7755 #endif
7757 #endif
7759 /* vec_vpkshss */
7761 static __inline__ vector signed char __attribute__((__always_inline__))
7762 vec_vpkshss(vector short __a, vector short __b) {
7763 #ifdef __LITTLE_ENDIAN__
7764 return __builtin_altivec_vpkshss(__b, __a);
7765 #else
7766 return __builtin_altivec_vpkshss(__a, __b);
7767 #endif
7770 /* vec_vpksdss */
7772 #ifdef __POWER8_VECTOR__
7773 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7774 vector long long __b) {
7775 #ifdef __LITTLE_ENDIAN__
7776 return __builtin_altivec_vpksdss(__b, __a);
7777 #else
7778 return __builtin_altivec_vpksdss(__a, __b);
7779 #endif
7781 #endif
7783 /* vec_vpkuhus */
7785 static __inline__ vector unsigned char __attribute__((__always_inline__))
7786 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7787 #ifdef __LITTLE_ENDIAN__
7788 return __builtin_altivec_vpkuhus(__b, __a);
7789 #else
7790 return __builtin_altivec_vpkuhus(__a, __b);
7791 #endif
7794 /* vec_vpkudus */
7796 #ifdef __POWER8_VECTOR__
7797 static __inline__ vector unsigned int __attribute__((__always_inline__))
7798 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7799 #ifdef __LITTLE_ENDIAN__
7800 return __builtin_altivec_vpkudus(__b, __a);
7801 #else
7802 return __builtin_altivec_vpkudus(__a, __b);
7803 #endif
7805 #endif
7807 /* vec_vpkswss */
7809 static __inline__ vector signed short __attribute__((__always_inline__))
7810 vec_vpkswss(vector int __a, vector int __b) {
7811 #ifdef __LITTLE_ENDIAN__
7812 return __builtin_altivec_vpkswss(__b, __a);
7813 #else
7814 return __builtin_altivec_vpkswss(__a, __b);
7815 #endif
7818 /* vec_vpkuwus */
7820 static __inline__ vector unsigned short __attribute__((__always_inline__))
7821 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7822 #ifdef __LITTLE_ENDIAN__
7823 return __builtin_altivec_vpkuwus(__b, __a);
7824 #else
7825 return __builtin_altivec_vpkuwus(__a, __b);
7826 #endif
7829 /* vec_packsu */
7831 static __inline__ vector unsigned char __ATTRS_o_ai
7832 vec_packsu(vector short __a, vector short __b) {
7833 #ifdef __LITTLE_ENDIAN__
7834 return __builtin_altivec_vpkshus(__b, __a);
7835 #else
7836 return __builtin_altivec_vpkshus(__a, __b);
7837 #endif
7840 static __inline__ vector unsigned char __ATTRS_o_ai
7841 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7842 #ifdef __LITTLE_ENDIAN__
7843 return __builtin_altivec_vpkuhus(__b, __a);
7844 #else
7845 return __builtin_altivec_vpkuhus(__a, __b);
7846 #endif
7849 static __inline__ vector unsigned short __ATTRS_o_ai
7850 vec_packsu(vector int __a, vector int __b) {
7851 #ifdef __LITTLE_ENDIAN__
7852 return __builtin_altivec_vpkswus(__b, __a);
7853 #else
7854 return __builtin_altivec_vpkswus(__a, __b);
7855 #endif
7858 static __inline__ vector unsigned short __ATTRS_o_ai
7859 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7860 #ifdef __LITTLE_ENDIAN__
7861 return __builtin_altivec_vpkuwus(__b, __a);
7862 #else
7863 return __builtin_altivec_vpkuwus(__a, __b);
7864 #endif
7867 #ifdef __POWER8_VECTOR__
7868 static __inline__ vector unsigned int __ATTRS_o_ai
7869 vec_packsu(vector long long __a, vector long long __b) {
7870 #ifdef __LITTLE_ENDIAN__
7871 return __builtin_altivec_vpksdus(__b, __a);
7872 #else
7873 return __builtin_altivec_vpksdus(__a, __b);
7874 #endif
7877 static __inline__ vector unsigned int __ATTRS_o_ai
7878 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7879 #ifdef __LITTLE_ENDIAN__
7880 return __builtin_altivec_vpkudus(__b, __a);
7881 #else
7882 return __builtin_altivec_vpkudus(__a, __b);
7883 #endif
7885 #endif
7887 /* vec_vpkshus */
7889 static __inline__ vector unsigned char __ATTRS_o_ai
7890 vec_vpkshus(vector short __a, vector short __b) {
7891 #ifdef __LITTLE_ENDIAN__
7892 return __builtin_altivec_vpkshus(__b, __a);
7893 #else
7894 return __builtin_altivec_vpkshus(__a, __b);
7895 #endif
7898 static __inline__ vector unsigned char __ATTRS_o_ai
7899 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7900 #ifdef __LITTLE_ENDIAN__
7901 return __builtin_altivec_vpkuhus(__b, __a);
7902 #else
7903 return __builtin_altivec_vpkuhus(__a, __b);
7904 #endif
7907 /* vec_vpkswus */
7909 static __inline__ vector unsigned short __ATTRS_o_ai
7910 vec_vpkswus(vector int __a, vector int __b) {
7911 #ifdef __LITTLE_ENDIAN__
7912 return __builtin_altivec_vpkswus(__b, __a);
7913 #else
7914 return __builtin_altivec_vpkswus(__a, __b);
7915 #endif
7918 static __inline__ vector unsigned short __ATTRS_o_ai
7919 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7920 #ifdef __LITTLE_ENDIAN__
7921 return __builtin_altivec_vpkuwus(__b, __a);
7922 #else
7923 return __builtin_altivec_vpkuwus(__a, __b);
7924 #endif
7927 /* vec_vpksdus */
7929 #ifdef __POWER8_VECTOR__
7930 static __inline__ vector unsigned int __ATTRS_o_ai
7931 vec_vpksdus(vector long long __a, vector long long __b) {
7932 #ifdef __LITTLE_ENDIAN__
7933 return __builtin_altivec_vpksdus(__b, __a);
7934 #else
7935 return __builtin_altivec_vpksdus(__a, __b);
7936 #endif
7938 #endif
7940 /* vec_perm */
7942 // The vperm instruction is defined architecturally with a big-endian bias.
7943 // For little endian, we swap the input operands and invert the permute
7944 // control vector. Only the rightmost 5 bits matter, so we could use
7945 // a vector of all 31s instead of all 255s to perform the inversion.
7946 // However, when the PCV is not a constant, using 255 has an advantage
7947 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
7948 // later, possibly a vec_nand).
7950 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7951 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7952 #ifdef __LITTLE_ENDIAN__
7953 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7954 255, 255, 255, 255, 255, 255, 255, 255};
7955 __d = vec_xor(__c, __d);
7956 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7957 (vector int)__a, __d);
7958 #else
7959 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7960 (vector int)__b, __c);
7961 #endif
7964 static __inline__ vector unsigned char __ATTRS_o_ai
7965 vec_perm(vector unsigned char __a, vector unsigned char __b,
7966 vector unsigned char __c) {
7967 #ifdef __LITTLE_ENDIAN__
7968 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7969 255, 255, 255, 255, 255, 255, 255, 255};
7970 __d = vec_xor(__c, __d);
7971 return (vector unsigned char)__builtin_altivec_vperm_4si(
7972 (vector int)__b, (vector int)__a, __d);
7973 #else
7974 return (vector unsigned char)__builtin_altivec_vperm_4si(
7975 (vector int)__a, (vector int)__b, __c);
7976 #endif
7979 static __inline__ vector bool char __ATTRS_o_ai
7980 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7981 #ifdef __LITTLE_ENDIAN__
7982 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7983 255, 255, 255, 255, 255, 255, 255, 255};
7984 __d = vec_xor(__c, __d);
7985 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7986 (vector int)__a, __d);
7987 #else
7988 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7989 (vector int)__b, __c);
7990 #endif
7993 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7994 vector signed short __b,
7995 vector unsigned char __c) {
7996 #ifdef __LITTLE_ENDIAN__
7997 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7998 255, 255, 255, 255, 255, 255, 255, 255};
7999 __d = vec_xor(__c, __d);
8000 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
8001 (vector int)__a, __d);
8002 #else
8003 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
8004 (vector int)__b, __c);
8005 #endif
8008 static __inline__ vector unsigned short __ATTRS_o_ai
8009 vec_perm(vector unsigned short __a, vector unsigned short __b,
8010 vector unsigned char __c) {
8011 #ifdef __LITTLE_ENDIAN__
8012 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8013 255, 255, 255, 255, 255, 255, 255, 255};
8014 __d = vec_xor(__c, __d);
8015 return (vector unsigned short)__builtin_altivec_vperm_4si(
8016 (vector int)__b, (vector int)__a, __d);
8017 #else
8018 return (vector unsigned short)__builtin_altivec_vperm_4si(
8019 (vector int)__a, (vector int)__b, __c);
8020 #endif
8023 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
8024 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8025 #ifdef __LITTLE_ENDIAN__
8026 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8027 255, 255, 255, 255, 255, 255, 255, 255};
8028 __d = vec_xor(__c, __d);
8029 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
8030 (vector int)__a, __d);
8031 #else
8032 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
8033 (vector int)__b, __c);
8034 #endif
8037 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
8038 vector pixel __b,
8039 vector unsigned char __c) {
8040 #ifdef __LITTLE_ENDIAN__
8041 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8042 255, 255, 255, 255, 255, 255, 255, 255};
8043 __d = vec_xor(__c, __d);
8044 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
8045 (vector int)__a, __d);
8046 #else
8047 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
8048 (vector int)__b, __c);
8049 #endif
8052 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
8053 vector signed int __b,
8054 vector unsigned char __c) {
8055 #ifdef __LITTLE_ENDIAN__
8056 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8057 255, 255, 255, 255, 255, 255, 255, 255};
8058 __d = vec_xor(__c, __d);
8059 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
8060 #else
8061 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
8062 #endif
8065 static __inline__ vector unsigned int __ATTRS_o_ai
8066 vec_perm(vector unsigned int __a, vector unsigned int __b,
8067 vector unsigned char __c) {
8068 #ifdef __LITTLE_ENDIAN__
8069 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8070 255, 255, 255, 255, 255, 255, 255, 255};
8071 __d = vec_xor(__c, __d);
8072 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
8073 (vector int)__a, __d);
8074 #else
8075 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
8076 (vector int)__b, __c);
8077 #endif
8080 static __inline__ vector bool int __ATTRS_o_ai
8081 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8082 #ifdef __LITTLE_ENDIAN__
8083 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8084 255, 255, 255, 255, 255, 255, 255, 255};
8085 __d = vec_xor(__c, __d);
8086 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
8087 (vector int)__a, __d);
8088 #else
8089 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
8090 (vector int)__b, __c);
8091 #endif
8094 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
8095 vector float __b,
8096 vector unsigned char __c) {
8097 #ifdef __LITTLE_ENDIAN__
8098 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8099 255, 255, 255, 255, 255, 255, 255, 255};
8100 __d = vec_xor(__c, __d);
8101 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
8102 (vector int)__a, __d);
8103 #else
8104 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
8105 (vector int)__b, __c);
8106 #endif
8109 #ifdef __VSX__
8110 static __inline__ vector long long __ATTRS_o_ai
8111 vec_perm(vector signed long long __a, vector signed long long __b,
8112 vector unsigned char __c) {
8113 #ifdef __LITTLE_ENDIAN__
8114 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8115 255, 255, 255, 255, 255, 255, 255, 255};
8116 __d = vec_xor(__c, __d);
8117 return (vector signed long long)__builtin_altivec_vperm_4si(
8118 (vector int)__b, (vector int)__a, __d);
8119 #else
8120 return (vector signed long long)__builtin_altivec_vperm_4si(
8121 (vector int)__a, (vector int)__b, __c);
8122 #endif
8125 static __inline__ vector unsigned long long __ATTRS_o_ai
8126 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
8127 vector unsigned char __c) {
8128 #ifdef __LITTLE_ENDIAN__
8129 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8130 255, 255, 255, 255, 255, 255, 255, 255};
8131 __d = vec_xor(__c, __d);
8132 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8133 (vector int)__b, (vector int)__a, __d);
8134 #else
8135 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8136 (vector int)__a, (vector int)__b, __c);
8137 #endif
8140 static __inline__ vector bool long long __ATTRS_o_ai
8141 vec_perm(vector bool long long __a, vector bool long long __b,
8142 vector unsigned char __c) {
8143 #ifdef __LITTLE_ENDIAN__
8144 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8145 255, 255, 255, 255, 255, 255, 255, 255};
8146 __d = vec_xor(__c, __d);
8147 return (vector bool long long)__builtin_altivec_vperm_4si(
8148 (vector int)__b, (vector int)__a, __d);
8149 #else
8150 return (vector bool long long)__builtin_altivec_vperm_4si(
8151 (vector int)__a, (vector int)__b, __c);
8152 #endif
8155 static __inline__ vector double __ATTRS_o_ai
8156 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
8157 #ifdef __LITTLE_ENDIAN__
8158 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8159 255, 255, 255, 255, 255, 255, 255, 255};
8160 __d = vec_xor(__c, __d);
8161 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
8162 (vector int)__a, __d);
8163 #else
8164 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
8165 (vector int)__b, __c);
8166 #endif
8168 #endif
8170 /* vec_vperm */
8172 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
8173 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8174 return vec_perm(__a, __b, __c);
8177 static __inline__ vector unsigned char __ATTRS_o_ai
8178 vec_vperm(vector unsigned char __a, vector unsigned char __b,
8179 vector unsigned char __c) {
8180 return vec_perm(__a, __b, __c);
8183 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
8184 vector bool char __a, vector bool char __b, vector unsigned char __c) {
8185 return vec_perm(__a, __b, __c);
8188 static __inline__ vector short __ATTRS_o_ai
8189 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
8190 return vec_perm(__a, __b, __c);
8193 static __inline__ vector unsigned short __ATTRS_o_ai
8194 vec_vperm(vector unsigned short __a, vector unsigned short __b,
8195 vector unsigned char __c) {
8196 return vec_perm(__a, __b, __c);
8199 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
8200 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8201 return vec_perm(__a, __b, __c);
8204 static __inline__ vector pixel __ATTRS_o_ai
8205 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
8206 return vec_perm(__a, __b, __c);
8209 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
8210 vector int __b,
8211 vector unsigned char __c) {
8212 return vec_perm(__a, __b, __c);
8215 static __inline__ vector unsigned int __ATTRS_o_ai
8216 vec_vperm(vector unsigned int __a, vector unsigned int __b,
8217 vector unsigned char __c) {
8218 return vec_perm(__a, __b, __c);
8221 static __inline__ vector bool int __ATTRS_o_ai
8222 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8223 return vec_perm(__a, __b, __c);
8226 static __inline__ vector float __ATTRS_o_ai
8227 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
8228 return vec_perm(__a, __b, __c);
8231 #ifdef __VSX__
8232 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
8233 vector long long __a, vector long long __b, vector unsigned char __c) {
8234 return vec_perm(__a, __b, __c);
8237 static __inline__ vector unsigned long long __ATTRS_o_ai
8238 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
8239 vector unsigned char __c) {
8240 return vec_perm(__a, __b, __c);
8243 static __inline__ vector double __ATTRS_o_ai
8244 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
8245 return vec_perm(__a, __b, __c);
8247 #endif
8249 /* vec_re */
8251 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
8252 #ifdef __VSX__
8253 return __builtin_vsx_xvresp(__a);
8254 #else
8255 return __builtin_altivec_vrefp(__a);
8256 #endif
8259 #ifdef __VSX__
8260 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
8261 return __builtin_vsx_xvredp(__a);
8263 #endif
8265 /* vec_vrefp */
8267 static __inline__ vector float __attribute__((__always_inline__))
8268 vec_vrefp(vector float __a) {
8269 return __builtin_altivec_vrefp(__a);
8272 /* vec_rl */
8274 static __inline__ vector signed char __ATTRS_o_ai
8275 vec_rl(vector signed char __a, vector unsigned char __b) {
8276 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8279 static __inline__ vector unsigned char __ATTRS_o_ai
8280 vec_rl(vector unsigned char __a, vector unsigned char __b) {
8281 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8284 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
8285 vector unsigned short __b) {
8286 return __builtin_altivec_vrlh(__a, __b);
8289 static __inline__ vector unsigned short __ATTRS_o_ai
8290 vec_rl(vector unsigned short __a, vector unsigned short __b) {
8291 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8294 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
8295 vector unsigned int __b) {
8296 return __builtin_altivec_vrlw(__a, __b);
8299 static __inline__ vector unsigned int __ATTRS_o_ai
8300 vec_rl(vector unsigned int __a, vector unsigned int __b) {
8301 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8304 #ifdef __POWER8_VECTOR__
8305 static __inline__ vector signed long long __ATTRS_o_ai
8306 vec_rl(vector signed long long __a, vector unsigned long long __b) {
8307 return __builtin_altivec_vrld(__a, __b);
8310 static __inline__ vector unsigned long long __ATTRS_o_ai
8311 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
8312 return (vector unsigned long long)__builtin_altivec_vrld(
8313 (vector long long)__a, __b);
8315 #endif
8317 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8318 static __inline__ vector signed __int128 __ATTRS_o_ai
8319 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) {
8320 return (vector signed __int128)(((vector unsigned __int128)__b
8321 << (vector unsigned __int128)__a) |
8322 ((vector unsigned __int128)__b >>
8323 ((__CHAR_BIT__ *
8324 sizeof(vector unsigned __int128)) -
8325 (vector unsigned __int128)__a)));
8328 static __inline__ vector unsigned __int128 __ATTRS_o_ai
8329 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
8330 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a));
8332 #endif
8334 /* vec_rlmi */
8335 #ifdef __POWER9_VECTOR__
8336 static __inline__ vector unsigned int __ATTRS_o_ai
8337 vec_rlmi(vector unsigned int __a, vector unsigned int __b,
8338 vector unsigned int __c) {
8339 return __builtin_altivec_vrlwmi(__a, __c, __b);
8342 static __inline__ vector unsigned long long __ATTRS_o_ai
8343 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
8344 vector unsigned long long __c) {
8345 return __builtin_altivec_vrldmi(__a, __c, __b);
8347 #endif
8349 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8350 static __inline__ vector unsigned __int128 __ATTRS_o_ai
8351 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b,
8352 vector unsigned __int128 __c) {
8353 return __builtin_altivec_vrlqmi(__a, __c, __b);
8356 static __inline__ vector signed __int128 __ATTRS_o_ai
8357 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b,
8358 vector signed __int128 __c) {
8359 return (vector signed __int128)__builtin_altivec_vrlqmi(
8360 (vector unsigned __int128)__a, (vector unsigned __int128)__c,
8361 (vector unsigned __int128)__b);
8363 #endif
8365 /* vec_rlnm */
8366 #ifdef __POWER9_VECTOR__
8367 static __inline__ vector unsigned int __ATTRS_o_ai
8368 vec_rlnm(vector unsigned int __a, vector unsigned int __b,
8369 vector unsigned int __c) {
8370 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
8371 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
8374 static __inline__ vector unsigned long long __ATTRS_o_ai
8375 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
8376 vector unsigned long long __c) {
8377 vector unsigned long long OneByte = { 0x8, 0x8 };
8378 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
8380 #endif
8382 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8383 static __inline__ vector unsigned __int128 __ATTRS_o_ai
8384 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b,
8385 vector unsigned __int128 __c) {
8386 // Merge __b and __c using an appropriate shuffle.
8387 vector unsigned char TmpB = (vector unsigned char)__b;
8388 vector unsigned char TmpC = (vector unsigned char)__c;
8389 vector unsigned char MaskAndShift =
8390 #ifdef __LITTLE_ENDIAN__
8391 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8392 1, -1, -1, -1, -1, -1);
8393 #else
8394 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8395 -1, -1, -1, -1, -1, -1, -1);
8396 #endif
8397 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8400 static __inline__ vector signed __int128 __ATTRS_o_ai
8401 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b,
8402 vector signed __int128 __c) {
8403 // Merge __b and __c using an appropriate shuffle.
8404 vector unsigned char TmpB = (vector unsigned char)__b;
8405 vector unsigned char TmpC = (vector unsigned char)__c;
8406 vector unsigned char MaskAndShift =
8407 #ifdef __LITTLE_ENDIAN__
8408 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8409 1, -1, -1, -1, -1, -1);
8410 #else
8411 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8412 -1, -1, -1, -1, -1, -1, -1);
8413 #endif
8414 return (vector signed __int128)__builtin_altivec_vrlqnm(
8415 (vector unsigned __int128)__a, (vector unsigned __int128)MaskAndShift);
8417 #endif
8419 /* vec_vrlb */
8421 static __inline__ vector signed char __ATTRS_o_ai
8422 vec_vrlb(vector signed char __a, vector unsigned char __b) {
8423 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8426 static __inline__ vector unsigned char __ATTRS_o_ai
8427 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
8428 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8431 /* vec_vrlh */
8433 static __inline__ vector short __ATTRS_o_ai
8434 vec_vrlh(vector short __a, vector unsigned short __b) {
8435 return __builtin_altivec_vrlh(__a, __b);
8438 static __inline__ vector unsigned short __ATTRS_o_ai
8439 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
8440 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8443 /* vec_vrlw */
8445 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
8446 vector unsigned int __b) {
8447 return __builtin_altivec_vrlw(__a, __b);
8450 static __inline__ vector unsigned int __ATTRS_o_ai
8451 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
8452 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8455 /* vec_round */
8457 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
8458 return __builtin_altivec_vrfin(__a);
8461 #ifdef __VSX__
8462 #ifdef __XL_COMPAT_ALTIVEC__
8463 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a);
8464 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8465 double __fpscr = __builtin_readflm();
8466 __builtin_setrnd(0);
8467 vector double __rounded = vec_rint(__a);
8468 __builtin_setflm(__fpscr);
8469 return __rounded;
8471 #else
8472 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8473 return __builtin_vsx_xvrdpi(__a);
8475 #endif
8477 /* vec_rint */
8479 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
8480 return __builtin_vsx_xvrspic(__a);
8483 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
8484 return __builtin_vsx_xvrdpic(__a);
8487 /* vec_roundc */
8489 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) {
8490 return __builtin_vsx_xvrspic(__a);
8493 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) {
8494 return __builtin_vsx_xvrdpic(__a);
8497 /* vec_nearbyint */
8499 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
8500 return __builtin_vsx_xvrspi(__a);
8503 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
8504 return __builtin_vsx_xvrdpi(__a);
8506 #endif
8508 /* vec_vrfin */
8510 static __inline__ vector float __attribute__((__always_inline__))
8511 vec_vrfin(vector float __a) {
8512 return __builtin_altivec_vrfin(__a);
8515 /* vec_sqrt */
8517 #ifdef __VSX__
8518 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
8519 return __builtin_vsx_xvsqrtsp(__a);
8522 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
8523 return __builtin_vsx_xvsqrtdp(__a);
8525 #endif
8527 /* vec_rsqrte */
8529 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
8530 #ifdef __VSX__
8531 return __builtin_vsx_xvrsqrtesp(__a);
8532 #else
8533 return __builtin_altivec_vrsqrtefp(__a);
8534 #endif
8537 #ifdef __VSX__
8538 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
8539 return __builtin_vsx_xvrsqrtedp(__a);
8541 #endif
8543 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) {
8544 return __builtin_ppc_rsqrtf(__a);
8547 #ifdef __VSX__
8548 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) {
8549 return __builtin_ppc_rsqrtd(__a);
8551 #endif
8553 /* vec_vrsqrtefp */
8555 static __inline__ __vector float __attribute__((__always_inline__))
8556 vec_vrsqrtefp(vector float __a) {
8557 return __builtin_altivec_vrsqrtefp(__a);
8560 /* vec_xvtsqrt */
8562 #ifdef __VSX__
8563 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) {
8564 return __builtin_vsx_xvtsqrtdp(__a);
8567 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) {
8568 return __builtin_vsx_xvtsqrtsp(__a);
8570 #endif
8572 /* vec_sel */
8574 #define __builtin_altivec_vsel_4si vec_sel
8576 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
8577 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8578 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8581 static __inline__ vector signed char __ATTRS_o_ai
8582 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
8583 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8586 static __inline__ vector unsigned char __ATTRS_o_ai
8587 vec_sel(vector unsigned char __a, vector unsigned char __b,
8588 vector unsigned char __c) {
8589 return (__a & ~__c) | (__b & __c);
8592 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
8593 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8594 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8597 static __inline__ vector bool char __ATTRS_o_ai
8598 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8599 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8602 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
8603 vector bool char __b,
8604 vector bool char __c) {
8605 return (__a & ~__c) | (__b & __c);
8608 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8609 vector short __b,
8610 vector unsigned short __c) {
8611 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8614 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8615 vector short __b,
8616 vector bool short __c) {
8617 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8620 static __inline__ vector unsigned short __ATTRS_o_ai
8621 vec_sel(vector unsigned short __a, vector unsigned short __b,
8622 vector unsigned short __c) {
8623 return (__a & ~__c) | (__b & __c);
8626 static __inline__ vector unsigned short __ATTRS_o_ai
8627 vec_sel(vector unsigned short __a, vector unsigned short __b,
8628 vector bool short __c) {
8629 return (__a & ~(vector unsigned short)__c) |
8630 (__b & (vector unsigned short)__c);
8633 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
8634 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8635 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8638 static __inline__ vector bool short __ATTRS_o_ai
8639 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
8640 return (__a & ~__c) | (__b & __c);
8643 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8644 vector int __b,
8645 vector unsigned int __c) {
8646 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8649 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8650 vector int __b,
8651 vector bool int __c) {
8652 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8655 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
8656 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8657 return (__a & ~__c) | (__b & __c);
8660 static __inline__ vector unsigned int __ATTRS_o_ai
8661 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8662 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8665 static __inline__ vector bool int __ATTRS_o_ai
8666 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8667 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8670 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
8671 vector bool int __b,
8672 vector bool int __c) {
8673 return (__a & ~__c) | (__b & __c);
8676 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8677 vector float __b,
8678 vector unsigned int __c) {
8679 vector int __res = ((vector int)__a & ~(vector int)__c) |
8680 ((vector int)__b & (vector int)__c);
8681 return (vector float)__res;
8684 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8685 vector float __b,
8686 vector bool int __c) {
8687 vector int __res = ((vector int)__a & ~(vector int)__c) |
8688 ((vector int)__b & (vector int)__c);
8689 return (vector float)__res;
8692 #ifdef __VSX__
8693 static __inline__ vector double __ATTRS_o_ai
8694 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
8695 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8696 ((vector long long)__b & (vector long long)__c);
8697 return (vector double)__res;
8700 static __inline__ vector double __ATTRS_o_ai
8701 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
8702 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8703 ((vector long long)__b & (vector long long)__c);
8704 return (vector double)__res;
8707 static __inline__ vector bool long long __ATTRS_o_ai
8708 vec_sel(vector bool long long __a, vector bool long long __b,
8709 vector bool long long __c) {
8710 return (__a & ~__c) | (__b & __c);
8713 static __inline__ vector bool long long __ATTRS_o_ai
8714 vec_sel(vector bool long long __a, vector bool long long __b,
8715 vector unsigned long long __c) {
8716 return (__a & ~(vector bool long long)__c) |
8717 (__b & (vector bool long long)__c);
8720 static __inline__ vector signed long long __ATTRS_o_ai
8721 vec_sel(vector signed long long __a, vector signed long long __b,
8722 vector bool long long __c) {
8723 return (__a & ~(vector signed long long)__c) |
8724 (__b & (vector signed long long)__c);
8727 static __inline__ vector signed long long __ATTRS_o_ai
8728 vec_sel(vector signed long long __a, vector signed long long __b,
8729 vector unsigned long long __c) {
8730 return (__a & ~(vector signed long long)__c) |
8731 (__b & (vector signed long long)__c);
8734 static __inline__ vector unsigned long long __ATTRS_o_ai
8735 vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8736 vector bool long long __c) {
8737 return (__a & ~(vector unsigned long long)__c) |
8738 (__b & (vector unsigned long long)__c);
8741 static __inline__ vector unsigned long long __ATTRS_o_ai
8742 vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8743 vector unsigned long long __c) {
8744 return (__a & ~__c) | (__b & __c);
8746 #endif
8748 /* vec_vsel */
8750 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
8751 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8752 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8755 static __inline__ vector signed char __ATTRS_o_ai
8756 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
8757 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8760 static __inline__ vector unsigned char __ATTRS_o_ai
8761 vec_vsel(vector unsigned char __a, vector unsigned char __b,
8762 vector unsigned char __c) {
8763 return (__a & ~__c) | (__b & __c);
8766 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
8767 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8768 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8771 static __inline__ vector bool char __ATTRS_o_ai
8772 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8773 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8776 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
8777 vector bool char __b,
8778 vector bool char __c) {
8779 return (__a & ~__c) | (__b & __c);
8782 static __inline__ vector short __ATTRS_o_ai
8783 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
8784 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8787 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
8788 vector short __b,
8789 vector bool short __c) {
8790 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8793 static __inline__ vector unsigned short __ATTRS_o_ai
8794 vec_vsel(vector unsigned short __a, vector unsigned short __b,
8795 vector unsigned short __c) {
8796 return (__a & ~__c) | (__b & __c);
8799 static __inline__ vector unsigned short __ATTRS_o_ai
8800 vec_vsel(vector unsigned short __a, vector unsigned short __b,
8801 vector bool short __c) {
8802 return (__a & ~(vector unsigned short)__c) |
8803 (__b & (vector unsigned short)__c);
8806 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
8807 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8808 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8811 static __inline__ vector bool short __ATTRS_o_ai
8812 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
8813 return (__a & ~__c) | (__b & __c);
8816 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8817 vector int __b,
8818 vector unsigned int __c) {
8819 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8822 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8823 vector int __b,
8824 vector bool int __c) {
8825 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8828 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8829 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8830 return (__a & ~__c) | (__b & __c);
8833 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8834 vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8835 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8838 static __inline__ vector bool int __ATTRS_o_ai
8839 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8840 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8843 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8844 vector bool int __b,
8845 vector bool int __c) {
8846 return (__a & ~__c) | (__b & __c);
8849 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8850 vector float __b,
8851 vector unsigned int __c) {
8852 vector int __res = ((vector int)__a & ~(vector int)__c) |
8853 ((vector int)__b & (vector int)__c);
8854 return (vector float)__res;
8857 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8858 vector float __b,
8859 vector bool int __c) {
8860 vector int __res = ((vector int)__a & ~(vector int)__c) |
8861 ((vector int)__b & (vector int)__c);
8862 return (vector float)__res;
8865 /* vec_sl */
8867 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8868 // than the length of __a.
8869 static __inline__ vector unsigned char __ATTRS_o_ai
8870 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8871 return __a << (__b %
8872 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8875 static __inline__ vector signed char __ATTRS_o_ai
8876 vec_sl(vector signed char __a, vector unsigned char __b) {
8877 return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8880 static __inline__ vector unsigned short __ATTRS_o_ai
8881 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8882 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8883 __CHAR_BIT__));
8886 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8887 vector unsigned short __b) {
8888 return (vector short)vec_sl((vector unsigned short)__a, __b);
8891 static __inline__ vector unsigned int __ATTRS_o_ai
8892 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8893 return __a << (__b %
8894 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8897 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8898 vector unsigned int __b) {
8899 return (vector int)vec_sl((vector unsigned int)__a, __b);
8902 #ifdef __POWER8_VECTOR__
8903 static __inline__ vector unsigned long long __ATTRS_o_ai
8904 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8905 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8906 __CHAR_BIT__));
8909 static __inline__ vector long long __ATTRS_o_ai
8910 vec_sl(vector long long __a, vector unsigned long long __b) {
8911 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8913 #elif defined(__VSX__)
8914 static __inline__ vector unsigned char __ATTRS_o_ai
8915 vec_vspltb(vector unsigned char __a, unsigned char __b);
8916 static __inline__ vector unsigned long long __ATTRS_o_ai
8917 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8918 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
8920 // Big endian element one (the right doubleword) can be left shifted as-is.
8921 // The other element needs to be swapped into the right doubleword and
8922 // shifted. Then the right doublewords of the two result vectors are merged.
8923 vector signed long long __rightelt =
8924 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8925 (vector signed int)__b);
8926 #ifdef __LITTLE_ENDIAN__
8927 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8928 (vector signed int)__rightelt,
8929 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8930 #else
8931 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8932 (vector signed int)__rightelt,
8933 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8934 #endif
8935 __a = __builtin_shufflevector(__a, __a, 1, 0);
8936 __b = __builtin_shufflevector(__b, __b, 1, 0);
8937 vector signed long long __leftelt =
8938 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8939 (vector signed int)__b);
8940 #ifdef __LITTLE_ENDIAN__
8941 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8942 (vector signed int)__leftelt,
8943 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8944 return (vector unsigned long long)__builtin_shufflevector(__rightelt,
8945 __leftelt, 0, 2);
8946 #else
8947 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8948 (vector signed int)__leftelt,
8949 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8950 return (vector unsigned long long)__builtin_shufflevector(__leftelt,
8951 __rightelt, 1, 3);
8952 #endif
8955 static __inline__ vector long long __ATTRS_o_ai
8956 vec_sl(vector long long __a, vector unsigned long long __b) {
8957 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8959 #endif /* __VSX__ */
8961 /* vec_vslb */
8963 #define __builtin_altivec_vslb vec_vslb
8965 static __inline__ vector signed char __ATTRS_o_ai
8966 vec_vslb(vector signed char __a, vector unsigned char __b) {
8967 return vec_sl(__a, __b);
8970 static __inline__ vector unsigned char __ATTRS_o_ai
8971 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8972 return vec_sl(__a, __b);
8975 /* vec_vslh */
8977 #define __builtin_altivec_vslh vec_vslh
8979 static __inline__ vector short __ATTRS_o_ai
8980 vec_vslh(vector short __a, vector unsigned short __b) {
8981 return vec_sl(__a, __b);
8984 static __inline__ vector unsigned short __ATTRS_o_ai
8985 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8986 return vec_sl(__a, __b);
8989 /* vec_vslw */
8991 #define __builtin_altivec_vslw vec_vslw
8993 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8994 vector unsigned int __b) {
8995 return vec_sl(__a, __b);
8998 static __inline__ vector unsigned int __ATTRS_o_ai
8999 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
9000 return vec_sl(__a, __b);
9003 /* vec_sld */
9005 #define __builtin_altivec_vsldoi_4si vec_sld
9007 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
9008 vector signed char __a, vector signed char __b, unsigned const int __c) {
9009 unsigned char __d = __c & 0x0F;
9010 #ifdef __LITTLE_ENDIAN__
9011 return vec_perm(
9012 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9013 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9014 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9015 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9016 #else
9017 return vec_perm(
9018 __a, __b,
9019 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9020 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9021 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9022 #endif
9025 static __inline__ vector unsigned char __ATTRS_o_ai
9026 vec_sld(vector unsigned char __a, vector unsigned char __b,
9027 unsigned const int __c) {
9028 unsigned char __d = __c & 0x0F;
9029 #ifdef __LITTLE_ENDIAN__
9030 return vec_perm(
9031 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9032 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9033 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9034 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9035 #else
9036 return vec_perm(
9037 __a, __b,
9038 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9039 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9040 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9041 #endif
9044 static __inline__ vector bool char __ATTRS_o_ai
9045 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
9046 unsigned char __d = __c & 0x0F;
9047 #ifdef __LITTLE_ENDIAN__
9048 return vec_perm(
9049 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9050 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9051 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9052 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9053 #else
9054 return vec_perm(
9055 __a, __b,
9056 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9057 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9058 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9059 #endif
9062 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
9063 vector signed short __a, vector signed short __b, unsigned const int __c) {
9064 unsigned char __d = __c & 0x0F;
9065 #ifdef __LITTLE_ENDIAN__
9066 return vec_perm(
9067 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9068 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9069 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9070 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9071 #else
9072 return vec_perm(
9073 __a, __b,
9074 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9075 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9076 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9077 #endif
9080 static __inline__ vector unsigned short __ATTRS_o_ai
9081 vec_sld(vector unsigned short __a, vector unsigned short __b,
9082 unsigned const int __c) {
9083 unsigned char __d = __c & 0x0F;
9084 #ifdef __LITTLE_ENDIAN__
9085 return vec_perm(
9086 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9087 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9088 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9089 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9090 #else
9091 return vec_perm(
9092 __a, __b,
9093 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9094 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9095 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9096 #endif
9099 static __inline__ vector bool short __ATTRS_o_ai
9100 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
9101 unsigned char __d = __c & 0x0F;
9102 #ifdef __LITTLE_ENDIAN__
9103 return vec_perm(
9104 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9105 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9106 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9107 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9108 #else
9109 return vec_perm(
9110 __a, __b,
9111 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9112 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9113 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9114 #endif
9117 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
9118 vector pixel __b,
9119 unsigned const int __c) {
9120 unsigned char __d = __c & 0x0F;
9121 #ifdef __LITTLE_ENDIAN__
9122 return vec_perm(
9123 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9124 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9125 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9126 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9127 #else
9128 return vec_perm(
9129 __a, __b,
9130 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9131 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9132 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9133 #endif
9136 static __inline__ vector signed int __ATTRS_o_ai
9137 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
9138 unsigned char __d = __c & 0x0F;
9139 #ifdef __LITTLE_ENDIAN__
9140 return vec_perm(
9141 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9142 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9143 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9144 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9145 #else
9146 return vec_perm(
9147 __a, __b,
9148 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9149 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9150 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9151 #endif
9154 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
9155 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9156 unsigned char __d = __c & 0x0F;
9157 #ifdef __LITTLE_ENDIAN__
9158 return vec_perm(
9159 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9160 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9161 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9162 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9163 #else
9164 return vec_perm(
9165 __a, __b,
9166 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9167 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9168 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9169 #endif
9172 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
9173 vector bool int __b,
9174 unsigned const int __c) {
9175 unsigned char __d = __c & 0x0F;
9176 #ifdef __LITTLE_ENDIAN__
9177 return vec_perm(
9178 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9179 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9180 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9181 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9182 #else
9183 return vec_perm(
9184 __a, __b,
9185 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9186 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9187 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9188 #endif
9191 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
9192 vector float __b,
9193 unsigned const int __c) {
9194 unsigned char __d = __c & 0x0F;
9195 #ifdef __LITTLE_ENDIAN__
9196 return vec_perm(
9197 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9198 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9199 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9200 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9201 #else
9202 return vec_perm(
9203 __a, __b,
9204 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9205 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9206 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9207 #endif
9210 #ifdef __VSX__
9211 static __inline__ vector bool long long __ATTRS_o_ai
9212 vec_sld(vector bool long long __a, vector bool long long __b,
9213 unsigned const int __c) {
9214 unsigned char __d = __c & 0x0F;
9215 #ifdef __LITTLE_ENDIAN__
9216 return vec_perm(
9217 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9218 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9219 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9220 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9221 #else
9222 return vec_perm(
9223 __a, __b,
9224 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9225 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9226 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9227 #endif
9230 static __inline__ vector signed long long __ATTRS_o_ai
9231 vec_sld(vector signed long long __a, vector signed long long __b,
9232 unsigned const int __c) {
9233 unsigned char __d = __c & 0x0F;
9234 #ifdef __LITTLE_ENDIAN__
9235 return vec_perm(
9236 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9237 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9238 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9239 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9240 #else
9241 return vec_perm(
9242 __a, __b,
9243 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9244 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9245 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9246 #endif
9249 static __inline__ vector unsigned long long __ATTRS_o_ai
9250 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
9251 unsigned const int __c) {
9252 unsigned char __d = __c & 0x0F;
9253 #ifdef __LITTLE_ENDIAN__
9254 return vec_perm(
9255 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9256 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9257 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9258 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9259 #else
9260 return vec_perm(
9261 __a, __b,
9262 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9263 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9264 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9265 #endif
9268 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
9269 vector double __b,
9270 unsigned const int __c) {
9271 unsigned char __d = __c & 0x0F;
9272 #ifdef __LITTLE_ENDIAN__
9273 return vec_perm(
9274 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9275 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9276 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9277 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9278 #else
9279 return vec_perm(
9280 __a, __b,
9281 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9282 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9283 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9284 #endif
9286 #endif
9288 /* vec_sldw */
9289 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
9290 vector signed char __a, vector signed char __b, unsigned const int __c) {
9291 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9294 static __inline__ vector unsigned char __ATTRS_o_ai
9295 vec_sldw(vector unsigned char __a, vector unsigned char __b,
9296 unsigned const int __c) {
9297 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9300 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
9301 vector signed short __a, vector signed short __b, unsigned const int __c) {
9302 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9305 static __inline__ vector unsigned short __ATTRS_o_ai
9306 vec_sldw(vector unsigned short __a, vector unsigned short __b,
9307 unsigned const int __c) {
9308 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9311 static __inline__ vector signed int __ATTRS_o_ai
9312 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
9313 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9316 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
9317 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9318 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9321 static __inline__ vector float __ATTRS_o_ai vec_sldw(
9322 vector float __a, vector float __b, unsigned const int __c) {
9323 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9326 #ifdef __VSX__
9327 static __inline__ vector signed long long __ATTRS_o_ai
9328 vec_sldw(vector signed long long __a, vector signed long long __b,
9329 unsigned const int __c) {
9330 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9333 static __inline__ vector unsigned long long __ATTRS_o_ai
9334 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
9335 unsigned const int __c) {
9336 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9339 static __inline__ vector double __ATTRS_o_ai vec_sldw(
9340 vector double __a, vector double __b, unsigned const int __c) {
9341 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9343 #endif
9345 #ifdef __POWER9_VECTOR__
9346 /* vec_slv */
9347 static __inline__ vector unsigned char __ATTRS_o_ai
9348 vec_slv(vector unsigned char __a, vector unsigned char __b) {
9349 return __builtin_altivec_vslv(__a, __b);
9352 /* vec_srv */
9353 static __inline__ vector unsigned char __ATTRS_o_ai
9354 vec_srv(vector unsigned char __a, vector unsigned char __b) {
9355 return __builtin_altivec_vsrv(__a, __b);
9357 #endif
9359 /* vec_vsldoi */
9361 static __inline__ vector signed char __ATTRS_o_ai
9362 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
9363 unsigned char __d = __c & 0x0F;
9364 #ifdef __LITTLE_ENDIAN__
9365 return vec_perm(
9366 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9367 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9368 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9369 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9370 #else
9371 return vec_perm(
9372 __a, __b,
9373 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9374 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9375 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9376 #endif
9379 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
9380 vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
9381 unsigned char __d = __c & 0x0F;
9382 #ifdef __LITTLE_ENDIAN__
9383 return vec_perm(
9384 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9385 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9386 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9387 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9388 #else
9389 return vec_perm(
9390 __a, __b,
9391 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9392 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9393 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9394 #endif
9397 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
9398 vector short __b,
9399 unsigned char __c) {
9400 unsigned char __d = __c & 0x0F;
9401 #ifdef __LITTLE_ENDIAN__
9402 return vec_perm(
9403 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9404 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9405 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9406 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9407 #else
9408 return vec_perm(
9409 __a, __b,
9410 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9411 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9412 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9413 #endif
9416 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
9417 vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
9418 unsigned char __d = __c & 0x0F;
9419 #ifdef __LITTLE_ENDIAN__
9420 return vec_perm(
9421 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9422 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9423 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9424 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9425 #else
9426 return vec_perm(
9427 __a, __b,
9428 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9429 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9430 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9431 #endif
9434 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
9435 vector pixel __b,
9436 unsigned char __c) {
9437 unsigned char __d = __c & 0x0F;
9438 #ifdef __LITTLE_ENDIAN__
9439 return vec_perm(
9440 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9441 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9442 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9443 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9444 #else
9445 return vec_perm(
9446 __a, __b,
9447 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9448 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9449 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9450 #endif
9453 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
9454 vector int __b,
9455 unsigned char __c) {
9456 unsigned char __d = __c & 0x0F;
9457 #ifdef __LITTLE_ENDIAN__
9458 return vec_perm(
9459 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9460 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9461 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9462 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9463 #else
9464 return vec_perm(
9465 __a, __b,
9466 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9467 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9468 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9469 #endif
9472 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
9473 vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
9474 unsigned char __d = __c & 0x0F;
9475 #ifdef __LITTLE_ENDIAN__
9476 return vec_perm(
9477 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9478 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9479 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9480 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9481 #else
9482 return vec_perm(
9483 __a, __b,
9484 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9485 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9486 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9487 #endif
9490 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
9491 vector float __b,
9492 unsigned char __c) {
9493 unsigned char __d = __c & 0x0F;
9494 #ifdef __LITTLE_ENDIAN__
9495 return vec_perm(
9496 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9497 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9498 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9499 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9500 #else
9501 return vec_perm(
9502 __a, __b,
9503 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9504 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9505 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9506 #endif
9509 /* vec_sll */
9511 static __inline__ vector signed char __ATTRS_o_ai
9512 vec_sll(vector signed char __a, vector unsigned char __b) {
9513 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9514 (vector int)__b);
9517 static __inline__ vector signed char __ATTRS_o_ai
9518 vec_sll(vector signed char __a, vector unsigned short __b) {
9519 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9520 (vector int)__b);
9523 static __inline__ vector signed char __ATTRS_o_ai
9524 vec_sll(vector signed char __a, vector unsigned int __b) {
9525 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9526 (vector int)__b);
9529 static __inline__ vector unsigned char __ATTRS_o_ai
9530 vec_sll(vector unsigned char __a, vector unsigned char __b) {
9531 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9532 (vector int)__b);
9535 static __inline__ vector unsigned char __ATTRS_o_ai
9536 vec_sll(vector unsigned char __a, vector unsigned short __b) {
9537 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9538 (vector int)__b);
9541 static __inline__ vector unsigned char __ATTRS_o_ai
9542 vec_sll(vector unsigned char __a, vector unsigned int __b) {
9543 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9544 (vector int)__b);
9547 static __inline__ vector bool char __ATTRS_o_ai
9548 vec_sll(vector bool char __a, vector unsigned char __b) {
9549 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9550 (vector int)__b);
9553 static __inline__ vector bool char __ATTRS_o_ai
9554 vec_sll(vector bool char __a, vector unsigned short __b) {
9555 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9556 (vector int)__b);
9559 static __inline__ vector bool char __ATTRS_o_ai
9560 vec_sll(vector bool char __a, vector unsigned int __b) {
9561 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9562 (vector int)__b);
9565 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9566 vector unsigned char __b) {
9567 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9570 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9571 vector unsigned short __b) {
9572 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9575 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9576 vector unsigned int __b) {
9577 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9580 static __inline__ vector unsigned short __ATTRS_o_ai
9581 vec_sll(vector unsigned short __a, vector unsigned char __b) {
9582 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9583 (vector int)__b);
9586 static __inline__ vector unsigned short __ATTRS_o_ai
9587 vec_sll(vector unsigned short __a, vector unsigned short __b) {
9588 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9589 (vector int)__b);
9592 static __inline__ vector unsigned short __ATTRS_o_ai
9593 vec_sll(vector unsigned short __a, vector unsigned int __b) {
9594 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9595 (vector int)__b);
9598 static __inline__ vector bool short __ATTRS_o_ai
9599 vec_sll(vector bool short __a, vector unsigned char __b) {
9600 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9601 (vector int)__b);
9604 static __inline__ vector bool short __ATTRS_o_ai
9605 vec_sll(vector bool short __a, vector unsigned short __b) {
9606 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9607 (vector int)__b);
9610 static __inline__ vector bool short __ATTRS_o_ai
9611 vec_sll(vector bool short __a, vector unsigned int __b) {
9612 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9613 (vector int)__b);
9616 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9617 vector unsigned char __b) {
9618 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9621 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9622 vector unsigned short __b) {
9623 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9626 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9627 vector unsigned int __b) {
9628 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9631 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9632 vector unsigned char __b) {
9633 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9636 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9637 vector unsigned short __b) {
9638 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9641 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9642 vector unsigned int __b) {
9643 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9646 static __inline__ vector unsigned int __ATTRS_o_ai
9647 vec_sll(vector unsigned int __a, vector unsigned char __b) {
9648 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9649 (vector int)__b);
9652 static __inline__ vector unsigned int __ATTRS_o_ai
9653 vec_sll(vector unsigned int __a, vector unsigned short __b) {
9654 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9655 (vector int)__b);
9658 static __inline__ vector unsigned int __ATTRS_o_ai
9659 vec_sll(vector unsigned int __a, vector unsigned int __b) {
9660 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9661 (vector int)__b);
9664 static __inline__ vector bool int __ATTRS_o_ai
9665 vec_sll(vector bool int __a, vector unsigned char __b) {
9666 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9667 (vector int)__b);
9670 static __inline__ vector bool int __ATTRS_o_ai
9671 vec_sll(vector bool int __a, vector unsigned short __b) {
9672 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9673 (vector int)__b);
9676 static __inline__ vector bool int __ATTRS_o_ai
9677 vec_sll(vector bool int __a, vector unsigned int __b) {
9678 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9679 (vector int)__b);
9682 #ifdef __VSX__
9683 static __inline__ vector signed long long __ATTRS_o_ai
9684 vec_sll(vector signed long long __a, vector unsigned char __b) {
9685 return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
9686 (vector int)__b);
9689 static __inline__ vector unsigned long long __ATTRS_o_ai
9690 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
9691 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
9692 (vector int)__b);
9694 #endif
9696 /* vec_vsl */
9698 static __inline__ vector signed char __ATTRS_o_ai
9699 vec_vsl(vector signed char __a, vector unsigned char __b) {
9700 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9701 (vector int)__b);
9704 static __inline__ vector signed char __ATTRS_o_ai
9705 vec_vsl(vector signed char __a, vector unsigned short __b) {
9706 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9707 (vector int)__b);
9710 static __inline__ vector signed char __ATTRS_o_ai
9711 vec_vsl(vector signed char __a, vector unsigned int __b) {
9712 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9713 (vector int)__b);
9716 static __inline__ vector unsigned char __ATTRS_o_ai
9717 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
9718 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9719 (vector int)__b);
9722 static __inline__ vector unsigned char __ATTRS_o_ai
9723 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
9724 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9725 (vector int)__b);
9728 static __inline__ vector unsigned char __ATTRS_o_ai
9729 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
9730 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9731 (vector int)__b);
9734 static __inline__ vector bool char __ATTRS_o_ai
9735 vec_vsl(vector bool char __a, vector unsigned char __b) {
9736 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9737 (vector int)__b);
9740 static __inline__ vector bool char __ATTRS_o_ai
9741 vec_vsl(vector bool char __a, vector unsigned short __b) {
9742 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9743 (vector int)__b);
9746 static __inline__ vector bool char __ATTRS_o_ai
9747 vec_vsl(vector bool char __a, vector unsigned int __b) {
9748 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9749 (vector int)__b);
9752 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9753 vector unsigned char __b) {
9754 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9757 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9758 vector unsigned short __b) {
9759 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9762 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9763 vector unsigned int __b) {
9764 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9767 static __inline__ vector unsigned short __ATTRS_o_ai
9768 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
9769 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9770 (vector int)__b);
9773 static __inline__ vector unsigned short __ATTRS_o_ai
9774 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
9775 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9776 (vector int)__b);
9779 static __inline__ vector unsigned short __ATTRS_o_ai
9780 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
9781 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9782 (vector int)__b);
9785 static __inline__ vector bool short __ATTRS_o_ai
9786 vec_vsl(vector bool short __a, vector unsigned char __b) {
9787 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9788 (vector int)__b);
9791 static __inline__ vector bool short __ATTRS_o_ai
9792 vec_vsl(vector bool short __a, vector unsigned short __b) {
9793 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9794 (vector int)__b);
9797 static __inline__ vector bool short __ATTRS_o_ai
9798 vec_vsl(vector bool short __a, vector unsigned int __b) {
9799 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9800 (vector int)__b);
9803 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9804 vector unsigned char __b) {
9805 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9808 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9809 vector unsigned short __b) {
9810 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9813 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9814 vector unsigned int __b) {
9815 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9818 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9819 vector unsigned char __b) {
9820 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9823 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9824 vector unsigned short __b) {
9825 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9828 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9829 vector unsigned int __b) {
9830 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9833 static __inline__ vector unsigned int __ATTRS_o_ai
9834 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
9835 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9836 (vector int)__b);
9839 static __inline__ vector unsigned int __ATTRS_o_ai
9840 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
9841 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9842 (vector int)__b);
9845 static __inline__ vector unsigned int __ATTRS_o_ai
9846 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
9847 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9848 (vector int)__b);
9851 static __inline__ vector bool int __ATTRS_o_ai
9852 vec_vsl(vector bool int __a, vector unsigned char __b) {
9853 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9854 (vector int)__b);
9857 static __inline__ vector bool int __ATTRS_o_ai
9858 vec_vsl(vector bool int __a, vector unsigned short __b) {
9859 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9860 (vector int)__b);
9863 static __inline__ vector bool int __ATTRS_o_ai
9864 vec_vsl(vector bool int __a, vector unsigned int __b) {
9865 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9866 (vector int)__b);
9869 /* vec_slo */
9871 static __inline__ vector signed char __ATTRS_o_ai
9872 vec_slo(vector signed char __a, vector signed char __b) {
9873 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9874 (vector int)__b);
9877 static __inline__ vector signed char __ATTRS_o_ai
9878 vec_slo(vector signed char __a, vector unsigned char __b) {
9879 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9880 (vector int)__b);
9883 static __inline__ vector unsigned char __ATTRS_o_ai
9884 vec_slo(vector unsigned char __a, vector signed char __b) {
9885 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9886 (vector int)__b);
9889 static __inline__ vector unsigned char __ATTRS_o_ai
9890 vec_slo(vector unsigned char __a, vector unsigned char __b) {
9891 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9892 (vector int)__b);
9895 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9896 vector signed char __b) {
9897 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9900 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9901 vector unsigned char __b) {
9902 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9905 static __inline__ vector unsigned short __ATTRS_o_ai
9906 vec_slo(vector unsigned short __a, vector signed char __b) {
9907 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9908 (vector int)__b);
9911 static __inline__ vector unsigned short __ATTRS_o_ai
9912 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9913 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9914 (vector int)__b);
9917 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9918 vector signed char __b) {
9919 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9922 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9923 vector unsigned char __b) {
9924 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9927 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9928 vector signed char __b) {
9929 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9932 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9933 vector unsigned char __b) {
9934 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9937 static __inline__ vector unsigned int __ATTRS_o_ai
9938 vec_slo(vector unsigned int __a, vector signed char __b) {
9939 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9940 (vector int)__b);
9943 static __inline__ vector unsigned int __ATTRS_o_ai
9944 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9945 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9946 (vector int)__b);
9949 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9950 vector signed char __b) {
9951 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9954 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9955 vector unsigned char __b) {
9956 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9959 #ifdef __VSX__
9960 static __inline__ vector signed long long __ATTRS_o_ai
9961 vec_slo(vector signed long long __a, vector signed char __b) {
9962 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9963 (vector int)__b);
9966 static __inline__ vector signed long long __ATTRS_o_ai
9967 vec_slo(vector signed long long __a, vector unsigned char __b) {
9968 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9969 (vector int)__b);
9972 static __inline__ vector unsigned long long __ATTRS_o_ai
9973 vec_slo(vector unsigned long long __a, vector signed char __b) {
9974 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9975 (vector int)__b);
9978 static __inline__ vector unsigned long long __ATTRS_o_ai
9979 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9980 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9981 (vector int)__b);
9983 #endif
9985 /* vec_vslo */
9987 static __inline__ vector signed char __ATTRS_o_ai
9988 vec_vslo(vector signed char __a, vector signed char __b) {
9989 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9990 (vector int)__b);
9993 static __inline__ vector signed char __ATTRS_o_ai
9994 vec_vslo(vector signed char __a, vector unsigned char __b) {
9995 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9996 (vector int)__b);
9999 static __inline__ vector unsigned char __ATTRS_o_ai
10000 vec_vslo(vector unsigned char __a, vector signed char __b) {
10001 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10002 (vector int)__b);
10005 static __inline__ vector unsigned char __ATTRS_o_ai
10006 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
10007 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10008 (vector int)__b);
10011 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10012 vector signed char __b) {
10013 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10016 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10017 vector unsigned char __b) {
10018 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10021 static __inline__ vector unsigned short __ATTRS_o_ai
10022 vec_vslo(vector unsigned short __a, vector signed char __b) {
10023 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10024 (vector int)__b);
10027 static __inline__ vector unsigned short __ATTRS_o_ai
10028 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
10029 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10030 (vector int)__b);
10033 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10034 vector signed char __b) {
10035 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10038 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10039 vector unsigned char __b) {
10040 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10043 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10044 vector signed char __b) {
10045 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10048 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10049 vector unsigned char __b) {
10050 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10053 static __inline__ vector unsigned int __ATTRS_o_ai
10054 vec_vslo(vector unsigned int __a, vector signed char __b) {
10055 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10056 (vector int)__b);
10059 static __inline__ vector unsigned int __ATTRS_o_ai
10060 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
10061 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10062 (vector int)__b);
10065 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10066 vector signed char __b) {
10067 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10070 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10071 vector unsigned char __b) {
10072 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10075 /* vec_splat */
10077 static __inline__ vector signed char __ATTRS_o_ai
10078 vec_splat(vector signed char __a, unsigned const int __b) {
10079 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10082 static __inline__ vector unsigned char __ATTRS_o_ai
10083 vec_splat(vector unsigned char __a, unsigned const int __b) {
10084 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10087 static __inline__ vector bool char __ATTRS_o_ai
10088 vec_splat(vector bool char __a, unsigned const int __b) {
10089 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10092 static __inline__ vector signed short __ATTRS_o_ai
10093 vec_splat(vector signed short __a, unsigned const int __b) {
10094 unsigned char b0 = (__b & 0x07) * 2;
10095 unsigned char b1 = b0 + 1;
10096 return vec_perm(__a, __a,
10097 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10098 b0, b1, b0, b1, b0, b1));
10101 static __inline__ vector unsigned short __ATTRS_o_ai
10102 vec_splat(vector unsigned short __a, unsigned const int __b) {
10103 unsigned char b0 = (__b & 0x07) * 2;
10104 unsigned char b1 = b0 + 1;
10105 return vec_perm(__a, __a,
10106 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10107 b0, b1, b0, b1, b0, b1));
10110 static __inline__ vector bool short __ATTRS_o_ai
10111 vec_splat(vector bool short __a, unsigned const int __b) {
10112 unsigned char b0 = (__b & 0x07) * 2;
10113 unsigned char b1 = b0 + 1;
10114 return vec_perm(__a, __a,
10115 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10116 b0, b1, b0, b1, b0, b1));
10119 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
10120 unsigned const int __b) {
10121 unsigned char b0 = (__b & 0x07) * 2;
10122 unsigned char b1 = b0 + 1;
10123 return vec_perm(__a, __a,
10124 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10125 b0, b1, b0, b1, b0, b1));
10128 static __inline__ vector signed int __ATTRS_o_ai
10129 vec_splat(vector signed int __a, unsigned const int __b) {
10130 unsigned char b0 = (__b & 0x03) * 4;
10131 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10132 return vec_perm(__a, __a,
10133 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10134 b2, b3, b0, b1, b2, b3));
10137 static __inline__ vector unsigned int __ATTRS_o_ai
10138 vec_splat(vector unsigned int __a, unsigned const int __b) {
10139 unsigned char b0 = (__b & 0x03) * 4;
10140 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10141 return vec_perm(__a, __a,
10142 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10143 b2, b3, b0, b1, b2, b3));
10146 static __inline__ vector bool int __ATTRS_o_ai
10147 vec_splat(vector bool int __a, unsigned const int __b) {
10148 unsigned char b0 = (__b & 0x03) * 4;
10149 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10150 return vec_perm(__a, __a,
10151 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10152 b2, b3, b0, b1, b2, b3));
10155 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
10156 unsigned const int __b) {
10157 unsigned char b0 = (__b & 0x03) * 4;
10158 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10159 return vec_perm(__a, __a,
10160 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10161 b2, b3, b0, b1, b2, b3));
10164 #ifdef __VSX__
10165 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
10166 unsigned const int __b) {
10167 unsigned char b0 = (__b & 0x01) * 8;
10168 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10169 b6 = b0 + 6, b7 = b0 + 7;
10170 return vec_perm(__a, __a,
10171 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10172 b2, b3, b4, b5, b6, b7));
10174 static __inline__ vector bool long long __ATTRS_o_ai
10175 vec_splat(vector bool long long __a, unsigned const int __b) {
10176 unsigned char b0 = (__b & 0x01) * 8;
10177 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10178 b6 = b0 + 6, b7 = b0 + 7;
10179 return vec_perm(__a, __a,
10180 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10181 b2, b3, b4, b5, b6, b7));
10183 static __inline__ vector signed long long __ATTRS_o_ai
10184 vec_splat(vector signed long long __a, unsigned const int __b) {
10185 unsigned char b0 = (__b & 0x01) * 8;
10186 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10187 b6 = b0 + 6, b7 = b0 + 7;
10188 return vec_perm(__a, __a,
10189 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10190 b2, b3, b4, b5, b6, b7));
10192 static __inline__ vector unsigned long long __ATTRS_o_ai
10193 vec_splat(vector unsigned long long __a, unsigned const int __b) {
10194 unsigned char b0 = (__b & 0x01) * 8;
10195 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10196 b6 = b0 + 6, b7 = b0 + 7;
10197 return vec_perm(__a, __a,
10198 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10199 b2, b3, b4, b5, b6, b7));
10201 #endif
10203 /* vec_vspltb */
10205 #define __builtin_altivec_vspltb vec_vspltb
10207 static __inline__ vector signed char __ATTRS_o_ai
10208 vec_vspltb(vector signed char __a, unsigned char __b) {
10209 return vec_perm(__a, __a, (vector unsigned char)(__b));
10212 static __inline__ vector unsigned char __ATTRS_o_ai
10213 vec_vspltb(vector unsigned char __a, unsigned char __b) {
10214 return vec_perm(__a, __a, (vector unsigned char)(__b));
10217 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
10218 unsigned char __b) {
10219 return vec_perm(__a, __a, (vector unsigned char)(__b));
10222 /* vec_vsplth */
10224 #define __builtin_altivec_vsplth vec_vsplth
10226 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
10227 unsigned char __b) {
10228 __b *= 2;
10229 unsigned char b1 = __b + 1;
10230 return vec_perm(__a, __a,
10231 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10232 __b, b1, __b, b1, __b, b1, __b, b1));
10235 static __inline__ vector unsigned short __ATTRS_o_ai
10236 vec_vsplth(vector unsigned short __a, unsigned char __b) {
10237 __b *= 2;
10238 unsigned char b1 = __b + 1;
10239 return vec_perm(__a, __a,
10240 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10241 __b, b1, __b, b1, __b, b1, __b, b1));
10244 static __inline__ vector bool short __ATTRS_o_ai
10245 vec_vsplth(vector bool short __a, unsigned char __b) {
10246 __b *= 2;
10247 unsigned char b1 = __b + 1;
10248 return vec_perm(__a, __a,
10249 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10250 __b, b1, __b, b1, __b, b1, __b, b1));
10253 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
10254 unsigned char __b) {
10255 __b *= 2;
10256 unsigned char b1 = __b + 1;
10257 return vec_perm(__a, __a,
10258 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10259 __b, b1, __b, b1, __b, b1, __b, b1));
10262 /* vec_vspltw */
10264 #define __builtin_altivec_vspltw vec_vspltw
10266 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
10267 unsigned char __b) {
10268 __b *= 4;
10269 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10270 return vec_perm(__a, __a,
10271 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10272 b1, b2, b3, __b, b1, b2, b3));
10275 static __inline__ vector unsigned int __ATTRS_o_ai
10276 vec_vspltw(vector unsigned int __a, unsigned char __b) {
10277 __b *= 4;
10278 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10279 return vec_perm(__a, __a,
10280 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10281 b1, b2, b3, __b, b1, b2, b3));
10284 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
10285 unsigned char __b) {
10286 __b *= 4;
10287 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10288 return vec_perm(__a, __a,
10289 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10290 b1, b2, b3, __b, b1, b2, b3));
10293 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
10294 unsigned char __b) {
10295 __b *= 4;
10296 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10297 return vec_perm(__a, __a,
10298 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10299 b1, b2, b3, __b, b1, b2, b3));
10302 /* vec_splat_s8 */
10304 #define __builtin_altivec_vspltisb vec_splat_s8
10306 // FIXME: parameter should be treated as 5-bit signed literal
10307 static __inline__ vector signed char __ATTRS_o_ai
10308 vec_splat_s8(signed char __a) {
10309 return (vector signed char)(__a);
10312 /* vec_vspltisb */
10314 // FIXME: parameter should be treated as 5-bit signed literal
10315 static __inline__ vector signed char __ATTRS_o_ai
10316 vec_vspltisb(signed char __a) {
10317 return (vector signed char)(__a);
10320 /* vec_splat_s16 */
10322 #define __builtin_altivec_vspltish vec_splat_s16
10324 // FIXME: parameter should be treated as 5-bit signed literal
10325 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
10326 return (vector short)(__a);
10329 /* vec_vspltish */
10331 // FIXME: parameter should be treated as 5-bit signed literal
10332 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
10333 return (vector short)(__a);
10336 /* vec_splat_s32 */
10338 #define __builtin_altivec_vspltisw vec_splat_s32
10340 // FIXME: parameter should be treated as 5-bit signed literal
10341 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
10342 return (vector int)(__a);
10345 /* vec_vspltisw */
10347 // FIXME: parameter should be treated as 5-bit signed literal
10348 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
10349 return (vector int)(__a);
10352 /* vec_splat_u8 */
10354 // FIXME: parameter should be treated as 5-bit signed literal
10355 static __inline__ vector unsigned char __ATTRS_o_ai
10356 vec_splat_u8(unsigned char __a) {
10357 return (vector unsigned char)(__a);
10360 /* vec_splat_u16 */
10362 // FIXME: parameter should be treated as 5-bit signed literal
10363 static __inline__ vector unsigned short __ATTRS_o_ai
10364 vec_splat_u16(signed char __a) {
10365 return (vector unsigned short)(__a);
10368 /* vec_splat_u32 */
10370 // FIXME: parameter should be treated as 5-bit signed literal
10371 static __inline__ vector unsigned int __ATTRS_o_ai
10372 vec_splat_u32(signed char __a) {
10373 return (vector unsigned int)(__a);
10376 /* vec_sr */
10378 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
10379 // than the length of __a.
10380 static __inline__ vector unsigned char __ATTRS_o_ai
10381 vec_sr(vector unsigned char __a, vector unsigned char __b) {
10382 return __a >>
10383 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
10386 static __inline__ vector signed char __ATTRS_o_ai
10387 vec_sr(vector signed char __a, vector unsigned char __b) {
10388 return (vector signed char)vec_sr((vector unsigned char)__a, __b);
10391 static __inline__ vector unsigned short __ATTRS_o_ai
10392 vec_sr(vector unsigned short __a, vector unsigned short __b) {
10393 return __a >>
10394 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
10397 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
10398 vector unsigned short __b) {
10399 return (vector short)vec_sr((vector unsigned short)__a, __b);
10402 static __inline__ vector unsigned int __ATTRS_o_ai
10403 vec_sr(vector unsigned int __a, vector unsigned int __b) {
10404 return __a >>
10405 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
10408 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
10409 vector unsigned int __b) {
10410 return (vector int)vec_sr((vector unsigned int)__a, __b);
10413 #ifdef __POWER8_VECTOR__
10414 static __inline__ vector unsigned long long __ATTRS_o_ai
10415 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10416 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
10417 __CHAR_BIT__));
10420 static __inline__ vector long long __ATTRS_o_ai
10421 vec_sr(vector long long __a, vector unsigned long long __b) {
10422 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10424 #elif defined(__VSX__)
10425 static __inline__ vector unsigned long long __ATTRS_o_ai
10426 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10427 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10429 // Big endian element zero (the left doubleword) can be right shifted as-is.
10430 // However the shift amount must be in the right doubleword.
10431 // The other element needs to be swapped into the left doubleword and
10432 // shifted. Then the left doublewords of the two result vectors are merged.
10433 vector unsigned long long __swapshift =
10434 __builtin_shufflevector(__b, __b, 1, 0);
10435 vector unsigned long long __leftelt =
10436 (vector unsigned long long)__builtin_altivec_vsro(
10437 (vector signed int)__a, (vector signed int)__swapshift);
10438 #ifdef __LITTLE_ENDIAN__
10439 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10440 (vector signed int)__leftelt,
10441 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0));
10442 #else
10443 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10444 (vector signed int)__leftelt,
10445 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15));
10446 #endif
10447 __a = __builtin_shufflevector(__a, __a, 1, 0);
10448 vector unsigned long long __rightelt =
10449 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a,
10450 (vector signed int)__b);
10451 #ifdef __LITTLE_ENDIAN__
10452 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10453 (vector signed int)__rightelt,
10454 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
10455 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3);
10456 #else
10457 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10458 (vector signed int)__rightelt,
10459 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
10460 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2);
10461 #endif
10464 static __inline__ vector long long __ATTRS_o_ai
10465 vec_sr(vector long long __a, vector unsigned long long __b) {
10466 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10468 #endif /* __VSX__ */
10470 /* vec_vsrb */
10472 #define __builtin_altivec_vsrb vec_vsrb
10474 static __inline__ vector signed char __ATTRS_o_ai
10475 vec_vsrb(vector signed char __a, vector unsigned char __b) {
10476 return vec_sr(__a, __b);
10479 static __inline__ vector unsigned char __ATTRS_o_ai
10480 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
10481 return vec_sr(__a, __b);
10484 /* vec_vsrh */
10486 #define __builtin_altivec_vsrh vec_vsrh
10488 static __inline__ vector short __ATTRS_o_ai
10489 vec_vsrh(vector short __a, vector unsigned short __b) {
10490 return vec_sr(__a, __b);
10493 static __inline__ vector unsigned short __ATTRS_o_ai
10494 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
10495 return vec_sr(__a, __b);
10498 /* vec_vsrw */
10500 #define __builtin_altivec_vsrw vec_vsrw
10502 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
10503 vector unsigned int __b) {
10504 return vec_sr(__a, __b);
10507 static __inline__ vector unsigned int __ATTRS_o_ai
10508 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
10509 return vec_sr(__a, __b);
10512 /* vec_sra */
10514 static __inline__ vector signed char __ATTRS_o_ai
10515 vec_sra(vector signed char __a, vector unsigned char __b) {
10516 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10519 static __inline__ vector unsigned char __ATTRS_o_ai
10520 vec_sra(vector unsigned char __a, vector unsigned char __b) {
10521 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10524 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
10525 vector unsigned short __b) {
10526 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10529 static __inline__ vector unsigned short __ATTRS_o_ai
10530 vec_sra(vector unsigned short __a, vector unsigned short __b) {
10531 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10534 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
10535 vector unsigned int __b) {
10536 return __builtin_altivec_vsraw(__a, __b);
10539 static __inline__ vector unsigned int __ATTRS_o_ai
10540 vec_sra(vector unsigned int __a, vector unsigned int __b) {
10541 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10544 #ifdef __POWER8_VECTOR__
10545 static __inline__ vector signed long long __ATTRS_o_ai
10546 vec_sra(vector signed long long __a, vector unsigned long long __b) {
10547 return __a >> __b;
10550 static __inline__ vector unsigned long long __ATTRS_o_ai
10551 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10552 return (vector unsigned long long)((vector signed long long)__a >> __b);
10554 #elif defined(__VSX__)
10555 static __inline__ vector signed long long __ATTRS_o_ai
10556 vec_sra(vector signed long long __a, vector unsigned long long __b) {
10557 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10558 return __a >> __b;
10561 static __inline__ vector unsigned long long __ATTRS_o_ai
10562 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10563 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10564 return (vector unsigned long long)((vector signed long long)__a >> __b);
10566 #endif /* __VSX__ */
10568 /* vec_vsrab */
10570 static __inline__ vector signed char __ATTRS_o_ai
10571 vec_vsrab(vector signed char __a, vector unsigned char __b) {
10572 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10575 static __inline__ vector unsigned char __ATTRS_o_ai
10576 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
10577 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10580 /* vec_vsrah */
10582 static __inline__ vector short __ATTRS_o_ai
10583 vec_vsrah(vector short __a, vector unsigned short __b) {
10584 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10587 static __inline__ vector unsigned short __ATTRS_o_ai
10588 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
10589 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10592 /* vec_vsraw */
10594 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
10595 vector unsigned int __b) {
10596 return __builtin_altivec_vsraw(__a, __b);
10599 static __inline__ vector unsigned int __ATTRS_o_ai
10600 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
10601 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10604 /* vec_srl */
10606 static __inline__ vector signed char __ATTRS_o_ai
10607 vec_srl(vector signed char __a, vector unsigned char __b) {
10608 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10609 (vector int)__b);
10612 static __inline__ vector signed char __ATTRS_o_ai
10613 vec_srl(vector signed char __a, vector unsigned short __b) {
10614 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10615 (vector int)__b);
10618 static __inline__ vector signed char __ATTRS_o_ai
10619 vec_srl(vector signed char __a, vector unsigned int __b) {
10620 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10621 (vector int)__b);
10624 static __inline__ vector unsigned char __ATTRS_o_ai
10625 vec_srl(vector unsigned char __a, vector unsigned char __b) {
10626 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10627 (vector int)__b);
10630 static __inline__ vector unsigned char __ATTRS_o_ai
10631 vec_srl(vector unsigned char __a, vector unsigned short __b) {
10632 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10633 (vector int)__b);
10636 static __inline__ vector unsigned char __ATTRS_o_ai
10637 vec_srl(vector unsigned char __a, vector unsigned int __b) {
10638 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10639 (vector int)__b);
10642 static __inline__ vector bool char __ATTRS_o_ai
10643 vec_srl(vector bool char __a, vector unsigned char __b) {
10644 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10645 (vector int)__b);
10648 static __inline__ vector bool char __ATTRS_o_ai
10649 vec_srl(vector bool char __a, vector unsigned short __b) {
10650 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10651 (vector int)__b);
10654 static __inline__ vector bool char __ATTRS_o_ai
10655 vec_srl(vector bool char __a, vector unsigned int __b) {
10656 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10657 (vector int)__b);
10660 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10661 vector unsigned char __b) {
10662 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10665 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10666 vector unsigned short __b) {
10667 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10670 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10671 vector unsigned int __b) {
10672 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10675 static __inline__ vector unsigned short __ATTRS_o_ai
10676 vec_srl(vector unsigned short __a, vector unsigned char __b) {
10677 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10678 (vector int)__b);
10681 static __inline__ vector unsigned short __ATTRS_o_ai
10682 vec_srl(vector unsigned short __a, vector unsigned short __b) {
10683 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10684 (vector int)__b);
10687 static __inline__ vector unsigned short __ATTRS_o_ai
10688 vec_srl(vector unsigned short __a, vector unsigned int __b) {
10689 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10690 (vector int)__b);
10693 static __inline__ vector bool short __ATTRS_o_ai
10694 vec_srl(vector bool short __a, vector unsigned char __b) {
10695 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10696 (vector int)__b);
10699 static __inline__ vector bool short __ATTRS_o_ai
10700 vec_srl(vector bool short __a, vector unsigned short __b) {
10701 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10702 (vector int)__b);
10705 static __inline__ vector bool short __ATTRS_o_ai
10706 vec_srl(vector bool short __a, vector unsigned int __b) {
10707 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10708 (vector int)__b);
10711 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10712 vector unsigned char __b) {
10713 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10716 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10717 vector unsigned short __b) {
10718 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10721 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10722 vector unsigned int __b) {
10723 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10726 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10727 vector unsigned char __b) {
10728 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10731 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10732 vector unsigned short __b) {
10733 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10736 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10737 vector unsigned int __b) {
10738 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10741 static __inline__ vector unsigned int __ATTRS_o_ai
10742 vec_srl(vector unsigned int __a, vector unsigned char __b) {
10743 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10744 (vector int)__b);
10747 static __inline__ vector unsigned int __ATTRS_o_ai
10748 vec_srl(vector unsigned int __a, vector unsigned short __b) {
10749 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10750 (vector int)__b);
10753 static __inline__ vector unsigned int __ATTRS_o_ai
10754 vec_srl(vector unsigned int __a, vector unsigned int __b) {
10755 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10756 (vector int)__b);
10759 static __inline__ vector bool int __ATTRS_o_ai
10760 vec_srl(vector bool int __a, vector unsigned char __b) {
10761 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10762 (vector int)__b);
10765 static __inline__ vector bool int __ATTRS_o_ai
10766 vec_srl(vector bool int __a, vector unsigned short __b) {
10767 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10768 (vector int)__b);
10771 static __inline__ vector bool int __ATTRS_o_ai
10772 vec_srl(vector bool int __a, vector unsigned int __b) {
10773 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10774 (vector int)__b);
10777 #ifdef __VSX__
10778 static __inline__ vector signed long long __ATTRS_o_ai
10779 vec_srl(vector signed long long __a, vector unsigned char __b) {
10780 return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
10781 (vector int)__b);
10784 static __inline__ vector unsigned long long __ATTRS_o_ai
10785 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
10786 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
10787 (vector int)__b);
10789 #endif
10791 /* vec_vsr */
10793 static __inline__ vector signed char __ATTRS_o_ai
10794 vec_vsr(vector signed char __a, vector unsigned char __b) {
10795 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10796 (vector int)__b);
10799 static __inline__ vector signed char __ATTRS_o_ai
10800 vec_vsr(vector signed char __a, vector unsigned short __b) {
10801 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10802 (vector int)__b);
10805 static __inline__ vector signed char __ATTRS_o_ai
10806 vec_vsr(vector signed char __a, vector unsigned int __b) {
10807 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10808 (vector int)__b);
10811 static __inline__ vector unsigned char __ATTRS_o_ai
10812 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
10813 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10814 (vector int)__b);
10817 static __inline__ vector unsigned char __ATTRS_o_ai
10818 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
10819 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10820 (vector int)__b);
10823 static __inline__ vector unsigned char __ATTRS_o_ai
10824 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
10825 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10826 (vector int)__b);
10829 static __inline__ vector bool char __ATTRS_o_ai
10830 vec_vsr(vector bool char __a, vector unsigned char __b) {
10831 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10832 (vector int)__b);
10835 static __inline__ vector bool char __ATTRS_o_ai
10836 vec_vsr(vector bool char __a, vector unsigned short __b) {
10837 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10838 (vector int)__b);
10841 static __inline__ vector bool char __ATTRS_o_ai
10842 vec_vsr(vector bool char __a, vector unsigned int __b) {
10843 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10844 (vector int)__b);
10847 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10848 vector unsigned char __b) {
10849 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10852 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10853 vector unsigned short __b) {
10854 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10857 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10858 vector unsigned int __b) {
10859 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10862 static __inline__ vector unsigned short __ATTRS_o_ai
10863 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
10864 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10865 (vector int)__b);
10868 static __inline__ vector unsigned short __ATTRS_o_ai
10869 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
10870 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10871 (vector int)__b);
10874 static __inline__ vector unsigned short __ATTRS_o_ai
10875 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
10876 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10877 (vector int)__b);
10880 static __inline__ vector bool short __ATTRS_o_ai
10881 vec_vsr(vector bool short __a, vector unsigned char __b) {
10882 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10883 (vector int)__b);
10886 static __inline__ vector bool short __ATTRS_o_ai
10887 vec_vsr(vector bool short __a, vector unsigned short __b) {
10888 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10889 (vector int)__b);
10892 static __inline__ vector bool short __ATTRS_o_ai
10893 vec_vsr(vector bool short __a, vector unsigned int __b) {
10894 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10895 (vector int)__b);
10898 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10899 vector unsigned char __b) {
10900 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10903 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10904 vector unsigned short __b) {
10905 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10908 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10909 vector unsigned int __b) {
10910 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10913 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10914 vector unsigned char __b) {
10915 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10918 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10919 vector unsigned short __b) {
10920 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10923 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10924 vector unsigned int __b) {
10925 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10928 static __inline__ vector unsigned int __ATTRS_o_ai
10929 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
10930 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10931 (vector int)__b);
10934 static __inline__ vector unsigned int __ATTRS_o_ai
10935 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
10936 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10937 (vector int)__b);
10940 static __inline__ vector unsigned int __ATTRS_o_ai
10941 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10942 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10943 (vector int)__b);
10946 static __inline__ vector bool int __ATTRS_o_ai
10947 vec_vsr(vector bool int __a, vector unsigned char __b) {
10948 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10949 (vector int)__b);
10952 static __inline__ vector bool int __ATTRS_o_ai
10953 vec_vsr(vector bool int __a, vector unsigned short __b) {
10954 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10955 (vector int)__b);
10958 static __inline__ vector bool int __ATTRS_o_ai
10959 vec_vsr(vector bool int __a, vector unsigned int __b) {
10960 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10961 (vector int)__b);
10964 /* vec_sro */
10966 static __inline__ vector signed char __ATTRS_o_ai
10967 vec_sro(vector signed char __a, vector signed char __b) {
10968 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10969 (vector int)__b);
10972 static __inline__ vector signed char __ATTRS_o_ai
10973 vec_sro(vector signed char __a, vector unsigned char __b) {
10974 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10975 (vector int)__b);
10978 static __inline__ vector unsigned char __ATTRS_o_ai
10979 vec_sro(vector unsigned char __a, vector signed char __b) {
10980 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10981 (vector int)__b);
10984 static __inline__ vector unsigned char __ATTRS_o_ai
10985 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10986 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10987 (vector int)__b);
10990 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10991 vector signed char __b) {
10992 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10995 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10996 vector unsigned char __b) {
10997 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11000 static __inline__ vector unsigned short __ATTRS_o_ai
11001 vec_sro(vector unsigned short __a, vector signed char __b) {
11002 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11003 (vector int)__b);
11006 static __inline__ vector unsigned short __ATTRS_o_ai
11007 vec_sro(vector unsigned short __a, vector unsigned char __b) {
11008 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11009 (vector int)__b);
11012 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11013 vector signed char __b) {
11014 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11017 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11018 vector unsigned char __b) {
11019 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11022 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11023 vector signed char __b) {
11024 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11027 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11028 vector unsigned char __b) {
11029 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11032 static __inline__ vector unsigned int __ATTRS_o_ai
11033 vec_sro(vector unsigned int __a, vector signed char __b) {
11034 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11035 (vector int)__b);
11038 static __inline__ vector unsigned int __ATTRS_o_ai
11039 vec_sro(vector unsigned int __a, vector unsigned char __b) {
11040 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11041 (vector int)__b);
11044 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11045 vector signed char __b) {
11046 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11049 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11050 vector unsigned char __b) {
11051 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11054 #ifdef __VSX__
11055 static __inline__ vector signed long long __ATTRS_o_ai
11056 vec_sro(vector signed long long __a, vector signed char __b) {
11057 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11058 (vector int)__b);
11061 static __inline__ vector signed long long __ATTRS_o_ai
11062 vec_sro(vector signed long long __a, vector unsigned char __b) {
11063 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11064 (vector int)__b);
11067 static __inline__ vector unsigned long long __ATTRS_o_ai
11068 vec_sro(vector unsigned long long __a, vector signed char __b) {
11069 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11070 (vector int)__b);
11073 static __inline__ vector unsigned long long __ATTRS_o_ai
11074 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
11075 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11076 (vector int)__b);
11078 #endif
11080 /* vec_vsro */
11082 static __inline__ vector signed char __ATTRS_o_ai
11083 vec_vsro(vector signed char __a, vector signed char __b) {
11084 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11085 (vector int)__b);
11088 static __inline__ vector signed char __ATTRS_o_ai
11089 vec_vsro(vector signed char __a, vector unsigned char __b) {
11090 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11091 (vector int)__b);
11094 static __inline__ vector unsigned char __ATTRS_o_ai
11095 vec_vsro(vector unsigned char __a, vector signed char __b) {
11096 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11097 (vector int)__b);
11100 static __inline__ vector unsigned char __ATTRS_o_ai
11101 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
11102 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11103 (vector int)__b);
11106 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11107 vector signed char __b) {
11108 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11111 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11112 vector unsigned char __b) {
11113 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11116 static __inline__ vector unsigned short __ATTRS_o_ai
11117 vec_vsro(vector unsigned short __a, vector signed char __b) {
11118 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11119 (vector int)__b);
11122 static __inline__ vector unsigned short __ATTRS_o_ai
11123 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
11124 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11125 (vector int)__b);
11128 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11129 vector signed char __b) {
11130 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11133 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11134 vector unsigned char __b) {
11135 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11138 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11139 vector signed char __b) {
11140 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11143 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11144 vector unsigned char __b) {
11145 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11148 static __inline__ vector unsigned int __ATTRS_o_ai
11149 vec_vsro(vector unsigned int __a, vector signed char __b) {
11150 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11151 (vector int)__b);
11154 static __inline__ vector unsigned int __ATTRS_o_ai
11155 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
11156 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11157 (vector int)__b);
11160 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11161 vector signed char __b) {
11162 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11165 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11166 vector unsigned char __b) {
11167 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11170 /* vec_st */
11172 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11173 vector signed char *__c) {
11174 __builtin_altivec_stvx((vector int)__a, __b, __c);
11177 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11178 signed char *__c) {
11179 __builtin_altivec_stvx((vector int)__a, __b, __c);
11182 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11183 vector unsigned char *__c) {
11184 __builtin_altivec_stvx((vector int)__a, __b, __c);
11187 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11188 unsigned char *__c) {
11189 __builtin_altivec_stvx((vector int)__a, __b, __c);
11192 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11193 signed char *__c) {
11194 __builtin_altivec_stvx((vector int)__a, __b, __c);
11197 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11198 unsigned char *__c) {
11199 __builtin_altivec_stvx((vector int)__a, __b, __c);
11202 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11203 vector bool char *__c) {
11204 __builtin_altivec_stvx((vector int)__a, __b, __c);
11207 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11208 vector short *__c) {
11209 __builtin_altivec_stvx((vector int)__a, __b, __c);
11212 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11213 short *__c) {
11214 __builtin_altivec_stvx((vector int)__a, __b, __c);
11217 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11218 vector unsigned short *__c) {
11219 __builtin_altivec_stvx((vector int)__a, __b, __c);
11222 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11223 unsigned short *__c) {
11224 __builtin_altivec_stvx((vector int)__a, __b, __c);
11227 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11228 short *__c) {
11229 __builtin_altivec_stvx((vector int)__a, __b, __c);
11232 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11233 unsigned short *__c) {
11234 __builtin_altivec_stvx((vector int)__a, __b, __c);
11237 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11238 vector bool short *__c) {
11239 __builtin_altivec_stvx((vector int)__a, __b, __c);
11242 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11243 short *__c) {
11244 __builtin_altivec_stvx((vector int)__a, __b, __c);
11247 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11248 unsigned short *__c) {
11249 __builtin_altivec_stvx((vector int)__a, __b, __c);
11252 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11253 vector pixel *__c) {
11254 __builtin_altivec_stvx((vector int)__a, __b, __c);
11257 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b,
11258 vector int *__c) {
11259 __builtin_altivec_stvx(__a, __b, __c);
11262 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) {
11263 __builtin_altivec_stvx(__a, __b, __c);
11266 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11267 vector unsigned int *__c) {
11268 __builtin_altivec_stvx((vector int)__a, __b, __c);
11271 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11272 unsigned int *__c) {
11273 __builtin_altivec_stvx((vector int)__a, __b, __c);
11276 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11277 int *__c) {
11278 __builtin_altivec_stvx((vector int)__a, __b, __c);
11281 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11282 unsigned int *__c) {
11283 __builtin_altivec_stvx((vector int)__a, __b, __c);
11286 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11287 vector bool int *__c) {
11288 __builtin_altivec_stvx((vector int)__a, __b, __c);
11291 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11292 vector float *__c) {
11293 __builtin_altivec_stvx((vector int)__a, __b, __c);
11296 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11297 float *__c) {
11298 __builtin_altivec_stvx((vector int)__a, __b, __c);
11301 /* vec_stvx */
11303 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11304 vector signed char *__c) {
11305 __builtin_altivec_stvx((vector int)__a, __b, __c);
11308 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11309 signed char *__c) {
11310 __builtin_altivec_stvx((vector int)__a, __b, __c);
11313 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11314 vector unsigned char *__c) {
11315 __builtin_altivec_stvx((vector int)__a, __b, __c);
11318 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11319 unsigned char *__c) {
11320 __builtin_altivec_stvx((vector int)__a, __b, __c);
11323 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11324 signed char *__c) {
11325 __builtin_altivec_stvx((vector int)__a, __b, __c);
11328 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11329 unsigned char *__c) {
11330 __builtin_altivec_stvx((vector int)__a, __b, __c);
11333 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11334 vector bool char *__c) {
11335 __builtin_altivec_stvx((vector int)__a, __b, __c);
11338 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11339 vector short *__c) {
11340 __builtin_altivec_stvx((vector int)__a, __b, __c);
11343 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11344 short *__c) {
11345 __builtin_altivec_stvx((vector int)__a, __b, __c);
11348 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11349 vector unsigned short *__c) {
11350 __builtin_altivec_stvx((vector int)__a, __b, __c);
11353 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11354 unsigned short *__c) {
11355 __builtin_altivec_stvx((vector int)__a, __b, __c);
11358 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11359 short *__c) {
11360 __builtin_altivec_stvx((vector int)__a, __b, __c);
11363 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11364 unsigned short *__c) {
11365 __builtin_altivec_stvx((vector int)__a, __b, __c);
11368 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11369 vector bool short *__c) {
11370 __builtin_altivec_stvx((vector int)__a, __b, __c);
11373 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11374 short *__c) {
11375 __builtin_altivec_stvx((vector int)__a, __b, __c);
11378 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11379 unsigned short *__c) {
11380 __builtin_altivec_stvx((vector int)__a, __b, __c);
11383 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11384 vector pixel *__c) {
11385 __builtin_altivec_stvx((vector int)__a, __b, __c);
11388 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11389 vector int *__c) {
11390 __builtin_altivec_stvx(__a, __b, __c);
11393 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11394 int *__c) {
11395 __builtin_altivec_stvx(__a, __b, __c);
11398 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11399 vector unsigned int *__c) {
11400 __builtin_altivec_stvx((vector int)__a, __b, __c);
11403 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11404 unsigned int *__c) {
11405 __builtin_altivec_stvx((vector int)__a, __b, __c);
11408 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11409 int *__c) {
11410 __builtin_altivec_stvx((vector int)__a, __b, __c);
11413 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11414 unsigned int *__c) {
11415 __builtin_altivec_stvx((vector int)__a, __b, __c);
11418 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11419 vector bool int *__c) {
11420 __builtin_altivec_stvx((vector int)__a, __b, __c);
11423 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11424 vector float *__c) {
11425 __builtin_altivec_stvx((vector int)__a, __b, __c);
11428 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11429 float *__c) {
11430 __builtin_altivec_stvx((vector int)__a, __b, __c);
11433 /* vec_ste */
11435 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b,
11436 signed char *__c) {
11437 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11440 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b,
11441 unsigned char *__c) {
11442 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11445 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11446 signed char *__c) {
11447 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11450 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11451 unsigned char *__c) {
11452 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11455 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b,
11456 short *__c) {
11457 __builtin_altivec_stvehx(__a, __b, __c);
11460 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b,
11461 unsigned short *__c) {
11462 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11465 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11466 short *__c) {
11467 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11470 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11471 unsigned short *__c) {
11472 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11475 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11476 short *__c) {
11477 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11480 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11481 unsigned short *__c) {
11482 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11485 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) {
11486 __builtin_altivec_stvewx(__a, __b, __c);
11489 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b,
11490 unsigned int *__c) {
11491 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11494 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11495 int *__c) {
11496 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11499 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11500 unsigned int *__c) {
11501 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11504 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b,
11505 float *__c) {
11506 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11509 /* vec_stvebx */
11511 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b,
11512 signed char *__c) {
11513 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11516 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
11517 long __b, unsigned char *__c) {
11518 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11521 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11522 signed char *__c) {
11523 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11526 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11527 unsigned char *__c) {
11528 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11531 /* vec_stvehx */
11533 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b,
11534 short *__c) {
11535 __builtin_altivec_stvehx(__a, __b, __c);
11538 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
11539 long __b, unsigned short *__c) {
11540 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11543 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11544 short *__c) {
11545 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11548 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11549 unsigned short *__c) {
11550 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11553 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11554 short *__c) {
11555 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11558 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11559 unsigned short *__c) {
11560 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11563 /* vec_stvewx */
11565 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b,
11566 int *__c) {
11567 __builtin_altivec_stvewx(__a, __b, __c);
11570 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b,
11571 unsigned int *__c) {
11572 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11575 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11576 int *__c) {
11577 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11580 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11581 unsigned int *__c) {
11582 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11585 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b,
11586 float *__c) {
11587 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11590 /* vec_stl */
11592 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11593 vector signed char *__c) {
11594 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11597 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11598 signed char *__c) {
11599 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11602 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11603 vector unsigned char *__c) {
11604 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11607 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11608 unsigned char *__c) {
11609 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11612 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11613 signed char *__c) {
11614 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11617 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11618 unsigned char *__c) {
11619 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11622 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11623 vector bool char *__c) {
11624 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11627 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11628 vector short *__c) {
11629 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11632 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11633 short *__c) {
11634 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11637 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11638 vector unsigned short *__c) {
11639 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11642 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11643 unsigned short *__c) {
11644 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11647 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11648 short *__c) {
11649 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11652 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11653 unsigned short *__c) {
11654 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11657 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11658 vector bool short *__c) {
11659 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11662 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11663 short *__c) {
11664 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11667 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11668 unsigned short *__c) {
11669 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11672 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11673 vector pixel *__c) {
11674 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11677 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
11678 vector int *__c) {
11679 __builtin_altivec_stvxl(__a, __b, __c);
11682 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
11683 __builtin_altivec_stvxl(__a, __b, __c);
11686 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11687 vector unsigned int *__c) {
11688 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11691 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11692 unsigned int *__c) {
11693 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11696 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11697 int *__c) {
11698 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11701 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11702 unsigned int *__c) {
11703 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11706 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11707 vector bool int *__c) {
11708 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11711 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11712 vector float *__c) {
11713 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11716 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11717 float *__c) {
11718 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11721 /* vec_stvxl */
11723 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11724 vector signed char *__c) {
11725 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11728 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11729 signed char *__c) {
11730 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11733 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11734 vector unsigned char *__c) {
11735 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11738 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11739 unsigned char *__c) {
11740 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11743 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11744 signed char *__c) {
11745 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11748 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11749 unsigned char *__c) {
11750 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11753 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11754 vector bool char *__c) {
11755 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11758 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11759 vector short *__c) {
11760 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11763 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11764 short *__c) {
11765 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11768 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11769 int __b,
11770 vector unsigned short *__c) {
11771 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11774 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11775 int __b, unsigned short *__c) {
11776 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11779 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11780 short *__c) {
11781 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11784 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11785 unsigned short *__c) {
11786 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11789 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11790 vector bool short *__c) {
11791 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11794 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11795 short *__c) {
11796 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11799 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11800 unsigned short *__c) {
11801 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11804 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11805 vector pixel *__c) {
11806 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11809 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11810 vector int *__c) {
11811 __builtin_altivec_stvxl(__a, __b, __c);
11814 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11815 int *__c) {
11816 __builtin_altivec_stvxl(__a, __b, __c);
11819 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11820 vector unsigned int *__c) {
11821 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11824 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11825 unsigned int *__c) {
11826 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11829 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11830 int *__c) {
11831 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11834 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11835 unsigned int *__c) {
11836 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11839 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11840 vector bool int *__c) {
11841 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11844 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11845 vector float *__c) {
11846 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11849 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11850 float *__c) {
11851 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11854 /* vec_sub */
11856 static __inline__ vector signed char __ATTRS_o_ai
11857 vec_sub(vector signed char __a, vector signed char __b) {
11858 return __a - __b;
11861 static __inline__ vector signed char __ATTRS_o_ai
11862 vec_sub(vector bool char __a, vector signed char __b) {
11863 return (vector signed char)__a - __b;
11866 static __inline__ vector signed char __ATTRS_o_ai
11867 vec_sub(vector signed char __a, vector bool char __b) {
11868 return __a - (vector signed char)__b;
11871 static __inline__ vector unsigned char __ATTRS_o_ai
11872 vec_sub(vector unsigned char __a, vector unsigned char __b) {
11873 return __a - __b;
11876 static __inline__ vector unsigned char __ATTRS_o_ai
11877 vec_sub(vector bool char __a, vector unsigned char __b) {
11878 return (vector unsigned char)__a - __b;
11881 static __inline__ vector unsigned char __ATTRS_o_ai
11882 vec_sub(vector unsigned char __a, vector bool char __b) {
11883 return __a - (vector unsigned char)__b;
11886 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11887 vector short __b) {
11888 return __a - __b;
11891 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
11892 vector short __b) {
11893 return (vector short)__a - __b;
11896 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11897 vector bool short __b) {
11898 return __a - (vector short)__b;
11901 static __inline__ vector unsigned short __ATTRS_o_ai
11902 vec_sub(vector unsigned short __a, vector unsigned short __b) {
11903 return __a - __b;
11906 static __inline__ vector unsigned short __ATTRS_o_ai
11907 vec_sub(vector bool short __a, vector unsigned short __b) {
11908 return (vector unsigned short)__a - __b;
11911 static __inline__ vector unsigned short __ATTRS_o_ai
11912 vec_sub(vector unsigned short __a, vector bool short __b) {
11913 return __a - (vector unsigned short)__b;
11916 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11917 vector int __b) {
11918 return __a - __b;
11921 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
11922 vector int __b) {
11923 return (vector int)__a - __b;
11926 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11927 vector bool int __b) {
11928 return __a - (vector int)__b;
11931 static __inline__ vector unsigned int __ATTRS_o_ai
11932 vec_sub(vector unsigned int __a, vector unsigned int __b) {
11933 return __a - __b;
11936 static __inline__ vector unsigned int __ATTRS_o_ai
11937 vec_sub(vector bool int __a, vector unsigned int __b) {
11938 return (vector unsigned int)__a - __b;
11941 static __inline__ vector unsigned int __ATTRS_o_ai
11942 vec_sub(vector unsigned int __a, vector bool int __b) {
11943 return __a - (vector unsigned int)__b;
11946 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
11947 defined(__SIZEOF_INT128__)
11948 static __inline__ vector signed __int128 __ATTRS_o_ai
11949 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11950 return __a - __b;
11953 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11954 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11955 return __a - __b;
11957 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) &&
11958 // defined(__SIZEOF_INT128__)
11960 #ifdef __VSX__
11961 static __inline__ vector signed long long __ATTRS_o_ai
11962 vec_sub(vector signed long long __a, vector signed long long __b) {
11963 return __a - __b;
11966 static __inline__ vector unsigned long long __ATTRS_o_ai
11967 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11968 return __a - __b;
11971 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11972 vector double __b) {
11973 return __a - __b;
11975 #endif
11977 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11978 vector float __b) {
11979 return __a - __b;
11982 /* vec_vsububm */
11984 #define __builtin_altivec_vsububm vec_vsububm
11986 static __inline__ vector signed char __ATTRS_o_ai
11987 vec_vsububm(vector signed char __a, vector signed char __b) {
11988 return __a - __b;
11991 static __inline__ vector signed char __ATTRS_o_ai
11992 vec_vsububm(vector bool char __a, vector signed char __b) {
11993 return (vector signed char)__a - __b;
11996 static __inline__ vector signed char __ATTRS_o_ai
11997 vec_vsububm(vector signed char __a, vector bool char __b) {
11998 return __a - (vector signed char)__b;
12001 static __inline__ vector unsigned char __ATTRS_o_ai
12002 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
12003 return __a - __b;
12006 static __inline__ vector unsigned char __ATTRS_o_ai
12007 vec_vsububm(vector bool char __a, vector unsigned char __b) {
12008 return (vector unsigned char)__a - __b;
12011 static __inline__ vector unsigned char __ATTRS_o_ai
12012 vec_vsububm(vector unsigned char __a, vector bool char __b) {
12013 return __a - (vector unsigned char)__b;
12016 /* vec_vsubuhm */
12018 #define __builtin_altivec_vsubuhm vec_vsubuhm
12020 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12021 vector short __b) {
12022 return __a - __b;
12025 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
12026 vector short __b) {
12027 return (vector short)__a - __b;
12030 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12031 vector bool short __b) {
12032 return __a - (vector short)__b;
12035 static __inline__ vector unsigned short __ATTRS_o_ai
12036 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
12037 return __a - __b;
12040 static __inline__ vector unsigned short __ATTRS_o_ai
12041 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
12042 return (vector unsigned short)__a - __b;
12045 static __inline__ vector unsigned short __ATTRS_o_ai
12046 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
12047 return __a - (vector unsigned short)__b;
12050 /* vec_vsubuwm */
12052 #define __builtin_altivec_vsubuwm vec_vsubuwm
12054 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12055 vector int __b) {
12056 return __a - __b;
12059 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
12060 vector int __b) {
12061 return (vector int)__a - __b;
12064 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12065 vector bool int __b) {
12066 return __a - (vector int)__b;
12069 static __inline__ vector unsigned int __ATTRS_o_ai
12070 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
12071 return __a - __b;
12074 static __inline__ vector unsigned int __ATTRS_o_ai
12075 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
12076 return (vector unsigned int)__a - __b;
12079 static __inline__ vector unsigned int __ATTRS_o_ai
12080 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
12081 return __a - (vector unsigned int)__b;
12084 /* vec_vsubfp */
12086 #define __builtin_altivec_vsubfp vec_vsubfp
12088 static __inline__ vector float __attribute__((__always_inline__))
12089 vec_vsubfp(vector float __a, vector float __b) {
12090 return __a - __b;
12093 /* vec_subc */
12095 static __inline__ vector signed int __ATTRS_o_ai
12096 vec_subc(vector signed int __a, vector signed int __b) {
12097 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
12098 (vector unsigned int) __b);
12101 static __inline__ vector unsigned int __ATTRS_o_ai
12102 vec_subc(vector unsigned int __a, vector unsigned int __b) {
12103 return __builtin_altivec_vsubcuw(__a, __b);
12106 #ifdef __POWER8_VECTOR__
12107 #ifdef __SIZEOF_INT128__
12108 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12109 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12110 return __builtin_altivec_vsubcuq(__a, __b);
12113 static __inline__ vector signed __int128 __ATTRS_o_ai
12114 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
12115 return (vector signed __int128)__builtin_altivec_vsubcuq(
12116 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12118 #endif
12120 static __inline__ vector unsigned char __attribute__((__always_inline__))
12121 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) {
12122 return (vector unsigned char)__builtin_altivec_vsubcuq_c(
12123 (vector unsigned char)__a, (vector unsigned char)__b);
12125 #endif // __POWER8_VECTOR__
12127 /* vec_vsubcuw */
12129 static __inline__ vector unsigned int __attribute__((__always_inline__))
12130 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
12131 return __builtin_altivec_vsubcuw(__a, __b);
12134 /* vec_subs */
12136 static __inline__ vector signed char __ATTRS_o_ai
12137 vec_subs(vector signed char __a, vector signed char __b) {
12138 return __builtin_altivec_vsubsbs(__a, __b);
12141 static __inline__ vector signed char __ATTRS_o_ai
12142 vec_subs(vector bool char __a, vector signed char __b) {
12143 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12146 static __inline__ vector signed char __ATTRS_o_ai
12147 vec_subs(vector signed char __a, vector bool char __b) {
12148 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12151 static __inline__ vector unsigned char __ATTRS_o_ai
12152 vec_subs(vector unsigned char __a, vector unsigned char __b) {
12153 return __builtin_altivec_vsububs(__a, __b);
12156 static __inline__ vector unsigned char __ATTRS_o_ai
12157 vec_subs(vector bool char __a, vector unsigned char __b) {
12158 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12161 static __inline__ vector unsigned char __ATTRS_o_ai
12162 vec_subs(vector unsigned char __a, vector bool char __b) {
12163 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12166 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12167 vector short __b) {
12168 return __builtin_altivec_vsubshs(__a, __b);
12171 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
12172 vector short __b) {
12173 return __builtin_altivec_vsubshs((vector short)__a, __b);
12176 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12177 vector bool short __b) {
12178 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12181 static __inline__ vector unsigned short __ATTRS_o_ai
12182 vec_subs(vector unsigned short __a, vector unsigned short __b) {
12183 return __builtin_altivec_vsubuhs(__a, __b);
12186 static __inline__ vector unsigned short __ATTRS_o_ai
12187 vec_subs(vector bool short __a, vector unsigned short __b) {
12188 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12191 static __inline__ vector unsigned short __ATTRS_o_ai
12192 vec_subs(vector unsigned short __a, vector bool short __b) {
12193 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12196 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12197 vector int __b) {
12198 return __builtin_altivec_vsubsws(__a, __b);
12201 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
12202 vector int __b) {
12203 return __builtin_altivec_vsubsws((vector int)__a, __b);
12206 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12207 vector bool int __b) {
12208 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12211 static __inline__ vector unsigned int __ATTRS_o_ai
12212 vec_subs(vector unsigned int __a, vector unsigned int __b) {
12213 return __builtin_altivec_vsubuws(__a, __b);
12216 static __inline__ vector unsigned int __ATTRS_o_ai
12217 vec_subs(vector bool int __a, vector unsigned int __b) {
12218 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12221 static __inline__ vector unsigned int __ATTRS_o_ai
12222 vec_subs(vector unsigned int __a, vector bool int __b) {
12223 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12226 /* vec_vsubsbs */
12228 static __inline__ vector signed char __ATTRS_o_ai
12229 vec_vsubsbs(vector signed char __a, vector signed char __b) {
12230 return __builtin_altivec_vsubsbs(__a, __b);
12233 static __inline__ vector signed char __ATTRS_o_ai
12234 vec_vsubsbs(vector bool char __a, vector signed char __b) {
12235 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12238 static __inline__ vector signed char __ATTRS_o_ai
12239 vec_vsubsbs(vector signed char __a, vector bool char __b) {
12240 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12243 /* vec_vsububs */
12245 static __inline__ vector unsigned char __ATTRS_o_ai
12246 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
12247 return __builtin_altivec_vsububs(__a, __b);
12250 static __inline__ vector unsigned char __ATTRS_o_ai
12251 vec_vsububs(vector bool char __a, vector unsigned char __b) {
12252 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12255 static __inline__ vector unsigned char __ATTRS_o_ai
12256 vec_vsububs(vector unsigned char __a, vector bool char __b) {
12257 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12260 /* vec_vsubshs */
12262 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12263 vector short __b) {
12264 return __builtin_altivec_vsubshs(__a, __b);
12267 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
12268 vector short __b) {
12269 return __builtin_altivec_vsubshs((vector short)__a, __b);
12272 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12273 vector bool short __b) {
12274 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12277 /* vec_vsubuhs */
12279 static __inline__ vector unsigned short __ATTRS_o_ai
12280 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
12281 return __builtin_altivec_vsubuhs(__a, __b);
12284 static __inline__ vector unsigned short __ATTRS_o_ai
12285 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
12286 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12289 static __inline__ vector unsigned short __ATTRS_o_ai
12290 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
12291 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12294 /* vec_vsubsws */
12296 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12297 vector int __b) {
12298 return __builtin_altivec_vsubsws(__a, __b);
12301 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
12302 vector int __b) {
12303 return __builtin_altivec_vsubsws((vector int)__a, __b);
12306 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12307 vector bool int __b) {
12308 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12311 /* vec_vsubuws */
12313 static __inline__ vector unsigned int __ATTRS_o_ai
12314 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
12315 return __builtin_altivec_vsubuws(__a, __b);
12318 static __inline__ vector unsigned int __ATTRS_o_ai
12319 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
12320 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12323 static __inline__ vector unsigned int __ATTRS_o_ai
12324 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
12325 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12328 #ifdef __POWER8_VECTOR__
12329 /* vec_vsubuqm */
12331 #ifdef __SIZEOF_INT128__
12332 static __inline__ vector signed __int128 __ATTRS_o_ai
12333 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
12334 return __a - __b;
12337 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12338 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12339 return __a - __b;
12341 #endif
12343 static __inline__ vector unsigned char __attribute__((__always_inline__))
12344 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) {
12345 return (vector unsigned char)__builtin_altivec_vsubuqm(__a, __b);
12348 /* vec_vsubeuqm */
12350 #ifdef __SIZEOF_INT128__
12351 static __inline__ vector signed __int128 __ATTRS_o_ai
12352 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
12353 vector signed __int128 __c) {
12354 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12355 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12356 (vector unsigned __int128)__c);
12359 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12360 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
12361 vector unsigned __int128 __c) {
12362 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12365 static __inline__ vector signed __int128 __ATTRS_o_ai
12366 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
12367 vector signed __int128 __c) {
12368 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12369 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12370 (vector unsigned __int128)__c);
12373 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12374 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
12375 vector unsigned __int128 __c) {
12376 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12378 #endif
12380 static __inline__ vector unsigned char __attribute__((__always_inline__))
12381 vec_sube_u128(vector unsigned char __a, vector unsigned char __b,
12382 vector unsigned char __c) {
12383 return (vector unsigned char)__builtin_altivec_vsubeuqm_c(
12384 (vector unsigned char)__a, (vector unsigned char)__b,
12385 (vector unsigned char)__c);
12388 /* vec_vsubcuq */
12390 #ifdef __SIZEOF_INT128__
12391 static __inline__ vector signed __int128 __ATTRS_o_ai
12392 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
12393 return (vector signed __int128)__builtin_altivec_vsubcuq(
12394 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12397 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12398 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12399 return __builtin_altivec_vsubcuq(__a, __b);
12402 /* vec_vsubecuq */
12404 static __inline__ vector signed __int128 __ATTRS_o_ai
12405 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
12406 vector signed __int128 __c) {
12407 return (vector signed __int128)__builtin_altivec_vsubecuq(
12408 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12409 (vector unsigned __int128)__c);
12412 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12413 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
12414 vector unsigned __int128 __c) {
12415 return __builtin_altivec_vsubecuq(__a, __b, __c);
12417 #endif
12419 #ifdef __powerpc64__
12420 static __inline__ vector signed int __ATTRS_o_ai
12421 vec_subec(vector signed int __a, vector signed int __b,
12422 vector signed int __c) {
12423 return vec_addec(__a, ~__b, __c);
12426 static __inline__ vector unsigned int __ATTRS_o_ai
12427 vec_subec(vector unsigned int __a, vector unsigned int __b,
12428 vector unsigned int __c) {
12429 return vec_addec(__a, ~__b, __c);
12431 #endif
12433 #ifdef __SIZEOF_INT128__
12434 static __inline__ vector signed __int128 __ATTRS_o_ai
12435 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
12436 vector signed __int128 __c) {
12437 return (vector signed __int128)__builtin_altivec_vsubecuq(
12438 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12439 (vector unsigned __int128)__c);
12442 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12443 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
12444 vector unsigned __int128 __c) {
12445 return __builtin_altivec_vsubecuq(__a, __b, __c);
12447 #endif
12449 static __inline__ vector unsigned char __attribute__((__always_inline__))
12450 vec_subec_u128(vector unsigned char __a, vector unsigned char __b,
12451 vector unsigned char __c) {
12452 return (vector unsigned char)__builtin_altivec_vsubecuq_c(
12453 (vector unsigned char)__a, (vector unsigned char)__b,
12454 (vector unsigned char)__c);
12456 #endif // __POWER8_VECTOR__
12458 static __inline__ vector signed int __ATTRS_o_ai
12459 vec_sube(vector signed int __a, vector signed int __b,
12460 vector signed int __c) {
12461 vector signed int __mask = {1, 1, 1, 1};
12462 vector signed int __carry = __c & __mask;
12463 return vec_adde(__a, ~__b, __carry);
12466 static __inline__ vector unsigned int __ATTRS_o_ai
12467 vec_sube(vector unsigned int __a, vector unsigned int __b,
12468 vector unsigned int __c) {
12469 vector unsigned int __mask = {1, 1, 1, 1};
12470 vector unsigned int __carry = __c & __mask;
12471 return vec_adde(__a, ~__b, __carry);
12473 /* vec_sum4s */
12475 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
12476 vector int __b) {
12477 return __builtin_altivec_vsum4sbs(__a, __b);
12480 static __inline__ vector unsigned int __ATTRS_o_ai
12481 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
12482 return __builtin_altivec_vsum4ubs(__a, __b);
12485 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
12486 vector int __b) {
12487 return __builtin_altivec_vsum4shs(__a, __b);
12490 /* vec_vsum4sbs */
12492 static __inline__ vector int __attribute__((__always_inline__))
12493 vec_vsum4sbs(vector signed char __a, vector int __b) {
12494 return __builtin_altivec_vsum4sbs(__a, __b);
12497 /* vec_vsum4ubs */
12499 static __inline__ vector unsigned int __attribute__((__always_inline__))
12500 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
12501 return __builtin_altivec_vsum4ubs(__a, __b);
12504 /* vec_vsum4shs */
12506 static __inline__ vector int __attribute__((__always_inline__))
12507 vec_vsum4shs(vector signed short __a, vector int __b) {
12508 return __builtin_altivec_vsum4shs(__a, __b);
12511 /* vec_sum2s */
12513 /* The vsum2sws instruction has a big-endian bias, so that the second
12514 input vector and the result always reference big-endian elements
12515 1 and 3 (little-endian element 0 and 2). For ease of porting the
12516 programmer wants elements 1 and 3 in both cases, so for little
12517 endian we must perform some permutes. */
12519 static __inline__ vector signed int __attribute__((__always_inline__))
12520 vec_sum2s(vector int __a, vector int __b) {
12521 #ifdef __LITTLE_ENDIAN__
12522 vector int __c = (vector signed int)vec_perm(
12523 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12524 8, 9, 10, 11));
12525 __c = __builtin_altivec_vsum2sws(__a, __c);
12526 return (vector signed int)vec_perm(
12527 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12528 8, 9, 10, 11));
12529 #else
12530 return __builtin_altivec_vsum2sws(__a, __b);
12531 #endif
12534 /* vec_vsum2sws */
12536 static __inline__ vector signed int __attribute__((__always_inline__))
12537 vec_vsum2sws(vector int __a, vector int __b) {
12538 #ifdef __LITTLE_ENDIAN__
12539 vector int __c = (vector signed int)vec_perm(
12540 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12541 8, 9, 10, 11));
12542 __c = __builtin_altivec_vsum2sws(__a, __c);
12543 return (vector signed int)vec_perm(
12544 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12545 8, 9, 10, 11));
12546 #else
12547 return __builtin_altivec_vsum2sws(__a, __b);
12548 #endif
12551 /* vec_sums */
12553 /* The vsumsws instruction has a big-endian bias, so that the second
12554 input vector and the result always reference big-endian element 3
12555 (little-endian element 0). For ease of porting the programmer
12556 wants element 3 in both cases, so for little endian we must perform
12557 some permutes. */
12559 static __inline__ vector signed int __attribute__((__always_inline__))
12560 vec_sums(vector signed int __a, vector signed int __b) {
12561 #ifdef __LITTLE_ENDIAN__
12562 __b = (vector signed int)vec_splat(__b, 3);
12563 __b = __builtin_altivec_vsumsws(__a, __b);
12564 return (vector signed int)(0, 0, 0, __b[0]);
12565 #else
12566 return __builtin_altivec_vsumsws(__a, __b);
12567 #endif
12570 /* vec_vsumsws */
12572 static __inline__ vector signed int __attribute__((__always_inline__))
12573 vec_vsumsws(vector signed int __a, vector signed int __b) {
12574 #ifdef __LITTLE_ENDIAN__
12575 __b = (vector signed int)vec_splat(__b, 3);
12576 __b = __builtin_altivec_vsumsws(__a, __b);
12577 return (vector signed int)(0, 0, 0, __b[0]);
12578 #else
12579 return __builtin_altivec_vsumsws(__a, __b);
12580 #endif
12583 /* vec_trunc */
12585 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
12586 #ifdef __VSX__
12587 return __builtin_vsx_xvrspiz(__a);
12588 #else
12589 return __builtin_altivec_vrfiz(__a);
12590 #endif
12593 #ifdef __VSX__
12594 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
12595 return __builtin_vsx_xvrdpiz(__a);
12597 #endif
12599 /* vec_roundz */
12600 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) {
12601 return vec_trunc(__a);
12604 #ifdef __VSX__
12605 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) {
12606 return vec_trunc(__a);
12608 #endif
12610 /* vec_vrfiz */
12612 static __inline__ vector float __attribute__((__always_inline__))
12613 vec_vrfiz(vector float __a) {
12614 return __builtin_altivec_vrfiz(__a);
12617 /* vec_unpackh */
12619 /* The vector unpack instructions all have a big-endian bias, so for
12620 little endian we must reverse the meanings of "high" and "low." */
12621 #ifdef __LITTLE_ENDIAN__
12622 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12623 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12624 #else
12625 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12626 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12627 #endif
12629 static __inline__ vector short __ATTRS_o_ai
12630 vec_unpackh(vector signed char __a) {
12631 #ifdef __LITTLE_ENDIAN__
12632 return __builtin_altivec_vupklsb((vector char)__a);
12633 #else
12634 return __builtin_altivec_vupkhsb((vector char)__a);
12635 #endif
12638 static __inline__ vector bool short __ATTRS_o_ai
12639 vec_unpackh(vector bool char __a) {
12640 #ifdef __LITTLE_ENDIAN__
12641 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12642 #else
12643 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12644 #endif
12647 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
12648 #ifdef __LITTLE_ENDIAN__
12649 return __builtin_altivec_vupklsh(__a);
12650 #else
12651 return __builtin_altivec_vupkhsh(__a);
12652 #endif
12655 static __inline__ vector bool int __ATTRS_o_ai
12656 vec_unpackh(vector bool short __a) {
12657 #ifdef __LITTLE_ENDIAN__
12658 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12659 #else
12660 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12661 #endif
12664 static __inline__ vector unsigned int __ATTRS_o_ai
12665 vec_unpackh(vector pixel __a) {
12666 #ifdef __LITTLE_ENDIAN__
12667 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12668 #else
12669 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12670 #endif
12673 #ifdef __POWER8_VECTOR__
12674 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
12675 #ifdef __LITTLE_ENDIAN__
12676 return __builtin_altivec_vupklsw(__a);
12677 #else
12678 return __builtin_altivec_vupkhsw(__a);
12679 #endif
12682 static __inline__ vector bool long long __ATTRS_o_ai
12683 vec_unpackh(vector bool int __a) {
12684 #ifdef __LITTLE_ENDIAN__
12685 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12686 #else
12687 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12688 #endif
12691 static __inline__ vector double __ATTRS_o_ai
12692 vec_unpackh(vector float __a) {
12693 return (vector double)(__a[0], __a[1]);
12695 #endif
12697 /* vec_vupkhsb */
12699 static __inline__ vector short __ATTRS_o_ai
12700 vec_vupkhsb(vector signed char __a) {
12701 #ifdef __LITTLE_ENDIAN__
12702 return __builtin_altivec_vupklsb((vector char)__a);
12703 #else
12704 return __builtin_altivec_vupkhsb((vector char)__a);
12705 #endif
12708 static __inline__ vector bool short __ATTRS_o_ai
12709 vec_vupkhsb(vector bool char __a) {
12710 #ifdef __LITTLE_ENDIAN__
12711 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12712 #else
12713 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12714 #endif
12717 /* vec_vupkhsh */
12719 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
12720 #ifdef __LITTLE_ENDIAN__
12721 return __builtin_altivec_vupklsh(__a);
12722 #else
12723 return __builtin_altivec_vupkhsh(__a);
12724 #endif
12727 static __inline__ vector bool int __ATTRS_o_ai
12728 vec_vupkhsh(vector bool short __a) {
12729 #ifdef __LITTLE_ENDIAN__
12730 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12731 #else
12732 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12733 #endif
12736 static __inline__ vector unsigned int __ATTRS_o_ai
12737 vec_vupkhsh(vector pixel __a) {
12738 #ifdef __LITTLE_ENDIAN__
12739 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12740 #else
12741 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12742 #endif
12745 /* vec_vupkhsw */
12747 #ifdef __POWER8_VECTOR__
12748 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
12749 #ifdef __LITTLE_ENDIAN__
12750 return __builtin_altivec_vupklsw(__a);
12751 #else
12752 return __builtin_altivec_vupkhsw(__a);
12753 #endif
12756 static __inline__ vector bool long long __ATTRS_o_ai
12757 vec_vupkhsw(vector bool int __a) {
12758 #ifdef __LITTLE_ENDIAN__
12759 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12760 #else
12761 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12762 #endif
12764 #endif
12766 /* vec_unpackl */
12768 static __inline__ vector short __ATTRS_o_ai
12769 vec_unpackl(vector signed char __a) {
12770 #ifdef __LITTLE_ENDIAN__
12771 return __builtin_altivec_vupkhsb((vector char)__a);
12772 #else
12773 return __builtin_altivec_vupklsb((vector char)__a);
12774 #endif
12777 static __inline__ vector bool short __ATTRS_o_ai
12778 vec_unpackl(vector bool char __a) {
12779 #ifdef __LITTLE_ENDIAN__
12780 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12781 #else
12782 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12783 #endif
12786 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
12787 #ifdef __LITTLE_ENDIAN__
12788 return __builtin_altivec_vupkhsh(__a);
12789 #else
12790 return __builtin_altivec_vupklsh(__a);
12791 #endif
12794 static __inline__ vector bool int __ATTRS_o_ai
12795 vec_unpackl(vector bool short __a) {
12796 #ifdef __LITTLE_ENDIAN__
12797 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12798 #else
12799 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12800 #endif
12803 static __inline__ vector unsigned int __ATTRS_o_ai
12804 vec_unpackl(vector pixel __a) {
12805 #ifdef __LITTLE_ENDIAN__
12806 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12807 #else
12808 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12809 #endif
12812 #ifdef __POWER8_VECTOR__
12813 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
12814 #ifdef __LITTLE_ENDIAN__
12815 return __builtin_altivec_vupkhsw(__a);
12816 #else
12817 return __builtin_altivec_vupklsw(__a);
12818 #endif
12821 static __inline__ vector bool long long __ATTRS_o_ai
12822 vec_unpackl(vector bool int __a) {
12823 #ifdef __LITTLE_ENDIAN__
12824 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12825 #else
12826 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12827 #endif
12830 static __inline__ vector double __ATTRS_o_ai
12831 vec_unpackl(vector float __a) {
12832 return (vector double)(__a[2], __a[3]);
12834 #endif
12836 /* vec_vupklsb */
12838 static __inline__ vector short __ATTRS_o_ai
12839 vec_vupklsb(vector signed char __a) {
12840 #ifdef __LITTLE_ENDIAN__
12841 return __builtin_altivec_vupkhsb((vector char)__a);
12842 #else
12843 return __builtin_altivec_vupklsb((vector char)__a);
12844 #endif
12847 static __inline__ vector bool short __ATTRS_o_ai
12848 vec_vupklsb(vector bool char __a) {
12849 #ifdef __LITTLE_ENDIAN__
12850 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12851 #else
12852 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12853 #endif
12856 /* vec_vupklsh */
12858 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
12859 #ifdef __LITTLE_ENDIAN__
12860 return __builtin_altivec_vupkhsh(__a);
12861 #else
12862 return __builtin_altivec_vupklsh(__a);
12863 #endif
12866 static __inline__ vector bool int __ATTRS_o_ai
12867 vec_vupklsh(vector bool short __a) {
12868 #ifdef __LITTLE_ENDIAN__
12869 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12870 #else
12871 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12872 #endif
12875 static __inline__ vector unsigned int __ATTRS_o_ai
12876 vec_vupklsh(vector pixel __a) {
12877 #ifdef __LITTLE_ENDIAN__
12878 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12879 #else
12880 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12881 #endif
12884 /* vec_vupklsw */
12886 #ifdef __POWER8_VECTOR__
12887 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
12888 #ifdef __LITTLE_ENDIAN__
12889 return __builtin_altivec_vupkhsw(__a);
12890 #else
12891 return __builtin_altivec_vupklsw(__a);
12892 #endif
12895 static __inline__ vector bool long long __ATTRS_o_ai
12896 vec_vupklsw(vector bool int __a) {
12897 #ifdef __LITTLE_ENDIAN__
12898 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12899 #else
12900 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12901 #endif
12903 #endif
12905 /* vec_vsx_ld */
12907 #ifdef __VSX__
12909 static __inline__ vector bool int __ATTRS_o_ai
12910 vec_vsx_ld(int __a, const vector bool int *__b) {
12911 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
12914 static __inline__ vector signed int __ATTRS_o_ai
12915 vec_vsx_ld(int __a, const vector signed int *__b) {
12916 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12919 static __inline__ vector signed int __ATTRS_o_ai
12920 vec_vsx_ld(int __a, const signed int *__b) {
12921 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12924 static __inline__ vector unsigned int __ATTRS_o_ai
12925 vec_vsx_ld(int __a, const vector unsigned int *__b) {
12926 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12929 static __inline__ vector unsigned int __ATTRS_o_ai
12930 vec_vsx_ld(int __a, const unsigned int *__b) {
12931 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12934 static __inline__ vector float __ATTRS_o_ai
12935 vec_vsx_ld(int __a, const vector float *__b) {
12936 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12939 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
12940 const float *__b) {
12941 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12944 static __inline__ vector signed long long __ATTRS_o_ai
12945 vec_vsx_ld(int __a, const vector signed long long *__b) {
12946 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
12949 static __inline__ vector unsigned long long __ATTRS_o_ai
12950 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
12951 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
12954 static __inline__ vector double __ATTRS_o_ai
12955 vec_vsx_ld(int __a, const vector double *__b) {
12956 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12959 static __inline__ vector double __ATTRS_o_ai
12960 vec_vsx_ld(int __a, const double *__b) {
12961 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12964 static __inline__ vector bool short __ATTRS_o_ai
12965 vec_vsx_ld(int __a, const vector bool short *__b) {
12966 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
12969 static __inline__ vector signed short __ATTRS_o_ai
12970 vec_vsx_ld(int __a, const vector signed short *__b) {
12971 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12974 static __inline__ vector signed short __ATTRS_o_ai
12975 vec_vsx_ld(int __a, const signed short *__b) {
12976 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12979 static __inline__ vector unsigned short __ATTRS_o_ai
12980 vec_vsx_ld(int __a, const vector unsigned short *__b) {
12981 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12984 static __inline__ vector unsigned short __ATTRS_o_ai
12985 vec_vsx_ld(int __a, const unsigned short *__b) {
12986 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12989 static __inline__ vector bool char __ATTRS_o_ai
12990 vec_vsx_ld(int __a, const vector bool char *__b) {
12991 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
12994 static __inline__ vector signed char __ATTRS_o_ai
12995 vec_vsx_ld(int __a, const vector signed char *__b) {
12996 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
12999 static __inline__ vector signed char __ATTRS_o_ai
13000 vec_vsx_ld(int __a, const signed char *__b) {
13001 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13004 static __inline__ vector unsigned char __ATTRS_o_ai
13005 vec_vsx_ld(int __a, const vector unsigned char *__b) {
13006 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13009 static __inline__ vector unsigned char __ATTRS_o_ai
13010 vec_vsx_ld(int __a, const unsigned char *__b) {
13011 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13014 #endif
13016 /* vec_vsx_st */
13018 #ifdef __VSX__
13020 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13021 vector bool int *__c) {
13022 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13025 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13026 signed int *__c) {
13027 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13030 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13031 unsigned int *__c) {
13032 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13035 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13036 vector signed int *__c) {
13037 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13040 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13041 signed int *__c) {
13042 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13045 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13046 vector unsigned int *__c) {
13047 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13050 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13051 unsigned int *__c) {
13052 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13055 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13056 vector float *__c) {
13057 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13060 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13061 float *__c) {
13062 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13065 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
13066 int __b,
13067 vector signed long long *__c) {
13068 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13071 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
13072 int __b,
13073 vector unsigned long long *__c) {
13074 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13077 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13078 vector double *__c) {
13079 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13082 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13083 double *__c) {
13084 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13087 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13088 vector bool short *__c) {
13089 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13092 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13093 signed short *__c) {
13094 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13097 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13098 unsigned short *__c) {
13099 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13101 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13102 vector signed short *__c) {
13103 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13106 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13107 signed short *__c) {
13108 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13111 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13112 int __b,
13113 vector unsigned short *__c) {
13114 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13117 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13118 int __b, unsigned short *__c) {
13119 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13122 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13123 vector bool char *__c) {
13124 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13127 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13128 signed char *__c) {
13129 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13132 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13133 unsigned char *__c) {
13134 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13137 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13138 vector signed char *__c) {
13139 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13142 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13143 signed char *__c) {
13144 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13147 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13148 int __b,
13149 vector unsigned char *__c) {
13150 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13153 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13154 int __b, unsigned char *__c) {
13155 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13158 #endif
13160 #ifdef __VSX__
13161 #define vec_xxpermdi __builtin_vsx_xxpermdi
13162 #define vec_xxsldwi __builtin_vsx_xxsldwi
13163 #define vec_permi(__a, __b, __c) \
13164 _Generic((__a), vector signed long long \
13165 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13166 (((__c)&0x1) + 2)), \
13167 vector unsigned long long \
13168 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13169 (((__c)&0x1) + 2)), \
13170 vector double \
13171 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13172 (((__c)&0x1) + 2)))
13173 #endif
13175 /* vec_xor */
13177 #define __builtin_altivec_vxor vec_xor
13179 static __inline__ vector signed char __ATTRS_o_ai
13180 vec_xor(vector signed char __a, vector signed char __b) {
13181 return __a ^ __b;
13184 static __inline__ vector signed char __ATTRS_o_ai
13185 vec_xor(vector bool char __a, vector signed char __b) {
13186 return (vector signed char)__a ^ __b;
13189 static __inline__ vector signed char __ATTRS_o_ai
13190 vec_xor(vector signed char __a, vector bool char __b) {
13191 return __a ^ (vector signed char)__b;
13194 static __inline__ vector unsigned char __ATTRS_o_ai
13195 vec_xor(vector unsigned char __a, vector unsigned char __b) {
13196 return __a ^ __b;
13199 static __inline__ vector unsigned char __ATTRS_o_ai
13200 vec_xor(vector bool char __a, vector unsigned char __b) {
13201 return (vector unsigned char)__a ^ __b;
13204 static __inline__ vector unsigned char __ATTRS_o_ai
13205 vec_xor(vector unsigned char __a, vector bool char __b) {
13206 return __a ^ (vector unsigned char)__b;
13209 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
13210 vector bool char __b) {
13211 return __a ^ __b;
13214 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13215 vector short __b) {
13216 return __a ^ __b;
13219 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
13220 vector short __b) {
13221 return (vector short)__a ^ __b;
13224 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13225 vector bool short __b) {
13226 return __a ^ (vector short)__b;
13229 static __inline__ vector unsigned short __ATTRS_o_ai
13230 vec_xor(vector unsigned short __a, vector unsigned short __b) {
13231 return __a ^ __b;
13234 static __inline__ vector unsigned short __ATTRS_o_ai
13235 vec_xor(vector bool short __a, vector unsigned short __b) {
13236 return (vector unsigned short)__a ^ __b;
13239 static __inline__ vector unsigned short __ATTRS_o_ai
13240 vec_xor(vector unsigned short __a, vector bool short __b) {
13241 return __a ^ (vector unsigned short)__b;
13244 static __inline__ vector bool short __ATTRS_o_ai
13245 vec_xor(vector bool short __a, vector bool short __b) {
13246 return __a ^ __b;
13249 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13250 vector int __b) {
13251 return __a ^ __b;
13254 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
13255 vector int __b) {
13256 return (vector int)__a ^ __b;
13259 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13260 vector bool int __b) {
13261 return __a ^ (vector int)__b;
13264 static __inline__ vector unsigned int __ATTRS_o_ai
13265 vec_xor(vector unsigned int __a, vector unsigned int __b) {
13266 return __a ^ __b;
13269 static __inline__ vector unsigned int __ATTRS_o_ai
13270 vec_xor(vector bool int __a, vector unsigned int __b) {
13271 return (vector unsigned int)__a ^ __b;
13274 static __inline__ vector unsigned int __ATTRS_o_ai
13275 vec_xor(vector unsigned int __a, vector bool int __b) {
13276 return __a ^ (vector unsigned int)__b;
13279 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
13280 vector bool int __b) {
13281 return __a ^ __b;
13284 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13285 vector float __b) {
13286 vector unsigned int __res =
13287 (vector unsigned int)__a ^ (vector unsigned int)__b;
13288 return (vector float)__res;
13291 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
13292 vector float __b) {
13293 vector unsigned int __res =
13294 (vector unsigned int)__a ^ (vector unsigned int)__b;
13295 return (vector float)__res;
13298 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13299 vector bool int __b) {
13300 vector unsigned int __res =
13301 (vector unsigned int)__a ^ (vector unsigned int)__b;
13302 return (vector float)__res;
13305 #ifdef __VSX__
13306 static __inline__ vector signed long long __ATTRS_o_ai
13307 vec_xor(vector signed long long __a, vector signed long long __b) {
13308 return __a ^ __b;
13311 static __inline__ vector signed long long __ATTRS_o_ai
13312 vec_xor(vector bool long long __a, vector signed long long __b) {
13313 return (vector signed long long)__a ^ __b;
13316 static __inline__ vector signed long long __ATTRS_o_ai
13317 vec_xor(vector signed long long __a, vector bool long long __b) {
13318 return __a ^ (vector signed long long)__b;
13321 static __inline__ vector unsigned long long __ATTRS_o_ai
13322 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
13323 return __a ^ __b;
13326 static __inline__ vector unsigned long long __ATTRS_o_ai
13327 vec_xor(vector bool long long __a, vector unsigned long long __b) {
13328 return (vector unsigned long long)__a ^ __b;
13331 static __inline__ vector unsigned long long __ATTRS_o_ai
13332 vec_xor(vector unsigned long long __a, vector bool long long __b) {
13333 return __a ^ (vector unsigned long long)__b;
13336 static __inline__ vector bool long long __ATTRS_o_ai
13337 vec_xor(vector bool long long __a, vector bool long long __b) {
13338 return __a ^ __b;
13341 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
13342 vector double __b) {
13343 return (vector double)((vector unsigned long long)__a ^
13344 (vector unsigned long long)__b);
13347 static __inline__ vector double __ATTRS_o_ai
13348 vec_xor(vector double __a, vector bool long long __b) {
13349 return (vector double)((vector unsigned long long)__a ^
13350 (vector unsigned long long)__b);
13353 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
13354 vector double __b) {
13355 return (vector double)((vector unsigned long long)__a ^
13356 (vector unsigned long long)__b);
13358 #endif
13360 /* vec_vxor */
13362 static __inline__ vector signed char __ATTRS_o_ai
13363 vec_vxor(vector signed char __a, vector signed char __b) {
13364 return __a ^ __b;
13367 static __inline__ vector signed char __ATTRS_o_ai
13368 vec_vxor(vector bool char __a, vector signed char __b) {
13369 return (vector signed char)__a ^ __b;
13372 static __inline__ vector signed char __ATTRS_o_ai
13373 vec_vxor(vector signed char __a, vector bool char __b) {
13374 return __a ^ (vector signed char)__b;
13377 static __inline__ vector unsigned char __ATTRS_o_ai
13378 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
13379 return __a ^ __b;
13382 static __inline__ vector unsigned char __ATTRS_o_ai
13383 vec_vxor(vector bool char __a, vector unsigned char __b) {
13384 return (vector unsigned char)__a ^ __b;
13387 static __inline__ vector unsigned char __ATTRS_o_ai
13388 vec_vxor(vector unsigned char __a, vector bool char __b) {
13389 return __a ^ (vector unsigned char)__b;
13392 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
13393 vector bool char __b) {
13394 return __a ^ __b;
13397 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13398 vector short __b) {
13399 return __a ^ __b;
13402 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
13403 vector short __b) {
13404 return (vector short)__a ^ __b;
13407 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13408 vector bool short __b) {
13409 return __a ^ (vector short)__b;
13412 static __inline__ vector unsigned short __ATTRS_o_ai
13413 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
13414 return __a ^ __b;
13417 static __inline__ vector unsigned short __ATTRS_o_ai
13418 vec_vxor(vector bool short __a, vector unsigned short __b) {
13419 return (vector unsigned short)__a ^ __b;
13422 static __inline__ vector unsigned short __ATTRS_o_ai
13423 vec_vxor(vector unsigned short __a, vector bool short __b) {
13424 return __a ^ (vector unsigned short)__b;
13427 static __inline__ vector bool short __ATTRS_o_ai
13428 vec_vxor(vector bool short __a, vector bool short __b) {
13429 return __a ^ __b;
13432 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13433 vector int __b) {
13434 return __a ^ __b;
13437 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
13438 vector int __b) {
13439 return (vector int)__a ^ __b;
13442 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13443 vector bool int __b) {
13444 return __a ^ (vector int)__b;
13447 static __inline__ vector unsigned int __ATTRS_o_ai
13448 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
13449 return __a ^ __b;
13452 static __inline__ vector unsigned int __ATTRS_o_ai
13453 vec_vxor(vector bool int __a, vector unsigned int __b) {
13454 return (vector unsigned int)__a ^ __b;
13457 static __inline__ vector unsigned int __ATTRS_o_ai
13458 vec_vxor(vector unsigned int __a, vector bool int __b) {
13459 return __a ^ (vector unsigned int)__b;
13462 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
13463 vector bool int __b) {
13464 return __a ^ __b;
13467 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13468 vector float __b) {
13469 vector unsigned int __res =
13470 (vector unsigned int)__a ^ (vector unsigned int)__b;
13471 return (vector float)__res;
13474 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
13475 vector float __b) {
13476 vector unsigned int __res =
13477 (vector unsigned int)__a ^ (vector unsigned int)__b;
13478 return (vector float)__res;
13481 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13482 vector bool int __b) {
13483 vector unsigned int __res =
13484 (vector unsigned int)__a ^ (vector unsigned int)__b;
13485 return (vector float)__res;
13488 #ifdef __VSX__
13489 static __inline__ vector signed long long __ATTRS_o_ai
13490 vec_vxor(vector signed long long __a, vector signed long long __b) {
13491 return __a ^ __b;
13494 static __inline__ vector signed long long __ATTRS_o_ai
13495 vec_vxor(vector bool long long __a, vector signed long long __b) {
13496 return (vector signed long long)__a ^ __b;
13499 static __inline__ vector signed long long __ATTRS_o_ai
13500 vec_vxor(vector signed long long __a, vector bool long long __b) {
13501 return __a ^ (vector signed long long)__b;
13504 static __inline__ vector unsigned long long __ATTRS_o_ai
13505 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
13506 return __a ^ __b;
13509 static __inline__ vector unsigned long long __ATTRS_o_ai
13510 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
13511 return (vector unsigned long long)__a ^ __b;
13514 static __inline__ vector unsigned long long __ATTRS_o_ai
13515 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
13516 return __a ^ (vector unsigned long long)__b;
13519 static __inline__ vector bool long long __ATTRS_o_ai
13520 vec_vxor(vector bool long long __a, vector bool long long __b) {
13521 return __a ^ __b;
13523 #endif
13525 /* ------------------------ extensions for CBEA ----------------------------- */
13527 /* vec_extract */
13529 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
13530 signed int __b) {
13531 return __a[__b & 0xf];
13534 static __inline__ unsigned char __ATTRS_o_ai
13535 vec_extract(vector unsigned char __a, signed int __b) {
13536 return __a[__b & 0xf];
13539 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
13540 signed int __b) {
13541 return __a[__b & 0xf];
13544 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
13545 signed int __b) {
13546 return __a[__b & 0x7];
13549 static __inline__ unsigned short __ATTRS_o_ai
13550 vec_extract(vector unsigned short __a, signed int __b) {
13551 return __a[__b & 0x7];
13554 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
13555 signed int __b) {
13556 return __a[__b & 0x7];
13559 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
13560 signed int __b) {
13561 return __a[__b & 0x3];
13564 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
13565 signed int __b) {
13566 return __a[__b & 0x3];
13569 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
13570 signed int __b) {
13571 return __a[__b & 0x3];
13574 #ifdef __VSX__
13575 static __inline__ signed long long __ATTRS_o_ai
13576 vec_extract(vector signed long long __a, signed int __b) {
13577 return __a[__b & 0x1];
13580 static __inline__ unsigned long long __ATTRS_o_ai
13581 vec_extract(vector unsigned long long __a, signed int __b) {
13582 return __a[__b & 0x1];
13585 static __inline__ unsigned long long __ATTRS_o_ai
13586 vec_extract(vector bool long long __a, signed int __b) {
13587 return __a[__b & 0x1];
13590 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a,
13591 signed int __b) {
13592 return __a[__b & 0x1];
13594 #endif
13596 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a,
13597 signed int __b) {
13598 return __a[__b & 0x3];
13601 #ifdef __POWER9_VECTOR__
13603 #define vec_insert4b __builtin_vsx_insertword
13604 #define vec_extract4b __builtin_vsx_extractuword
13606 /* vec_extract_exp */
13608 static __inline__ vector unsigned int __ATTRS_o_ai
13609 vec_extract_exp(vector float __a) {
13610 return __builtin_vsx_xvxexpsp(__a);
13613 static __inline__ vector unsigned long long __ATTRS_o_ai
13614 vec_extract_exp(vector double __a) {
13615 return __builtin_vsx_xvxexpdp(__a);
13618 /* vec_extract_sig */
13620 static __inline__ vector unsigned int __ATTRS_o_ai
13621 vec_extract_sig(vector float __a) {
13622 return __builtin_vsx_xvxsigsp(__a);
13625 static __inline__ vector unsigned long long __ATTRS_o_ai
13626 vec_extract_sig (vector double __a) {
13627 return __builtin_vsx_xvxsigdp(__a);
13630 static __inline__ vector float __ATTRS_o_ai
13631 vec_extract_fp32_from_shorth(vector unsigned short __a) {
13632 vector unsigned short __b =
13633 #ifdef __LITTLE_ENDIAN__
13634 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
13635 #else
13636 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
13637 #endif
13638 return __builtin_vsx_xvcvhpsp(__b);
13641 static __inline__ vector float __ATTRS_o_ai
13642 vec_extract_fp32_from_shortl(vector unsigned short __a) {
13643 vector unsigned short __b =
13644 #ifdef __LITTLE_ENDIAN__
13645 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
13646 #else
13647 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
13648 #endif
13649 return __builtin_vsx_xvcvhpsp(__b);
13651 #endif /* __POWER9_VECTOR__ */
13653 /* vec_insert */
13655 static __inline__ vector signed char __ATTRS_o_ai
13656 vec_insert(signed char __a, vector signed char __b, int __c) {
13657 __b[__c & 0xF] = __a;
13658 return __b;
13661 static __inline__ vector unsigned char __ATTRS_o_ai
13662 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
13663 __b[__c & 0xF] = __a;
13664 return __b;
13667 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
13668 vector bool char __b,
13669 int __c) {
13670 __b[__c & 0xF] = __a;
13671 return __b;
13674 static __inline__ vector signed short __ATTRS_o_ai
13675 vec_insert(signed short __a, vector signed short __b, int __c) {
13676 __b[__c & 0x7] = __a;
13677 return __b;
13680 static __inline__ vector unsigned short __ATTRS_o_ai
13681 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
13682 __b[__c & 0x7] = __a;
13683 return __b;
13686 static __inline__ vector bool short __ATTRS_o_ai
13687 vec_insert(unsigned short __a, vector bool short __b, int __c) {
13688 __b[__c & 0x7] = __a;
13689 return __b;
13692 static __inline__ vector signed int __ATTRS_o_ai
13693 vec_insert(signed int __a, vector signed int __b, int __c) {
13694 __b[__c & 0x3] = __a;
13695 return __b;
13698 static __inline__ vector unsigned int __ATTRS_o_ai
13699 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
13700 __b[__c & 0x3] = __a;
13701 return __b;
13704 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
13705 vector bool int __b,
13706 int __c) {
13707 __b[__c & 0x3] = __a;
13708 return __b;
13711 #ifdef __VSX__
13712 static __inline__ vector signed long long __ATTRS_o_ai
13713 vec_insert(signed long long __a, vector signed long long __b, int __c) {
13714 __b[__c & 0x1] = __a;
13715 return __b;
13718 static __inline__ vector unsigned long long __ATTRS_o_ai
13719 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
13720 __b[__c & 0x1] = __a;
13721 return __b;
13724 static __inline__ vector bool long long __ATTRS_o_ai
13725 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
13726 __b[__c & 0x1] = __a;
13727 return __b;
13729 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
13730 vector double __b,
13731 int __c) {
13732 __b[__c & 0x1] = __a;
13733 return __b;
13735 #endif
13737 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
13738 vector float __b,
13739 int __c) {
13740 __b[__c & 0x3] = __a;
13741 return __b;
13744 /* vec_lvlx */
13746 static __inline__ vector signed char __ATTRS_o_ai
13747 vec_lvlx(int __a, const signed char *__b) {
13748 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13749 vec_lvsl(__a, __b));
13752 static __inline__ vector signed char __ATTRS_o_ai
13753 vec_lvlx(int __a, const vector signed char *__b) {
13754 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13755 vec_lvsl(__a, (unsigned char *)__b));
13758 static __inline__ vector unsigned char __ATTRS_o_ai
13759 vec_lvlx(int __a, const unsigned char *__b) {
13760 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13761 vec_lvsl(__a, __b));
13764 static __inline__ vector unsigned char __ATTRS_o_ai
13765 vec_lvlx(int __a, const vector unsigned char *__b) {
13766 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13767 vec_lvsl(__a, (unsigned char *)__b));
13770 static __inline__ vector bool char __ATTRS_o_ai
13771 vec_lvlx(int __a, const vector bool char *__b) {
13772 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
13773 vec_lvsl(__a, (unsigned char *)__b));
13776 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13777 const short *__b) {
13778 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13781 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13782 const vector short *__b) {
13783 return vec_perm(vec_ld(__a, __b), (vector short)(0),
13784 vec_lvsl(__a, (unsigned char *)__b));
13787 static __inline__ vector unsigned short __ATTRS_o_ai
13788 vec_lvlx(int __a, const unsigned short *__b) {
13789 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13790 vec_lvsl(__a, __b));
13793 static __inline__ vector unsigned short __ATTRS_o_ai
13794 vec_lvlx(int __a, const vector unsigned short *__b) {
13795 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13796 vec_lvsl(__a, (unsigned char *)__b));
13799 static __inline__ vector bool short __ATTRS_o_ai
13800 vec_lvlx(int __a, const vector bool short *__b) {
13801 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
13802 vec_lvsl(__a, (unsigned char *)__b));
13805 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
13806 const vector pixel *__b) {
13807 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
13808 vec_lvsl(__a, (unsigned char *)__b));
13811 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
13812 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13815 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
13816 const vector int *__b) {
13817 return vec_perm(vec_ld(__a, __b), (vector int)(0),
13818 vec_lvsl(__a, (unsigned char *)__b));
13821 static __inline__ vector unsigned int __ATTRS_o_ai
13822 vec_lvlx(int __a, const unsigned int *__b) {
13823 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13824 vec_lvsl(__a, __b));
13827 static __inline__ vector unsigned int __ATTRS_o_ai
13828 vec_lvlx(int __a, const vector unsigned int *__b) {
13829 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13830 vec_lvsl(__a, (unsigned char *)__b));
13833 static __inline__ vector bool int __ATTRS_o_ai
13834 vec_lvlx(int __a, const vector bool int *__b) {
13835 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
13836 vec_lvsl(__a, (unsigned char *)__b));
13839 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13840 const float *__b) {
13841 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13844 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13845 const vector float *__b) {
13846 return vec_perm(vec_ld(__a, __b), (vector float)(0),
13847 vec_lvsl(__a, (unsigned char *)__b));
13850 /* vec_lvlxl */
13852 static __inline__ vector signed char __ATTRS_o_ai
13853 vec_lvlxl(int __a, const signed char *__b) {
13854 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13855 vec_lvsl(__a, __b));
13858 static __inline__ vector signed char __ATTRS_o_ai
13859 vec_lvlxl(int __a, const vector signed char *__b) {
13860 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13861 vec_lvsl(__a, (unsigned char *)__b));
13864 static __inline__ vector unsigned char __ATTRS_o_ai
13865 vec_lvlxl(int __a, const unsigned char *__b) {
13866 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13867 vec_lvsl(__a, __b));
13870 static __inline__ vector unsigned char __ATTRS_o_ai
13871 vec_lvlxl(int __a, const vector unsigned char *__b) {
13872 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13873 vec_lvsl(__a, (unsigned char *)__b));
13876 static __inline__ vector bool char __ATTRS_o_ai
13877 vec_lvlxl(int __a, const vector bool char *__b) {
13878 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
13879 vec_lvsl(__a, (unsigned char *)__b));
13882 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13883 const short *__b) {
13884 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13887 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13888 const vector short *__b) {
13889 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
13890 vec_lvsl(__a, (unsigned char *)__b));
13893 static __inline__ vector unsigned short __ATTRS_o_ai
13894 vec_lvlxl(int __a, const unsigned short *__b) {
13895 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13896 vec_lvsl(__a, __b));
13899 static __inline__ vector unsigned short __ATTRS_o_ai
13900 vec_lvlxl(int __a, const vector unsigned short *__b) {
13901 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13902 vec_lvsl(__a, (unsigned char *)__b));
13905 static __inline__ vector bool short __ATTRS_o_ai
13906 vec_lvlxl(int __a, const vector bool short *__b) {
13907 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
13908 vec_lvsl(__a, (unsigned char *)__b));
13911 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
13912 const vector pixel *__b) {
13913 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
13914 vec_lvsl(__a, (unsigned char *)__b));
13917 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
13918 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13921 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
13922 const vector int *__b) {
13923 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
13924 vec_lvsl(__a, (unsigned char *)__b));
13927 static __inline__ vector unsigned int __ATTRS_o_ai
13928 vec_lvlxl(int __a, const unsigned int *__b) {
13929 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13930 vec_lvsl(__a, __b));
13933 static __inline__ vector unsigned int __ATTRS_o_ai
13934 vec_lvlxl(int __a, const vector unsigned int *__b) {
13935 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13936 vec_lvsl(__a, (unsigned char *)__b));
13939 static __inline__ vector bool int __ATTRS_o_ai
13940 vec_lvlxl(int __a, const vector bool int *__b) {
13941 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
13942 vec_lvsl(__a, (unsigned char *)__b));
13945 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13946 const float *__b) {
13947 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13950 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13951 vector float *__b) {
13952 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
13953 vec_lvsl(__a, (unsigned char *)__b));
13956 /* vec_lvrx */
13958 static __inline__ vector signed char __ATTRS_o_ai
13959 vec_lvrx(int __a, const signed char *__b) {
13960 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13961 vec_lvsl(__a, __b));
13964 static __inline__ vector signed char __ATTRS_o_ai
13965 vec_lvrx(int __a, const vector signed char *__b) {
13966 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13967 vec_lvsl(__a, (unsigned char *)__b));
13970 static __inline__ vector unsigned char __ATTRS_o_ai
13971 vec_lvrx(int __a, const unsigned char *__b) {
13972 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13973 vec_lvsl(__a, __b));
13976 static __inline__ vector unsigned char __ATTRS_o_ai
13977 vec_lvrx(int __a, const vector unsigned char *__b) {
13978 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13979 vec_lvsl(__a, (unsigned char *)__b));
13982 static __inline__ vector bool char __ATTRS_o_ai
13983 vec_lvrx(int __a, const vector bool char *__b) {
13984 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
13985 vec_lvsl(__a, (unsigned char *)__b));
13988 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
13989 const short *__b) {
13990 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13993 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
13994 const vector short *__b) {
13995 return vec_perm((vector short)(0), vec_ld(__a, __b),
13996 vec_lvsl(__a, (unsigned char *)__b));
13999 static __inline__ vector unsigned short __ATTRS_o_ai
14000 vec_lvrx(int __a, const unsigned short *__b) {
14001 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14002 vec_lvsl(__a, __b));
14005 static __inline__ vector unsigned short __ATTRS_o_ai
14006 vec_lvrx(int __a, const vector unsigned short *__b) {
14007 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14008 vec_lvsl(__a, (unsigned char *)__b));
14011 static __inline__ vector bool short __ATTRS_o_ai
14012 vec_lvrx(int __a, const vector bool short *__b) {
14013 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
14014 vec_lvsl(__a, (unsigned char *)__b));
14017 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
14018 const vector pixel *__b) {
14019 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
14020 vec_lvsl(__a, (unsigned char *)__b));
14023 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
14024 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14027 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
14028 const vector int *__b) {
14029 return vec_perm((vector int)(0), vec_ld(__a, __b),
14030 vec_lvsl(__a, (unsigned char *)__b));
14033 static __inline__ vector unsigned int __ATTRS_o_ai
14034 vec_lvrx(int __a, const unsigned int *__b) {
14035 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14036 vec_lvsl(__a, __b));
14039 static __inline__ vector unsigned int __ATTRS_o_ai
14040 vec_lvrx(int __a, const vector unsigned int *__b) {
14041 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14042 vec_lvsl(__a, (unsigned char *)__b));
14045 static __inline__ vector bool int __ATTRS_o_ai
14046 vec_lvrx(int __a, const vector bool int *__b) {
14047 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
14048 vec_lvsl(__a, (unsigned char *)__b));
14051 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14052 const float *__b) {
14053 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14056 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14057 const vector float *__b) {
14058 return vec_perm((vector float)(0), vec_ld(__a, __b),
14059 vec_lvsl(__a, (unsigned char *)__b));
14062 /* vec_lvrxl */
14064 static __inline__ vector signed char __ATTRS_o_ai
14065 vec_lvrxl(int __a, const signed char *__b) {
14066 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14067 vec_lvsl(__a, __b));
14070 static __inline__ vector signed char __ATTRS_o_ai
14071 vec_lvrxl(int __a, const vector signed char *__b) {
14072 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14073 vec_lvsl(__a, (unsigned char *)__b));
14076 static __inline__ vector unsigned char __ATTRS_o_ai
14077 vec_lvrxl(int __a, const unsigned char *__b) {
14078 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14079 vec_lvsl(__a, __b));
14082 static __inline__ vector unsigned char __ATTRS_o_ai
14083 vec_lvrxl(int __a, const vector unsigned char *__b) {
14084 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14085 vec_lvsl(__a, (unsigned char *)__b));
14088 static __inline__ vector bool char __ATTRS_o_ai
14089 vec_lvrxl(int __a, const vector bool char *__b) {
14090 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
14091 vec_lvsl(__a, (unsigned char *)__b));
14094 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14095 const short *__b) {
14096 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14099 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14100 const vector short *__b) {
14101 return vec_perm((vector short)(0), vec_ldl(__a, __b),
14102 vec_lvsl(__a, (unsigned char *)__b));
14105 static __inline__ vector unsigned short __ATTRS_o_ai
14106 vec_lvrxl(int __a, const unsigned short *__b) {
14107 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14108 vec_lvsl(__a, __b));
14111 static __inline__ vector unsigned short __ATTRS_o_ai
14112 vec_lvrxl(int __a, const vector unsigned short *__b) {
14113 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14114 vec_lvsl(__a, (unsigned char *)__b));
14117 static __inline__ vector bool short __ATTRS_o_ai
14118 vec_lvrxl(int __a, const vector bool short *__b) {
14119 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
14120 vec_lvsl(__a, (unsigned char *)__b));
14123 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
14124 const vector pixel *__b) {
14125 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
14126 vec_lvsl(__a, (unsigned char *)__b));
14129 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
14130 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14133 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
14134 const vector int *__b) {
14135 return vec_perm((vector int)(0), vec_ldl(__a, __b),
14136 vec_lvsl(__a, (unsigned char *)__b));
14139 static __inline__ vector unsigned int __ATTRS_o_ai
14140 vec_lvrxl(int __a, const unsigned int *__b) {
14141 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14142 vec_lvsl(__a, __b));
14145 static __inline__ vector unsigned int __ATTRS_o_ai
14146 vec_lvrxl(int __a, const vector unsigned int *__b) {
14147 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14148 vec_lvsl(__a, (unsigned char *)__b));
14151 static __inline__ vector bool int __ATTRS_o_ai
14152 vec_lvrxl(int __a, const vector bool int *__b) {
14153 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
14154 vec_lvsl(__a, (unsigned char *)__b));
14157 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14158 const float *__b) {
14159 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14162 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14163 const vector float *__b) {
14164 return vec_perm((vector float)(0), vec_ldl(__a, __b),
14165 vec_lvsl(__a, (unsigned char *)__b));
14168 /* vec_stvlx */
14170 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14171 signed char *__c) {
14172 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14173 __c);
14176 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14177 vector signed char *__c) {
14178 return vec_st(
14179 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14180 __b, __c);
14183 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14184 unsigned char *__c) {
14185 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14186 __c);
14189 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14190 vector unsigned char *__c) {
14191 return vec_st(
14192 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14193 __b, __c);
14196 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
14197 vector bool char *__c) {
14198 return vec_st(
14199 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14200 __b, __c);
14203 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14204 short *__c) {
14205 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14206 __c);
14209 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14210 vector short *__c) {
14211 return vec_st(
14212 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14213 __b, __c);
14216 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14217 int __b, unsigned short *__c) {
14218 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14219 __c);
14222 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14223 int __b,
14224 vector unsigned short *__c) {
14225 return vec_st(
14226 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14227 __b, __c);
14230 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
14231 vector bool short *__c) {
14232 return vec_st(
14233 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14234 __b, __c);
14237 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
14238 vector pixel *__c) {
14239 return vec_st(
14240 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14241 __b, __c);
14244 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14245 int *__c) {
14246 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14247 __c);
14250 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14251 vector int *__c) {
14252 return vec_st(
14253 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14254 __b, __c);
14257 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14258 unsigned int *__c) {
14259 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14260 __c);
14263 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14264 vector unsigned int *__c) {
14265 return vec_st(
14266 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14267 __b, __c);
14270 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
14271 vector bool int *__c) {
14272 return vec_st(
14273 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14274 __b, __c);
14277 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
14278 vector float *__c) {
14279 return vec_st(
14280 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14281 __b, __c);
14284 /* vec_stvlxl */
14286 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14287 signed char *__c) {
14288 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14289 __c);
14292 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14293 vector signed char *__c) {
14294 return vec_stl(
14295 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14296 __b, __c);
14299 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14300 int __b, unsigned char *__c) {
14301 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14302 __c);
14305 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14306 int __b,
14307 vector unsigned char *__c) {
14308 return vec_stl(
14309 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14310 __b, __c);
14313 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
14314 vector bool char *__c) {
14315 return vec_stl(
14316 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14317 __b, __c);
14320 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14321 short *__c) {
14322 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14323 __c);
14326 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14327 vector short *__c) {
14328 return vec_stl(
14329 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14330 __b, __c);
14333 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14334 int __b, unsigned short *__c) {
14335 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14336 __c);
14339 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14340 int __b,
14341 vector unsigned short *__c) {
14342 return vec_stl(
14343 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14344 __b, __c);
14347 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
14348 vector bool short *__c) {
14349 return vec_stl(
14350 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14351 __b, __c);
14354 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
14355 vector pixel *__c) {
14356 return vec_stl(
14357 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14358 __b, __c);
14361 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14362 int *__c) {
14363 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14364 __c);
14367 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14368 vector int *__c) {
14369 return vec_stl(
14370 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14371 __b, __c);
14374 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14375 unsigned int *__c) {
14376 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
14377 __c);
14380 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14381 vector unsigned int *__c) {
14382 return vec_stl(
14383 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14384 __b, __c);
14387 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
14388 vector bool int *__c) {
14389 return vec_stl(
14390 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14391 __b, __c);
14394 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
14395 vector float *__c) {
14396 return vec_stl(
14397 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14398 __b, __c);
14401 /* vec_stvrx */
14403 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14404 signed char *__c) {
14405 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14406 __c);
14409 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14410 vector signed char *__c) {
14411 return vec_st(
14412 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14413 __b, __c);
14416 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14417 unsigned char *__c) {
14418 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14419 __c);
14422 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14423 vector unsigned char *__c) {
14424 return vec_st(
14425 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14426 __b, __c);
14429 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
14430 vector bool char *__c) {
14431 return vec_st(
14432 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14433 __b, __c);
14436 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14437 short *__c) {
14438 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14439 __c);
14442 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14443 vector short *__c) {
14444 return vec_st(
14445 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14446 __b, __c);
14449 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14450 int __b, unsigned short *__c) {
14451 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14452 __c);
14455 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14456 int __b,
14457 vector unsigned short *__c) {
14458 return vec_st(
14459 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14460 __b, __c);
14463 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
14464 vector bool short *__c) {
14465 return vec_st(
14466 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14467 __b, __c);
14470 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
14471 vector pixel *__c) {
14472 return vec_st(
14473 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14474 __b, __c);
14477 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14478 int *__c) {
14479 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14480 __c);
14483 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14484 vector int *__c) {
14485 return vec_st(
14486 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14487 __b, __c);
14490 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14491 unsigned int *__c) {
14492 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14493 __c);
14496 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14497 vector unsigned int *__c) {
14498 return vec_st(
14499 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14500 __b, __c);
14503 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
14504 vector bool int *__c) {
14505 return vec_st(
14506 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14507 __b, __c);
14510 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
14511 vector float *__c) {
14512 return vec_st(
14513 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14514 __b, __c);
14517 /* vec_stvrxl */
14519 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14520 signed char *__c) {
14521 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14522 __c);
14525 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14526 vector signed char *__c) {
14527 return vec_stl(
14528 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14529 __b, __c);
14532 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14533 int __b, unsigned char *__c) {
14534 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14535 __c);
14538 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14539 int __b,
14540 vector unsigned char *__c) {
14541 return vec_stl(
14542 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14543 __b, __c);
14546 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
14547 vector bool char *__c) {
14548 return vec_stl(
14549 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14550 __b, __c);
14553 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14554 short *__c) {
14555 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14556 __c);
14559 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14560 vector short *__c) {
14561 return vec_stl(
14562 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14563 __b, __c);
14566 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14567 int __b, unsigned short *__c) {
14568 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14569 __c);
14572 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14573 int __b,
14574 vector unsigned short *__c) {
14575 return vec_stl(
14576 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14577 __b, __c);
14580 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
14581 vector bool short *__c) {
14582 return vec_stl(
14583 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14584 __b, __c);
14587 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
14588 vector pixel *__c) {
14589 return vec_stl(
14590 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14591 __b, __c);
14594 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14595 int *__c) {
14596 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14597 __c);
14600 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14601 vector int *__c) {
14602 return vec_stl(
14603 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14604 __b, __c);
14607 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14608 unsigned int *__c) {
14609 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
14610 __c);
14613 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14614 vector unsigned int *__c) {
14615 return vec_stl(
14616 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14617 __b, __c);
14620 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
14621 vector bool int *__c) {
14622 return vec_stl(
14623 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14624 __b, __c);
14627 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
14628 vector float *__c) {
14629 return vec_stl(
14630 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14631 __b, __c);
14634 /* vec_promote */
14636 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
14637 int __b) {
14638 vector signed char __res = (vector signed char)(0);
14639 __res[__b & 0x7] = __a;
14640 return __res;
14643 static __inline__ vector unsigned char __ATTRS_o_ai
14644 vec_promote(unsigned char __a, int __b) {
14645 vector unsigned char __res = (vector unsigned char)(0);
14646 __res[__b & 0x7] = __a;
14647 return __res;
14650 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
14651 vector short __res = (vector short)(0);
14652 __res[__b & 0x7] = __a;
14653 return __res;
14656 static __inline__ vector unsigned short __ATTRS_o_ai
14657 vec_promote(unsigned short __a, int __b) {
14658 vector unsigned short __res = (vector unsigned short)(0);
14659 __res[__b & 0x7] = __a;
14660 return __res;
14663 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
14664 vector int __res = (vector int)(0);
14665 __res[__b & 0x3] = __a;
14666 return __res;
14669 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
14670 int __b) {
14671 vector unsigned int __res = (vector unsigned int)(0);
14672 __res[__b & 0x3] = __a;
14673 return __res;
14676 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
14677 vector float __res = (vector float)(0);
14678 __res[__b & 0x3] = __a;
14679 return __res;
14682 #ifdef __VSX__
14683 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) {
14684 vector double __res = (vector double)(0);
14685 __res[__b & 0x1] = __a;
14686 return __res;
14689 static __inline__ vector signed long long __ATTRS_o_ai
14690 vec_promote(signed long long __a, int __b) {
14691 vector signed long long __res = (vector signed long long)(0);
14692 __res[__b & 0x1] = __a;
14693 return __res;
14696 static __inline__ vector unsigned long long __ATTRS_o_ai
14697 vec_promote(unsigned long long __a, int __b) {
14698 vector unsigned long long __res = (vector unsigned long long)(0);
14699 __res[__b & 0x1] = __a;
14700 return __res;
14702 #endif
14704 /* vec_splats */
14706 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
14707 return (vector signed char)(__a);
14710 static __inline__ vector unsigned char __ATTRS_o_ai
14711 vec_splats(unsigned char __a) {
14712 return (vector unsigned char)(__a);
14715 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
14716 return (vector short)(__a);
14719 static __inline__ vector unsigned short __ATTRS_o_ai
14720 vec_splats(unsigned short __a) {
14721 return (vector unsigned short)(__a);
14724 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
14725 return (vector int)(__a);
14728 static __inline__ vector unsigned int __ATTRS_o_ai
14729 vec_splats(unsigned int __a) {
14730 return (vector unsigned int)(__a);
14733 #ifdef __VSX__
14734 static __inline__ vector signed long long __ATTRS_o_ai
14735 vec_splats(signed long long __a) {
14736 return (vector signed long long)(__a);
14739 static __inline__ vector unsigned long long __ATTRS_o_ai
14740 vec_splats(unsigned long long __a) {
14741 return (vector unsigned long long)(__a);
14744 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
14745 defined(__SIZEOF_INT128__)
14746 static __inline__ vector signed __int128 __ATTRS_o_ai
14747 vec_splats(signed __int128 __a) {
14748 return (vector signed __int128)(__a);
14751 static __inline__ vector unsigned __int128 __ATTRS_o_ai
14752 vec_splats(unsigned __int128 __a) {
14753 return (vector unsigned __int128)(__a);
14756 #endif
14758 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
14759 return (vector double)(__a);
14761 #endif
14763 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
14764 return (vector float)(__a);
14767 /* ----------------------------- predicates --------------------------------- */
14769 /* vec_all_eq */
14771 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14772 vector signed char __b) {
14773 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14774 (vector char)__b);
14777 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14778 vector bool char __b) {
14779 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14780 (vector char)__b);
14783 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14784 vector unsigned char __b) {
14785 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14786 (vector char)__b);
14789 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14790 vector bool char __b) {
14791 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14792 (vector char)__b);
14795 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14796 vector signed char __b) {
14797 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14798 (vector char)__b);
14801 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14802 vector unsigned char __b) {
14803 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14804 (vector char)__b);
14807 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14808 vector bool char __b) {
14809 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14810 (vector char)__b);
14813 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14814 vector short __b) {
14815 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
14818 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14819 vector bool short __b) {
14820 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
14823 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14824 vector unsigned short __b) {
14825 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14826 (vector short)__b);
14829 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14830 vector bool short __b) {
14831 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14832 (vector short)__b);
14835 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14836 vector short __b) {
14837 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14838 (vector short)__b);
14841 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14842 vector unsigned short __b) {
14843 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14844 (vector short)__b);
14847 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14848 vector bool short __b) {
14849 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14850 (vector short)__b);
14853 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
14854 vector pixel __b) {
14855 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14856 (vector short)__b);
14859 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
14860 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
14863 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
14864 vector bool int __b) {
14865 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
14868 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14869 vector unsigned int __b) {
14870 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14871 (vector int)__b);
14874 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14875 vector bool int __b) {
14876 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14877 (vector int)__b);
14880 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14881 vector int __b) {
14882 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14883 (vector int)__b);
14886 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14887 vector unsigned int __b) {
14888 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14889 (vector int)__b);
14892 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14893 vector bool int __b) {
14894 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14895 (vector int)__b);
14898 #ifdef __VSX__
14899 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
14900 vector signed long long __b) {
14901 #ifdef __POWER8_VECTOR__
14902 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
14903 #else
14904 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as
14905 // 32-bit elements.
14906 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0);
14907 #endif
14910 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
14911 vector bool long long __b) {
14912 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14915 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14916 vector unsigned long long __b) {
14917 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14920 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14921 vector bool long long __b) {
14922 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14925 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14926 vector long long __b) {
14927 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14930 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14931 vector unsigned long long __b) {
14932 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14935 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14936 vector bool long long __b) {
14937 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14939 #endif
14941 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
14942 vector float __b) {
14943 #ifdef __VSX__
14944 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
14945 #else
14946 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
14947 #endif
14950 #ifdef __VSX__
14951 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
14952 vector double __b) {
14953 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
14955 #endif
14957 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
14958 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a,
14959 vector signed __int128 __b) {
14960 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
14961 (vector signed __int128)__b);
14964 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a,
14965 vector unsigned __int128 __b) {
14966 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a,
14967 (vector signed __int128)__b);
14970 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a,
14971 vector bool __int128 __b) {
14972 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
14973 (vector signed __int128)__b);
14975 #endif
14977 /* vec_all_ge */
14979 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14980 vector signed char __b) {
14981 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
14984 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14985 vector bool char __b) {
14986 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
14989 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
14990 vector unsigned char __b) {
14991 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
14994 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
14995 vector bool char __b) {
14996 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
14999 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15000 vector signed char __b) {
15001 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a);
15004 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15005 vector unsigned char __b) {
15006 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
15009 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15010 vector bool char __b) {
15011 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
15012 (vector unsigned char)__a);
15015 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15016 vector short __b) {
15017 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
15020 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15021 vector bool short __b) {
15022 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
15025 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15026 vector unsigned short __b) {
15027 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
15030 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15031 vector bool short __b) {
15032 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15033 __a);
15036 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15037 vector short __b) {
15038 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a);
15041 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15042 vector unsigned short __b) {
15043 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
15044 (vector unsigned short)__a);
15047 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15048 vector bool short __b) {
15049 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15050 (vector unsigned short)__a);
15053 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
15054 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
15057 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
15058 vector bool int __b) {
15059 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
15062 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15063 vector unsigned int __b) {
15064 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
15067 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15068 vector bool int __b) {
15069 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
15072 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15073 vector int __b) {
15074 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a);
15077 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15078 vector unsigned int __b) {
15079 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
15082 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15083 vector bool int __b) {
15084 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
15085 (vector unsigned int)__a);
15088 #ifdef __VSX__
15089 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15090 vector signed long long __b) {
15091 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
15093 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15094 vector bool long long __b) {
15095 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
15096 __a);
15099 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15100 vector unsigned long long __b) {
15101 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
15104 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15105 vector bool long long __b) {
15106 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15107 __a);
15110 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15111 vector signed long long __b) {
15112 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b,
15113 (vector signed long long)__a);
15116 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15117 vector unsigned long long __b) {
15118 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
15119 (vector unsigned long long)__a);
15122 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15123 vector bool long long __b) {
15124 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15125 (vector unsigned long long)__a);
15127 #endif
15129 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
15130 vector float __b) {
15131 #ifdef __VSX__
15132 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
15133 #else
15134 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
15135 #endif
15138 #ifdef __VSX__
15139 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
15140 vector double __b) {
15141 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
15143 #endif
15145 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15146 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a,
15147 vector signed __int128 __b) {
15148 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a);
15151 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a,
15152 vector unsigned __int128 __b) {
15153 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a);
15155 #endif
15157 /* vec_all_gt */
15159 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15160 vector signed char __b) {
15161 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
15164 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15165 vector bool char __b) {
15166 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
15169 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15170 vector unsigned char __b) {
15171 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
15174 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15175 vector bool char __b) {
15176 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
15179 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15180 vector signed char __b) {
15181 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b);
15184 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15185 vector unsigned char __b) {
15186 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
15189 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15190 vector bool char __b) {
15191 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
15192 (vector unsigned char)__b);
15195 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15196 vector short __b) {
15197 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
15200 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15201 vector bool short __b) {
15202 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
15205 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15206 vector unsigned short __b) {
15207 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
15210 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15211 vector bool short __b) {
15212 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
15213 (vector unsigned short)__b);
15216 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15217 vector short __b) {
15218 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b);
15221 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15222 vector unsigned short __b) {
15223 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15224 __b);
15227 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15228 vector bool short __b) {
15229 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15230 (vector unsigned short)__b);
15233 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
15234 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
15237 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
15238 vector bool int __b) {
15239 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
15242 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15243 vector unsigned int __b) {
15244 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
15247 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15248 vector bool int __b) {
15249 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
15252 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15253 vector int __b) {
15254 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b);
15257 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15258 vector unsigned int __b) {
15259 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
15262 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15263 vector bool int __b) {
15264 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
15265 (vector unsigned int)__b);
15268 #ifdef __VSX__
15269 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15270 vector signed long long __b) {
15271 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
15273 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15274 vector bool long long __b) {
15275 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
15276 (vector signed long long)__b);
15279 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15280 vector unsigned long long __b) {
15281 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
15284 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15285 vector bool long long __b) {
15286 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
15287 (vector unsigned long long)__b);
15290 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15291 vector signed long long __b) {
15292 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a,
15293 __b);
15296 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15297 vector unsigned long long __b) {
15298 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15299 __b);
15302 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15303 vector bool long long __b) {
15304 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15305 (vector unsigned long long)__b);
15307 #endif
15309 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
15310 vector float __b) {
15311 #ifdef __VSX__
15312 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
15313 #else
15314 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
15315 #endif
15318 #ifdef __VSX__
15319 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
15320 vector double __b) {
15321 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
15323 #endif
15325 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15326 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a,
15327 vector signed __int128 __b) {
15328 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b);
15331 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a,
15332 vector unsigned __int128 __b) {
15333 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b);
15335 #endif
15337 /* vec_all_in */
15339 static __inline__ int __attribute__((__always_inline__))
15340 vec_all_in(vector float __a, vector float __b) {
15341 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
15344 /* vec_all_le */
15346 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15347 vector signed char __b) {
15348 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
15351 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15352 vector bool char __b) {
15353 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
15356 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15357 vector unsigned char __b) {
15358 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
15361 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15362 vector bool char __b) {
15363 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
15366 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15367 vector signed char __b) {
15368 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b);
15371 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15372 vector unsigned char __b) {
15373 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
15376 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15377 vector bool char __b) {
15378 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
15379 (vector unsigned char)__b);
15382 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15383 vector short __b) {
15384 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
15387 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15388 vector bool short __b) {
15389 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
15392 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15393 vector unsigned short __b) {
15394 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
15397 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15398 vector bool short __b) {
15399 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
15400 (vector unsigned short)__b);
15403 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15404 vector short __b) {
15405 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b);
15408 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15409 vector unsigned short __b) {
15410 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15411 __b);
15414 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15415 vector bool short __b) {
15416 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15417 (vector unsigned short)__b);
15420 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
15421 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
15424 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
15425 vector bool int __b) {
15426 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
15429 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15430 vector unsigned int __b) {
15431 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
15434 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15435 vector bool int __b) {
15436 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
15439 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15440 vector int __b) {
15441 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b);
15444 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15445 vector unsigned int __b) {
15446 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
15449 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15450 vector bool int __b) {
15451 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
15452 (vector unsigned int)__b);
15455 #ifdef __VSX__
15456 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15457 vector signed long long __b) {
15458 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
15461 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15462 vector unsigned long long __b) {
15463 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
15466 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15467 vector bool long long __b) {
15468 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
15469 (vector signed long long)__b);
15472 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15473 vector bool long long __b) {
15474 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
15475 (vector unsigned long long)__b);
15478 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15479 vector signed long long __b) {
15480 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a,
15481 __b);
15484 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15485 vector unsigned long long __b) {
15486 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15487 __b);
15490 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15491 vector bool long long __b) {
15492 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15493 (vector unsigned long long)__b);
15495 #endif
15497 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
15498 vector float __b) {
15499 #ifdef __VSX__
15500 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
15501 #else
15502 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
15503 #endif
15506 #ifdef __VSX__
15507 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
15508 vector double __b) {
15509 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
15511 #endif
15513 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15514 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a,
15515 vector signed __int128 __b) {
15516 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b);
15519 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a,
15520 vector unsigned __int128 __b) {
15521 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b);
15523 #endif
15525 /* vec_all_lt */
15527 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15528 vector signed char __b) {
15529 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
15532 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15533 vector bool char __b) {
15534 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
15537 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15538 vector unsigned char __b) {
15539 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
15542 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15543 vector bool char __b) {
15544 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
15547 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15548 vector signed char __b) {
15549 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a);
15552 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15553 vector unsigned char __b) {
15554 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
15557 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15558 vector bool char __b) {
15559 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
15560 (vector unsigned char)__a);
15563 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15564 vector short __b) {
15565 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
15568 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15569 vector bool short __b) {
15570 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
15573 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15574 vector unsigned short __b) {
15575 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
15578 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15579 vector bool short __b) {
15580 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15581 __a);
15584 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15585 vector short __b) {
15586 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a);
15589 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15590 vector unsigned short __b) {
15591 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
15592 (vector unsigned short)__a);
15595 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15596 vector bool short __b) {
15597 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15598 (vector unsigned short)__a);
15601 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
15602 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
15605 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
15606 vector bool int __b) {
15607 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
15610 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15611 vector unsigned int __b) {
15612 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
15615 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15616 vector bool int __b) {
15617 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
15620 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15621 vector int __b) {
15622 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a);
15625 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15626 vector unsigned int __b) {
15627 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
15630 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15631 vector bool int __b) {
15632 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
15633 (vector unsigned int)__a);
15636 #ifdef __VSX__
15637 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15638 vector signed long long __b) {
15639 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
15642 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15643 vector unsigned long long __b) {
15644 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
15647 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15648 vector bool long long __b) {
15649 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
15650 __a);
15653 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15654 vector bool long long __b) {
15655 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15656 __a);
15659 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15660 vector signed long long __b) {
15661 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b,
15662 (vector signed long long)__a);
15665 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15666 vector unsigned long long __b) {
15667 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
15668 (vector unsigned long long)__a);
15671 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15672 vector bool long long __b) {
15673 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15674 (vector unsigned long long)__a);
15676 #endif
15678 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
15679 vector float __b) {
15680 #ifdef __VSX__
15681 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
15682 #else
15683 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
15684 #endif
15687 #ifdef __VSX__
15688 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
15689 vector double __b) {
15690 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
15692 #endif
15694 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15695 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a,
15696 vector signed __int128 __b) {
15697 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a);
15700 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a,
15701 vector unsigned __int128 __b) {
15702 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a);
15704 #endif
15706 /* vec_all_nan */
15708 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
15709 #ifdef __VSX__
15710 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
15711 #else
15712 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
15713 #endif
15716 #ifdef __VSX__
15717 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
15718 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
15720 #endif
15722 /* vec_all_ne */
15724 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15725 vector signed char __b) {
15726 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15727 (vector char)__b);
15730 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15731 vector bool char __b) {
15732 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15733 (vector char)__b);
15736 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15737 vector unsigned char __b) {
15738 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15739 (vector char)__b);
15742 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15743 vector bool char __b) {
15744 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15745 (vector char)__b);
15748 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15749 vector signed char __b) {
15750 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15751 (vector char)__b);
15754 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15755 vector unsigned char __b) {
15756 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15757 (vector char)__b);
15760 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15761 vector bool char __b) {
15762 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15763 (vector char)__b);
15766 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15767 vector short __b) {
15768 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
15771 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15772 vector bool short __b) {
15773 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
15776 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15777 vector unsigned short __b) {
15778 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15779 (vector short)__b);
15782 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15783 vector bool short __b) {
15784 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15785 (vector short)__b);
15788 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15789 vector short __b) {
15790 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15791 (vector short)__b);
15794 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15795 vector unsigned short __b) {
15796 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15797 (vector short)__b);
15800 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15801 vector bool short __b) {
15802 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15803 (vector short)__b);
15806 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
15807 vector pixel __b) {
15808 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15809 (vector short)__b);
15812 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
15813 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
15816 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
15817 vector bool int __b) {
15818 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
15821 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15822 vector unsigned int __b) {
15823 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15824 (vector int)__b);
15827 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15828 vector bool int __b) {
15829 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15830 (vector int)__b);
15833 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15834 vector int __b) {
15835 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15836 (vector int)__b);
15839 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15840 vector unsigned int __b) {
15841 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15842 (vector int)__b);
15845 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15846 vector bool int __b) {
15847 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15848 (vector int)__b);
15851 #ifdef __VSX__
15852 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15853 vector signed long long __b) {
15854 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
15857 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15858 vector unsigned long long __b) {
15859 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
15860 (vector long long)__b);
15863 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15864 vector bool long long __b) {
15865 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
15866 (vector signed long long)__b);
15869 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15870 vector bool long long __b) {
15871 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15872 (vector signed long long)__b);
15875 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15876 vector signed long long __b) {
15877 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15878 (vector signed long long)__b);
15881 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15882 vector unsigned long long __b) {
15883 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15884 (vector signed long long)__b);
15887 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15888 vector bool long long __b) {
15889 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15890 (vector signed long long)__b);
15892 #endif
15894 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
15895 vector float __b) {
15896 #ifdef __VSX__
15897 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
15898 #else
15899 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
15900 #endif
15903 #ifdef __VSX__
15904 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
15905 vector double __b) {
15906 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
15908 #endif
15910 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15911 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a,
15912 vector signed __int128 __b) {
15913 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15914 __b);
15917 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a,
15918 vector unsigned __int128 __b) {
15919 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a,
15920 (vector signed __int128)__b);
15923 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a,
15924 vector bool __int128 __b) {
15925 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15926 (vector signed __int128)__b);
15928 #endif
15930 /* vec_all_nge */
15932 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
15933 vector float __b) {
15934 #ifdef __VSX__
15935 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
15936 #else
15937 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
15938 #endif
15941 #ifdef __VSX__
15942 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
15943 vector double __b) {
15944 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
15946 #endif
15948 /* vec_all_ngt */
15950 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
15951 vector float __b) {
15952 #ifdef __VSX__
15953 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
15954 #else
15955 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
15956 #endif
15959 #ifdef __VSX__
15960 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
15961 vector double __b) {
15962 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
15964 #endif
15966 /* vec_all_nle */
15968 static __inline__ int __ATTRS_o_ai
15969 vec_all_nle(vector float __a, vector float __b) {
15970 #ifdef __VSX__
15971 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a);
15972 #else
15973 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
15974 #endif
15977 #ifdef __VSX__
15978 static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a,
15979 vector double __b) {
15980 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a);
15982 #endif
15984 /* vec_all_nlt */
15986 static __inline__ int __ATTRS_o_ai
15987 vec_all_nlt(vector float __a, vector float __b) {
15988 #ifdef __VSX__
15989 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a);
15990 #else
15991 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
15992 #endif
15995 #ifdef __VSX__
15996 static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a,
15997 vector double __b) {
15998 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a);
16000 #endif
16002 /* vec_all_numeric */
16004 static __inline__ int __ATTRS_o_ai
16005 vec_all_numeric(vector float __a) {
16006 #ifdef __VSX__
16007 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a);
16008 #else
16009 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
16010 #endif
16013 #ifdef __VSX__
16014 static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) {
16015 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a);
16017 #endif
16019 /* vec_any_eq */
16021 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16022 vector signed char __b) {
16023 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16024 (vector char)__b);
16027 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16028 vector bool char __b) {
16029 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16030 (vector char)__b);
16033 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16034 vector unsigned char __b) {
16035 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16036 (vector char)__b);
16039 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16040 vector bool char __b) {
16041 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16042 (vector char)__b);
16045 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16046 vector signed char __b) {
16047 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16048 (vector char)__b);
16051 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16052 vector unsigned char __b) {
16053 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16054 (vector char)__b);
16057 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16058 vector bool char __b) {
16059 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16060 (vector char)__b);
16063 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16064 vector short __b) {
16065 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
16068 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16069 vector bool short __b) {
16070 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
16073 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16074 vector unsigned short __b) {
16075 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16076 (vector short)__b);
16079 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16080 vector bool short __b) {
16081 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16082 (vector short)__b);
16085 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16086 vector short __b) {
16087 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16088 (vector short)__b);
16091 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16092 vector unsigned short __b) {
16093 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16094 (vector short)__b);
16097 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16098 vector bool short __b) {
16099 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16100 (vector short)__b);
16103 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
16104 vector pixel __b) {
16105 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16106 (vector short)__b);
16109 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
16110 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
16113 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
16114 vector bool int __b) {
16115 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
16118 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16119 vector unsigned int __b) {
16120 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16121 (vector int)__b);
16124 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16125 vector bool int __b) {
16126 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16127 (vector int)__b);
16130 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16131 vector int __b) {
16132 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16133 (vector int)__b);
16136 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16137 vector unsigned int __b) {
16138 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16139 (vector int)__b);
16142 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16143 vector bool int __b) {
16144 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16145 (vector int)__b);
16148 #ifdef __VSX__
16149 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16150 vector signed long long __b) {
16151 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
16154 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16155 vector unsigned long long __b) {
16156 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
16157 (vector long long)__b);
16160 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16161 vector bool long long __b) {
16162 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
16163 (vector signed long long)__b);
16166 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16167 vector bool long long __b) {
16168 return __builtin_altivec_vcmpequd_p(
16169 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16172 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16173 vector signed long long __b) {
16174 return __builtin_altivec_vcmpequd_p(
16175 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16178 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16179 vector unsigned long long __b) {
16180 return __builtin_altivec_vcmpequd_p(
16181 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16184 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16185 vector bool long long __b) {
16186 return __builtin_altivec_vcmpequd_p(
16187 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16189 #endif
16191 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
16192 vector float __b) {
16193 #ifdef __VSX__
16194 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
16195 #else
16196 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
16197 #endif
16200 #ifdef __VSX__
16201 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
16202 vector double __b) {
16203 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
16205 #endif
16207 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16208 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a,
16209 vector signed __int128 __b) {
16210 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV,
16211 (vector unsigned __int128)__a, __b);
16214 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a,
16215 vector unsigned __int128 __b) {
16216 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a,
16217 (vector signed __int128)__b);
16220 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a,
16221 vector bool __int128 __b) {
16222 return __builtin_altivec_vcmpequq_p(
16223 __CR6_EQ_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
16225 #endif
16227 /* vec_any_ge */
16229 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16230 vector signed char __b) {
16231 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
16234 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16235 vector bool char __b) {
16236 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
16237 __a);
16240 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16241 vector unsigned char __b) {
16242 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
16245 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16246 vector bool char __b) {
16247 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16248 __a);
16251 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16252 vector signed char __b) {
16253 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b,
16254 (vector signed char)__a);
16257 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16258 vector unsigned char __b) {
16259 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
16260 (vector unsigned char)__a);
16263 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16264 vector bool char __b) {
16265 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16266 (vector unsigned char)__a);
16269 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16270 vector short __b) {
16271 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
16274 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16275 vector bool short __b) {
16276 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
16279 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16280 vector unsigned short __b) {
16281 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
16284 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16285 vector bool short __b) {
16286 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16287 __a);
16290 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16291 vector short __b) {
16292 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b,
16293 (vector signed short)__a);
16296 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16297 vector unsigned short __b) {
16298 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
16299 (vector unsigned short)__a);
16302 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16303 vector bool short __b) {
16304 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16305 (vector unsigned short)__a);
16308 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
16309 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
16312 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
16313 vector bool int __b) {
16314 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
16317 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16318 vector unsigned int __b) {
16319 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
16322 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16323 vector bool int __b) {
16324 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16325 __a);
16328 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16329 vector int __b) {
16330 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b,
16331 (vector signed int)__a);
16334 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16335 vector unsigned int __b) {
16336 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
16337 (vector unsigned int)__a);
16340 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16341 vector bool int __b) {
16342 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16343 (vector unsigned int)__a);
16346 #ifdef __VSX__
16347 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16348 vector signed long long __b) {
16349 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
16352 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16353 vector unsigned long long __b) {
16354 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
16357 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16358 vector bool long long __b) {
16359 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16360 (vector signed long long)__b, __a);
16363 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16364 vector bool long long __b) {
16365 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16366 (vector unsigned long long)__b, __a);
16369 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16370 vector signed long long __b) {
16371 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b,
16372 (vector signed long long)__a);
16375 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16376 vector unsigned long long __b) {
16377 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
16378 (vector unsigned long long)__a);
16381 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16382 vector bool long long __b) {
16383 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16384 (vector unsigned long long)__b,
16385 (vector unsigned long long)__a);
16387 #endif
16389 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
16390 vector float __b) {
16391 #ifdef __VSX__
16392 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
16393 #else
16394 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
16395 #endif
16398 #ifdef __VSX__
16399 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
16400 vector double __b) {
16401 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
16403 #endif
16405 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16406 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a,
16407 vector signed __int128 __b) {
16408 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a);
16411 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a,
16412 vector unsigned __int128 __b) {
16413 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a);
16415 #endif
16417 /* vec_any_gt */
16419 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16420 vector signed char __b) {
16421 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
16424 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16425 vector bool char __b) {
16426 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
16427 (vector signed char)__b);
16430 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16431 vector unsigned char __b) {
16432 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
16435 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16436 vector bool char __b) {
16437 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
16438 (vector unsigned char)__b);
16441 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16442 vector signed char __b) {
16443 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a,
16444 __b);
16447 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16448 vector unsigned char __b) {
16449 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16450 __b);
16453 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16454 vector bool char __b) {
16455 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16456 (vector unsigned char)__b);
16459 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16460 vector short __b) {
16461 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
16464 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16465 vector bool short __b) {
16466 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
16469 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16470 vector unsigned short __b) {
16471 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
16474 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16475 vector bool short __b) {
16476 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
16477 (vector unsigned short)__b);
16480 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16481 vector short __b) {
16482 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a,
16483 __b);
16486 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16487 vector unsigned short __b) {
16488 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16489 __b);
16492 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16493 vector bool short __b) {
16494 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16495 (vector unsigned short)__b);
16498 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
16499 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
16502 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
16503 vector bool int __b) {
16504 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
16507 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16508 vector unsigned int __b) {
16509 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
16512 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16513 vector bool int __b) {
16514 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
16515 (vector unsigned int)__b);
16518 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16519 vector int __b) {
16520 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a,
16521 __b);
16524 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16525 vector unsigned int __b) {
16526 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16527 __b);
16530 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16531 vector bool int __b) {
16532 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16533 (vector unsigned int)__b);
16536 #ifdef __VSX__
16537 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16538 vector signed long long __b) {
16539 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
16542 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16543 vector unsigned long long __b) {
16544 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
16547 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16548 vector bool long long __b) {
16549 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
16550 (vector signed long long)__b);
16553 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16554 vector bool long long __b) {
16555 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
16556 (vector unsigned long long)__b);
16559 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16560 vector signed long long __b) {
16561 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16562 (vector signed long long)__a, __b);
16565 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16566 vector unsigned long long __b) {
16567 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16568 (vector unsigned long long)__a, __b);
16571 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16572 vector bool long long __b) {
16573 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16574 (vector unsigned long long)__a,
16575 (vector unsigned long long)__b);
16577 #endif
16579 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
16580 vector float __b) {
16581 #ifdef __VSX__
16582 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
16583 #else
16584 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
16585 #endif
16588 #ifdef __VSX__
16589 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
16590 vector double __b) {
16591 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
16593 #endif
16595 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16596 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a,
16597 vector signed __int128 __b) {
16598 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b);
16601 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a,
16602 vector unsigned __int128 __b) {
16603 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b);
16605 #endif
16607 /* vec_any_le */
16609 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16610 vector signed char __b) {
16611 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
16614 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16615 vector bool char __b) {
16616 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
16617 (vector signed char)__b);
16620 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16621 vector unsigned char __b) {
16622 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
16625 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16626 vector bool char __b) {
16627 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
16628 (vector unsigned char)__b);
16631 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16632 vector signed char __b) {
16633 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a,
16634 __b);
16637 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16638 vector unsigned char __b) {
16639 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16640 __b);
16643 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16644 vector bool char __b) {
16645 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16646 (vector unsigned char)__b);
16649 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16650 vector short __b) {
16651 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
16654 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16655 vector bool short __b) {
16656 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
16659 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16660 vector unsigned short __b) {
16661 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
16664 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16665 vector bool short __b) {
16666 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
16667 (vector unsigned short)__b);
16670 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16671 vector short __b) {
16672 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a,
16673 __b);
16676 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16677 vector unsigned short __b) {
16678 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16679 __b);
16682 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16683 vector bool short __b) {
16684 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16685 (vector unsigned short)__b);
16688 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
16689 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
16692 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
16693 vector bool int __b) {
16694 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
16697 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16698 vector unsigned int __b) {
16699 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
16702 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16703 vector bool int __b) {
16704 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
16705 (vector unsigned int)__b);
16708 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16709 vector int __b) {
16710 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a,
16711 __b);
16714 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16715 vector unsigned int __b) {
16716 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16717 __b);
16720 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16721 vector bool int __b) {
16722 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16723 (vector unsigned int)__b);
16726 #ifdef __VSX__
16727 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16728 vector signed long long __b) {
16729 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
16732 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16733 vector unsigned long long __b) {
16734 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
16737 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16738 vector bool long long __b) {
16739 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
16740 (vector signed long long)__b);
16743 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16744 vector bool long long __b) {
16745 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
16746 (vector unsigned long long)__b);
16749 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16750 vector signed long long __b) {
16751 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16752 (vector signed long long)__a, __b);
16755 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16756 vector unsigned long long __b) {
16757 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16758 (vector unsigned long long)__a, __b);
16761 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16762 vector bool long long __b) {
16763 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16764 (vector unsigned long long)__a,
16765 (vector unsigned long long)__b);
16767 #endif
16769 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
16770 vector float __b) {
16771 #ifdef __VSX__
16772 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
16773 #else
16774 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
16775 #endif
16778 #ifdef __VSX__
16779 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
16780 vector double __b) {
16781 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
16783 #endif
16785 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16786 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a,
16787 vector signed __int128 __b) {
16788 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b);
16791 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a,
16792 vector unsigned __int128 __b) {
16793 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b);
16795 #endif
16797 /* vec_any_lt */
16799 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16800 vector signed char __b) {
16801 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
16804 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16805 vector bool char __b) {
16806 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
16807 __a);
16810 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16811 vector unsigned char __b) {
16812 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
16815 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16816 vector bool char __b) {
16817 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16818 __a);
16821 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16822 vector signed char __b) {
16823 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b,
16824 (vector signed char)__a);
16827 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16828 vector unsigned char __b) {
16829 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
16830 (vector unsigned char)__a);
16833 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16834 vector bool char __b) {
16835 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16836 (vector unsigned char)__a);
16839 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16840 vector short __b) {
16841 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
16844 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16845 vector bool short __b) {
16846 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
16849 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16850 vector unsigned short __b) {
16851 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
16854 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16855 vector bool short __b) {
16856 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16857 __a);
16860 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16861 vector short __b) {
16862 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b,
16863 (vector signed short)__a);
16866 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16867 vector unsigned short __b) {
16868 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
16869 (vector unsigned short)__a);
16872 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16873 vector bool short __b) {
16874 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16875 (vector unsigned short)__a);
16878 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
16879 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
16882 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
16883 vector bool int __b) {
16884 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
16887 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16888 vector unsigned int __b) {
16889 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
16892 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16893 vector bool int __b) {
16894 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16895 __a);
16898 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16899 vector int __b) {
16900 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b,
16901 (vector signed int)__a);
16904 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16905 vector unsigned int __b) {
16906 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
16907 (vector unsigned int)__a);
16910 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16911 vector bool int __b) {
16912 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16913 (vector unsigned int)__a);
16916 #ifdef __VSX__
16917 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16918 vector signed long long __b) {
16919 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
16922 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16923 vector unsigned long long __b) {
16924 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
16927 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16928 vector bool long long __b) {
16929 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16930 (vector signed long long)__b, __a);
16933 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16934 vector bool long long __b) {
16935 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16936 (vector unsigned long long)__b, __a);
16939 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16940 vector signed long long __b) {
16941 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b,
16942 (vector signed long long)__a);
16945 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16946 vector unsigned long long __b) {
16947 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
16948 (vector unsigned long long)__a);
16951 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16952 vector bool long long __b) {
16953 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16954 (vector unsigned long long)__b,
16955 (vector unsigned long long)__a);
16957 #endif
16959 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
16960 vector float __b) {
16961 #ifdef __VSX__
16962 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
16963 #else
16964 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
16965 #endif
16968 #ifdef __VSX__
16969 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
16970 vector double __b) {
16971 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
16973 #endif
16975 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16976 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a,
16977 vector signed __int128 __b) {
16978 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a);
16981 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a,
16982 vector unsigned __int128 __b) {
16983 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a);
16985 #endif
16987 /* vec_any_nan */
16989 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) {
16990 #ifdef __VSX__
16991 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a);
16992 #else
16993 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
16994 #endif
16996 #ifdef __VSX__
16997 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) {
16998 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a);
17000 #endif
17002 /* vec_any_ne */
17004 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17005 vector signed char __b) {
17006 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17007 (vector char)__b);
17010 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17011 vector bool char __b) {
17012 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17013 (vector char)__b);
17016 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17017 vector unsigned char __b) {
17018 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17019 (vector char)__b);
17022 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17023 vector bool char __b) {
17024 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17025 (vector char)__b);
17028 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17029 vector signed char __b) {
17030 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17031 (vector char)__b);
17034 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17035 vector unsigned char __b) {
17036 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17037 (vector char)__b);
17040 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17041 vector bool char __b) {
17042 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17043 (vector char)__b);
17046 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17047 vector short __b) {
17048 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
17051 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17052 vector bool short __b) {
17053 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
17056 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17057 vector unsigned short __b) {
17058 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17059 (vector short)__b);
17062 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17063 vector bool short __b) {
17064 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17065 (vector short)__b);
17068 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17069 vector short __b) {
17070 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17071 (vector short)__b);
17074 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17075 vector unsigned short __b) {
17076 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17077 (vector short)__b);
17080 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17081 vector bool short __b) {
17082 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17083 (vector short)__b);
17086 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
17087 vector pixel __b) {
17088 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17089 (vector short)__b);
17092 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
17093 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
17096 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
17097 vector bool int __b) {
17098 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
17101 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17102 vector unsigned int __b) {
17103 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17104 (vector int)__b);
17107 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17108 vector bool int __b) {
17109 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17110 (vector int)__b);
17113 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17114 vector int __b) {
17115 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17116 (vector int)__b);
17119 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17120 vector unsigned int __b) {
17121 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17122 (vector int)__b);
17125 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17126 vector bool int __b) {
17127 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17128 (vector int)__b);
17131 #ifdef __VSX__
17132 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17133 vector signed long long __b) {
17134 #ifdef __POWER8_VECTOR__
17135 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
17136 #else
17137 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is
17138 // not available.
17139 return !vec_all_eq(__a, __b);
17140 #endif
17143 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17144 vector unsigned long long __b) {
17145 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17148 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17149 vector bool long long __b) {
17150 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17153 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17154 vector bool long long __b) {
17155 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17158 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17159 vector signed long long __b) {
17160 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17163 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17164 vector unsigned long long __b) {
17165 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17168 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17169 vector bool long long __b) {
17170 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17172 #endif
17174 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
17175 vector float __b) {
17176 #ifdef __VSX__
17177 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
17178 #else
17179 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
17180 #endif
17183 #ifdef __VSX__
17184 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
17185 vector double __b) {
17186 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
17188 #endif
17190 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17191 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a,
17192 vector signed __int128 __b) {
17193 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV,
17194 (vector unsigned __int128)__a, __b);
17197 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a,
17198 vector unsigned __int128 __b) {
17199 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a,
17200 (vector signed __int128)__b);
17203 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a,
17204 vector bool __int128 __b) {
17205 return __builtin_altivec_vcmpequq_p(
17206 __CR6_LT_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
17208 #endif
17210 /* vec_any_nge */
17212 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a,
17213 vector float __b) {
17214 #ifdef __VSX__
17215 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b);
17216 #else
17217 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
17218 #endif
17221 #ifdef __VSX__
17222 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a,
17223 vector double __b) {
17224 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b);
17226 #endif
17228 /* vec_any_ngt */
17230 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a,
17231 vector float __b) {
17232 #ifdef __VSX__
17233 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b);
17234 #else
17235 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
17236 #endif
17239 #ifdef __VSX__
17240 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a,
17241 vector double __b) {
17242 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b);
17244 #endif
17246 /* vec_any_nle */
17248 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a,
17249 vector float __b) {
17250 #ifdef __VSX__
17251 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a);
17252 #else
17253 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
17254 #endif
17257 #ifdef __VSX__
17258 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a,
17259 vector double __b) {
17260 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a);
17262 #endif
17264 /* vec_any_nlt */
17266 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a,
17267 vector float __b) {
17268 #ifdef __VSX__
17269 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a);
17270 #else
17271 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
17272 #endif
17275 #ifdef __VSX__
17276 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a,
17277 vector double __b) {
17278 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a);
17280 #endif
17282 /* vec_any_numeric */
17284 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) {
17285 #ifdef __VSX__
17286 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a);
17287 #else
17288 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
17289 #endif
17292 #ifdef __VSX__
17293 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) {
17294 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a);
17296 #endif
17298 /* vec_any_out */
17300 static __inline__ int __attribute__((__always_inline__))
17301 vec_any_out(vector float __a, vector float __b) {
17302 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
17305 /* Power 8 Crypto functions
17306 Note: We diverge from the current GCC implementation with regard
17307 to cryptography and related functions as follows:
17308 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
17309 - The remaining ones are only available on Power8 and up so
17310 require -mpower8-vector
17311 The justification for this is that export requirements require that
17312 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
17313 support). As a result, we need to be able to turn off support for those.
17314 The remaining ones (currently controlled by -mcrypto for GCC) still
17315 need to be provided on compliant hardware even if Vector.Crypto is not
17316 provided.
17318 #ifdef __CRYPTO__
17319 #define vec_sbox_be __builtin_altivec_crypto_vsbox
17320 #define vec_cipher_be __builtin_altivec_crypto_vcipher
17321 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
17322 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
17323 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
17325 #ifdef __VSX__
17326 static __inline__ vector unsigned long long __attribute__((__always_inline__))
17327 __builtin_crypto_vsbox(vector unsigned long long __a) {
17328 return __builtin_altivec_crypto_vsbox(__a);
17331 static __inline__ vector unsigned long long __attribute__((__always_inline__))
17332 __builtin_crypto_vcipher(vector unsigned long long __a,
17333 vector unsigned long long __b) {
17334 return __builtin_altivec_crypto_vcipher(__a, __b);
17337 static __inline__ vector unsigned long long __attribute__((__always_inline__))
17338 __builtin_crypto_vcipherlast(vector unsigned long long __a,
17339 vector unsigned long long __b) {
17340 return __builtin_altivec_crypto_vcipherlast(__a, __b);
17343 static __inline__ vector unsigned long long __attribute__((__always_inline__))
17344 __builtin_crypto_vncipher(vector unsigned long long __a,
17345 vector unsigned long long __b) {
17346 return __builtin_altivec_crypto_vncipher(__a, __b);
17349 static __inline__ vector unsigned long long __attribute__((__always_inline__))
17350 __builtin_crypto_vncipherlast(vector unsigned long long __a,
17351 vector unsigned long long __b) {
17352 return __builtin_altivec_crypto_vncipherlast(__a, __b);
17354 #endif /* __VSX__ */
17356 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
17357 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
17359 #define vec_shasigma_be(X, Y, Z) \
17360 _Generic((X), vector unsigned int \
17361 : __builtin_crypto_vshasigmaw, vector unsigned long long \
17362 : __builtin_crypto_vshasigmad)((X), (Y), (Z))
17363 #endif
17365 #ifdef __POWER8_VECTOR__
17366 static __inline__ vector bool char __ATTRS_o_ai
17367 vec_permxor(vector bool char __a, vector bool char __b,
17368 vector bool char __c) {
17369 return (vector bool char)__builtin_altivec_crypto_vpermxor(
17370 (vector unsigned char)__a, (vector unsigned char)__b,
17371 (vector unsigned char)__c);
17374 static __inline__ vector signed char __ATTRS_o_ai
17375 vec_permxor(vector signed char __a, vector signed char __b,
17376 vector signed char __c) {
17377 return (vector signed char)__builtin_altivec_crypto_vpermxor(
17378 (vector unsigned char)__a, (vector unsigned char)__b,
17379 (vector unsigned char)__c);
17382 static __inline__ vector unsigned char __ATTRS_o_ai
17383 vec_permxor(vector unsigned char __a, vector unsigned char __b,
17384 vector unsigned char __c) {
17385 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17388 static __inline__ vector unsigned char __ATTRS_o_ai
17389 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
17390 vector unsigned char __c) {
17391 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17394 static __inline__ vector unsigned short __ATTRS_o_ai
17395 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
17396 vector unsigned short __c) {
17397 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
17398 (vector unsigned char)__a, (vector unsigned char)__b,
17399 (vector unsigned char)__c);
17402 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
17403 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
17404 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
17405 (vector unsigned char)__a, (vector unsigned char)__b,
17406 (vector unsigned char)__c);
17409 static __inline__ vector unsigned long long __ATTRS_o_ai
17410 __builtin_crypto_vpermxor(vector unsigned long long __a,
17411 vector unsigned long long __b,
17412 vector unsigned long long __c) {
17413 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
17414 (vector unsigned char)__a, (vector unsigned char)__b,
17415 (vector unsigned char)__c);
17418 static __inline__ vector unsigned char __ATTRS_o_ai
17419 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
17420 return __builtin_altivec_crypto_vpmsumb(__a, __b);
17423 static __inline__ vector unsigned short __ATTRS_o_ai
17424 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
17425 return __builtin_altivec_crypto_vpmsumh(__a, __b);
17428 static __inline__ vector unsigned int __ATTRS_o_ai
17429 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
17430 return __builtin_altivec_crypto_vpmsumw(__a, __b);
17433 static __inline__ vector unsigned long long __ATTRS_o_ai
17434 __builtin_crypto_vpmsumb(vector unsigned long long __a,
17435 vector unsigned long long __b) {
17436 return __builtin_altivec_crypto_vpmsumd(__a, __b);
17439 static __inline__ vector signed char __ATTRS_o_ai
17440 vec_vgbbd(vector signed char __a) {
17441 return (vector signed char)__builtin_altivec_vgbbd((vector unsigned char)__a);
17444 #define vec_pmsum_be __builtin_crypto_vpmsumb
17445 #define vec_gb __builtin_altivec_vgbbd
17447 static __inline__ vector unsigned char __ATTRS_o_ai
17448 vec_vgbbd(vector unsigned char __a) {
17449 return __builtin_altivec_vgbbd(__a);
17452 static __inline__ vector signed long long __ATTRS_o_ai
17453 vec_gbb(vector signed long long __a) {
17454 return (vector signed long long)__builtin_altivec_vgbbd(
17455 (vector unsigned char)__a);
17458 static __inline__ vector unsigned long long __ATTRS_o_ai
17459 vec_gbb(vector unsigned long long __a) {
17460 return (vector unsigned long long)__builtin_altivec_vgbbd(
17461 (vector unsigned char)__a);
17464 static __inline__ vector long long __ATTRS_o_ai
17465 vec_vbpermq(vector signed char __a, vector signed char __b) {
17466 return (vector long long)__builtin_altivec_vbpermq((vector unsigned char)__a,
17467 (vector unsigned char)__b);
17470 static __inline__ vector long long __ATTRS_o_ai
17471 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
17472 return (vector long long)__builtin_altivec_vbpermq(__a, __b);
17475 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__)
17476 static __inline__ vector unsigned long long __ATTRS_o_ai
17477 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
17478 return __builtin_altivec_vbpermq((vector unsigned char)__a,
17479 (vector unsigned char)__b);
17481 #endif
17482 static __inline__ vector unsigned char __ATTRS_o_ai
17483 vec_bperm(vector unsigned char __a, vector unsigned char __b) {
17484 return (vector unsigned char)__builtin_altivec_vbpermq(__a, __b);
17486 #endif // __POWER8_VECTOR__
17487 #ifdef __POWER9_VECTOR__
17488 static __inline__ vector unsigned long long __ATTRS_o_ai
17489 vec_bperm(vector unsigned long long __a, vector unsigned char __b) {
17490 return __builtin_altivec_vbpermd(__a, __b);
17492 #endif
17495 /* vec_reve */
17497 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
17498 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17499 5, 4, 3, 2, 1, 0);
17502 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
17503 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17504 5, 4, 3, 2, 1, 0);
17507 static inline __ATTRS_o_ai vector unsigned char
17508 vec_reve(vector unsigned char __a) {
17509 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17510 5, 4, 3, 2, 1, 0);
17513 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
17514 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17517 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
17518 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17521 static inline __ATTRS_o_ai vector unsigned int
17522 vec_reve(vector unsigned int __a) {
17523 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17526 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
17527 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17530 static inline __ATTRS_o_ai vector signed short
17531 vec_reve(vector signed short __a) {
17532 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17535 static inline __ATTRS_o_ai vector unsigned short
17536 vec_reve(vector unsigned short __a) {
17537 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17540 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
17541 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17544 #ifdef __VSX__
17545 static inline __ATTRS_o_ai vector bool long long
17546 vec_reve(vector bool long long __a) {
17547 return __builtin_shufflevector(__a, __a, 1, 0);
17550 static inline __ATTRS_o_ai vector signed long long
17551 vec_reve(vector signed long long __a) {
17552 return __builtin_shufflevector(__a, __a, 1, 0);
17555 static inline __ATTRS_o_ai vector unsigned long long
17556 vec_reve(vector unsigned long long __a) {
17557 return __builtin_shufflevector(__a, __a, 1, 0);
17560 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
17561 return __builtin_shufflevector(__a, __a, 1, 0);
17563 #endif
17565 /* vec_revb */
17566 static __inline__ vector bool char __ATTRS_o_ai
17567 vec_revb(vector bool char __a) {
17568 return __a;
17571 static __inline__ vector signed char __ATTRS_o_ai
17572 vec_revb(vector signed char __a) {
17573 return __a;
17576 static __inline__ vector unsigned char __ATTRS_o_ai
17577 vec_revb(vector unsigned char __a) {
17578 return __a;
17581 static __inline__ vector bool short __ATTRS_o_ai
17582 vec_revb(vector bool short __a) {
17583 vector unsigned char __indices =
17584 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17585 return vec_perm(__a, __a, __indices);
17588 static __inline__ vector signed short __ATTRS_o_ai
17589 vec_revb(vector signed short __a) {
17590 vector unsigned char __indices =
17591 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17592 return vec_perm(__a, __a, __indices);
17595 static __inline__ vector unsigned short __ATTRS_o_ai
17596 vec_revb(vector unsigned short __a) {
17597 vector unsigned char __indices =
17598 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17599 return vec_perm(__a, __a, __indices);
17602 static __inline__ vector bool int __ATTRS_o_ai
17603 vec_revb(vector bool int __a) {
17604 vector unsigned char __indices =
17605 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17606 return vec_perm(__a, __a, __indices);
17609 static __inline__ vector signed int __ATTRS_o_ai
17610 vec_revb(vector signed int __a) {
17611 vector unsigned char __indices =
17612 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17613 return vec_perm(__a, __a, __indices);
17616 static __inline__ vector unsigned int __ATTRS_o_ai
17617 vec_revb(vector unsigned int __a) {
17618 vector unsigned char __indices =
17619 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17620 return vec_perm(__a, __a, __indices);
17623 static __inline__ vector float __ATTRS_o_ai
17624 vec_revb(vector float __a) {
17625 vector unsigned char __indices =
17626 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17627 return vec_perm(__a, __a, __indices);
17630 #ifdef __VSX__
17631 static __inline__ vector bool long long __ATTRS_o_ai
17632 vec_revb(vector bool long long __a) {
17633 vector unsigned char __indices =
17634 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17635 return vec_perm(__a, __a, __indices);
17638 static __inline__ vector signed long long __ATTRS_o_ai
17639 vec_revb(vector signed long long __a) {
17640 vector unsigned char __indices =
17641 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17642 return vec_perm(__a, __a, __indices);
17645 static __inline__ vector unsigned long long __ATTRS_o_ai
17646 vec_revb(vector unsigned long long __a) {
17647 vector unsigned char __indices =
17648 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17649 return vec_perm(__a, __a, __indices);
17652 static __inline__ vector double __ATTRS_o_ai
17653 vec_revb(vector double __a) {
17654 vector unsigned char __indices =
17655 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17656 return vec_perm(__a, __a, __indices);
17658 #endif /* End __VSX__ */
17660 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17661 defined(__SIZEOF_INT128__)
17662 static __inline__ vector signed __int128 __ATTRS_o_ai
17663 vec_revb(vector signed __int128 __a) {
17664 vector unsigned char __indices =
17665 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17666 return (vector signed __int128)vec_perm((vector signed int)__a,
17667 (vector signed int)__a,
17668 __indices);
17671 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17672 vec_revb(vector unsigned __int128 __a) {
17673 vector unsigned char __indices =
17674 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17675 return (vector unsigned __int128)vec_perm((vector signed int)__a,
17676 (vector signed int)__a,
17677 __indices);
17679 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
17681 /* vec_xl */
17683 #define vec_xld2 vec_xl
17684 #define vec_xlw4 vec_xl
17685 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
17686 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
17687 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
17688 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
17689 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
17690 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
17691 typedef vector float unaligned_vec_float __attribute__((aligned(1)));
17693 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
17694 const signed char *__ptr) {
17695 return *(unaligned_vec_schar *)(__ptr + __offset);
17698 static inline __ATTRS_o_ai vector unsigned char
17699 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
17700 return *(unaligned_vec_uchar*)(__ptr + __offset);
17703 static inline __ATTRS_o_ai vector signed short
17704 vec_xl(ptrdiff_t __offset, const signed short *__ptr) {
17705 signed char *__addr = (signed char *)__ptr + __offset;
17706 return *(unaligned_vec_sshort *)__addr;
17709 static inline __ATTRS_o_ai vector unsigned short
17710 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
17711 signed char *__addr = (signed char *)__ptr + __offset;
17712 return *(unaligned_vec_ushort *)__addr;
17715 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
17716 const signed int *__ptr) {
17717 signed char *__addr = (signed char *)__ptr + __offset;
17718 return *(unaligned_vec_sint *)__addr;
17721 static inline __ATTRS_o_ai vector unsigned int
17722 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
17723 signed char *__addr = (signed char *)__ptr + __offset;
17724 return *(unaligned_vec_uint *)__addr;
17727 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
17728 const float *__ptr) {
17729 signed char *__addr = (signed char *)__ptr + __offset;
17730 return *(unaligned_vec_float *)__addr;
17733 #ifdef __VSX__
17734 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
17735 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
17736 typedef vector double unaligned_vec_double __attribute__((aligned(1)));
17738 static inline __ATTRS_o_ai vector signed long long
17739 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) {
17740 signed char *__addr = (signed char *)__ptr + __offset;
17741 return *(unaligned_vec_sll *)__addr;
17744 static inline __ATTRS_o_ai vector unsigned long long
17745 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
17746 signed char *__addr = (signed char *)__ptr + __offset;
17747 return *(unaligned_vec_ull *)__addr;
17750 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
17751 const double *__ptr) {
17752 signed char *__addr = (signed char *)__ptr + __offset;
17753 return *(unaligned_vec_double *)__addr;
17755 #endif
17757 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17758 defined(__SIZEOF_INT128__)
17759 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
17760 typedef vector unsigned __int128 unaligned_vec_ui128
17761 __attribute__((aligned(1)));
17762 static inline __ATTRS_o_ai vector signed __int128
17763 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) {
17764 signed char *__addr = (signed char *)__ptr + __offset;
17765 return *(unaligned_vec_si128 *)__addr;
17768 static inline __ATTRS_o_ai vector unsigned __int128
17769 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
17770 signed char *__addr = (signed char *)__ptr + __offset;
17771 return *(unaligned_vec_ui128 *)__addr;
17773 #endif
17775 /* vec_xl_be */
17777 #ifdef __LITTLE_ENDIAN__
17778 static __inline__ vector signed char __ATTRS_o_ai
17779 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) {
17780 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17781 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17782 13, 12, 11, 10, 9, 8);
17785 static __inline__ vector unsigned char __ATTRS_o_ai
17786 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) {
17787 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17788 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17789 13, 12, 11, 10, 9, 8);
17792 static __inline__ vector signed short __ATTRS_o_ai
17793 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) {
17794 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17795 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17798 static __inline__ vector unsigned short __ATTRS_o_ai
17799 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) {
17800 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17801 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17804 static __inline__ vector signed int __ATTRS_o_ai
17805 vec_xl_be(signed long long __offset, const signed int *__ptr) {
17806 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17809 static __inline__ vector unsigned int __ATTRS_o_ai
17810 vec_xl_be(signed long long __offset, const unsigned int *__ptr) {
17811 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17814 static __inline__ vector float __ATTRS_o_ai
17815 vec_xl_be(signed long long __offset, const float *__ptr) {
17816 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17819 #ifdef __VSX__
17820 static __inline__ vector signed long long __ATTRS_o_ai
17821 vec_xl_be(signed long long __offset, const signed long long *__ptr) {
17822 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17825 static __inline__ vector unsigned long long __ATTRS_o_ai
17826 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) {
17827 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17830 static __inline__ vector double __ATTRS_o_ai
17831 vec_xl_be(signed long long __offset, const double *__ptr) {
17832 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17834 #endif
17836 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17837 defined(__SIZEOF_INT128__)
17838 static __inline__ vector signed __int128 __ATTRS_o_ai
17839 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) {
17840 return vec_xl(__offset, __ptr);
17843 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17844 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
17845 return vec_xl(__offset, __ptr);
17847 #endif
17848 #else
17849 #define vec_xl_be vec_xl
17850 #endif
17852 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
17853 defined(__SIZEOF_INT128__)
17855 /* vec_xl_sext */
17857 static __inline__ vector signed __int128 __ATTRS_o_ai
17858 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) {
17859 return (vector signed __int128)*(__pointer + __offset);
17862 static __inline__ vector signed __int128 __ATTRS_o_ai
17863 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) {
17864 return (vector signed __int128)*(__pointer + __offset);
17867 static __inline__ vector signed __int128 __ATTRS_o_ai
17868 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) {
17869 return (vector signed __int128)*(__pointer + __offset);
17872 static __inline__ vector signed __int128 __ATTRS_o_ai
17873 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) {
17874 return (vector signed __int128)*(__pointer + __offset);
17877 /* vec_xl_zext */
17879 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17880 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) {
17881 return (vector unsigned __int128)*(__pointer + __offset);
17884 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17885 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) {
17886 return (vector unsigned __int128)*(__pointer + __offset);
17889 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17890 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) {
17891 return (vector unsigned __int128)*(__pointer + __offset);
17894 static __inline__ vector unsigned __int128 __ATTRS_o_ai
17895 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) {
17896 return (vector unsigned __int128)*(__pointer + __offset);
17899 #endif
17901 /* vec_xlds */
17902 #ifdef __VSX__
17903 static __inline__ vector signed long long __ATTRS_o_ai
17904 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) {
17905 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset);
17906 return (vector signed long long) *__addr;
17909 static __inline__ vector unsigned long long __ATTRS_o_ai
17910 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) {
17911 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset);
17912 return (unaligned_vec_ull) *__addr;
17915 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset,
17916 const double *__ptr) {
17917 double *__addr = (double*)((signed char *)__ptr + __offset);
17918 return (unaligned_vec_double) *__addr;
17921 /* vec_load_splats */
17922 static __inline__ vector signed int __ATTRS_o_ai
17923 vec_load_splats(signed long long __offset, const signed int *__ptr) {
17924 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17925 return (vector signed int)*__addr;
17928 static __inline__ vector signed int __ATTRS_o_ai
17929 vec_load_splats(unsigned long long __offset, const signed int *__ptr) {
17930 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17931 return (vector signed int)*__addr;
17934 static __inline__ vector unsigned int __ATTRS_o_ai
17935 vec_load_splats(signed long long __offset, const unsigned int *__ptr) {
17936 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17937 return (vector unsigned int)*__addr;
17940 static __inline__ vector unsigned int __ATTRS_o_ai
17941 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) {
17942 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17943 return (vector unsigned int)*__addr;
17946 static __inline__ vector float __ATTRS_o_ai
17947 vec_load_splats(signed long long __offset, const float *__ptr) {
17948 float *__addr = (float*)((signed char *)__ptr + __offset);
17949 return (vector float)*__addr;
17952 static __inline__ vector float __ATTRS_o_ai
17953 vec_load_splats(unsigned long long __offset, const float *__ptr) {
17954 float *__addr = (float*)((signed char *)__ptr + __offset);
17955 return (vector float)*__addr;
17957 #endif
17959 /* vec_xst */
17961 #define vec_xstd2 vec_xst
17962 #define vec_xstw4 vec_xst
17963 static inline __ATTRS_o_ai void
17964 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) {
17965 *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
17968 static inline __ATTRS_o_ai void
17969 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) {
17970 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
17973 static inline __ATTRS_o_ai void
17974 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
17975 signed char *__addr = (signed char *)__ptr + __offset;
17976 *(unaligned_vec_sshort *)__addr = __vec;
17979 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
17980 ptrdiff_t __offset,
17981 unsigned short *__ptr) {
17982 signed char *__addr = (signed char *)__ptr + __offset;
17983 *(unaligned_vec_ushort *)__addr = __vec;
17986 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
17987 ptrdiff_t __offset, signed int *__ptr) {
17988 signed char *__addr = (signed char *)__ptr + __offset;
17989 *(unaligned_vec_sint *)__addr = __vec;
17992 static inline __ATTRS_o_ai void
17993 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
17994 signed char *__addr = (signed char *)__ptr + __offset;
17995 *(unaligned_vec_uint *)__addr = __vec;
17998 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
17999 float *__ptr) {
18000 signed char *__addr = (signed char *)__ptr + __offset;
18001 *(unaligned_vec_float *)__addr = __vec;
18004 #ifdef __VSX__
18005 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
18006 ptrdiff_t __offset,
18007 signed long long *__ptr) {
18008 signed char *__addr = (signed char *)__ptr + __offset;
18009 *(unaligned_vec_sll *)__addr = __vec;
18012 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
18013 ptrdiff_t __offset,
18014 unsigned long long *__ptr) {
18015 signed char *__addr = (signed char *)__ptr + __offset;
18016 *(unaligned_vec_ull *)__addr = __vec;
18019 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
18020 double *__ptr) {
18021 signed char *__addr = (signed char *)__ptr + __offset;
18022 *(unaligned_vec_double *)__addr = __vec;
18024 #endif
18026 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18027 defined(__SIZEOF_INT128__)
18028 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
18029 ptrdiff_t __offset,
18030 signed __int128 *__ptr) {
18031 signed char *__addr = (signed char *)__ptr + __offset;
18032 *(unaligned_vec_si128 *)__addr = __vec;
18035 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
18036 ptrdiff_t __offset,
18037 unsigned __int128 *__ptr) {
18038 signed char *__addr = (signed char *)__ptr + __offset;
18039 *(unaligned_vec_ui128 *)__addr = __vec;
18041 #endif
18043 /* vec_xst_trunc */
18045 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
18046 defined(__SIZEOF_INT128__)
18047 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18048 ptrdiff_t __offset,
18049 signed char *__ptr) {
18050 *(__ptr + __offset) = (signed char)__vec[0];
18053 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18054 ptrdiff_t __offset,
18055 unsigned char *__ptr) {
18056 *(__ptr + __offset) = (unsigned char)__vec[0];
18059 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18060 ptrdiff_t __offset,
18061 signed short *__ptr) {
18062 *(__ptr + __offset) = (signed short)__vec[0];
18065 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18066 ptrdiff_t __offset,
18067 unsigned short *__ptr) {
18068 *(__ptr + __offset) = (unsigned short)__vec[0];
18071 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18072 ptrdiff_t __offset,
18073 signed int *__ptr) {
18074 *(__ptr + __offset) = (signed int)__vec[0];
18077 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18078 ptrdiff_t __offset,
18079 unsigned int *__ptr) {
18080 *(__ptr + __offset) = (unsigned int)__vec[0];
18083 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18084 ptrdiff_t __offset,
18085 signed long long *__ptr) {
18086 *(__ptr + __offset) = (signed long long)__vec[0];
18089 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18090 ptrdiff_t __offset,
18091 unsigned long long *__ptr) {
18092 *(__ptr + __offset) = (unsigned long long)__vec[0];
18094 #endif
18096 /* vec_xst_be */
18098 #ifdef __LITTLE_ENDIAN__
18099 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
18100 signed long long __offset,
18101 signed char *__ptr) {
18102 vector signed char __tmp =
18103 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18104 13, 12, 11, 10, 9, 8);
18105 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18106 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18109 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
18110 signed long long __offset,
18111 unsigned char *__ptr) {
18112 vector unsigned char __tmp =
18113 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18114 13, 12, 11, 10, 9, 8);
18115 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18116 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18119 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
18120 signed long long __offset,
18121 signed short *__ptr) {
18122 vector signed short __tmp =
18123 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18124 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18125 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18128 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
18129 signed long long __offset,
18130 unsigned short *__ptr) {
18131 vector unsigned short __tmp =
18132 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18133 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18134 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18137 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
18138 signed long long __offset,
18139 signed int *__ptr) {
18140 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
18143 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
18144 signed long long __offset,
18145 unsigned int *__ptr) {
18146 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18149 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
18150 signed long long __offset,
18151 float *__ptr) {
18152 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18155 #ifdef __VSX__
18156 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
18157 signed long long __offset,
18158 signed long long *__ptr) {
18159 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18162 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
18163 signed long long __offset,
18164 unsigned long long *__ptr) {
18165 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18168 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
18169 signed long long __offset,
18170 double *__ptr) {
18171 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18173 #endif
18175 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18176 defined(__SIZEOF_INT128__)
18177 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
18178 signed long long __offset,
18179 signed __int128 *__ptr) {
18180 vec_xst(__vec, __offset, __ptr);
18183 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
18184 signed long long __offset,
18185 unsigned __int128 *__ptr) {
18186 vec_xst(__vec, __offset, __ptr);
18188 #endif
18189 #else
18190 #define vec_xst_be vec_xst
18191 #endif
18193 #ifdef __POWER9_VECTOR__
18194 #define vec_test_data_class(__a, __b) \
18195 _Generic( \
18196 (__a), vector float \
18197 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
18198 vector double \
18199 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
18200 (__b)))
18202 #endif /* #ifdef __POWER9_VECTOR__ */
18204 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
18205 return -__a;
18208 #ifdef __VSX__
18209 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
18210 return -__a;
18213 #endif
18215 #ifdef __VSX__
18216 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
18217 return -__a;
18219 #endif
18221 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
18222 return -__a;
18225 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
18226 return -__a;
18229 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
18230 return -__a;
18233 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
18234 return - vec_abs(__a);
18237 #ifdef __VSX__
18238 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
18239 return - vec_abs(__a);
18242 #endif
18244 #ifdef __POWER8_VECTOR__
18245 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
18246 return __builtin_altivec_vminsd(__a, -__a);
18248 #endif
18250 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
18251 return __builtin_altivec_vminsw(__a, -__a);
18254 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
18255 return __builtin_altivec_vminsh(__a, -__a);
18258 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
18259 return __builtin_altivec_vminsb(__a, -__a);
18262 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a,
18263 vector float __b) {
18264 return __builtin_ppc_recipdivf(__a, __b);
18267 #ifdef __VSX__
18268 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a,
18269 vector double __b) {
18270 return __builtin_ppc_recipdivd(__a, __b);
18272 #endif
18274 #ifdef __POWER10_VECTOR__
18276 /* vec_extractm */
18278 static __inline__ unsigned int __ATTRS_o_ai
18279 vec_extractm(vector unsigned char __a) {
18280 return __builtin_altivec_vextractbm(__a);
18283 static __inline__ unsigned int __ATTRS_o_ai
18284 vec_extractm(vector unsigned short __a) {
18285 return __builtin_altivec_vextracthm(__a);
18288 static __inline__ unsigned int __ATTRS_o_ai
18289 vec_extractm(vector unsigned int __a) {
18290 return __builtin_altivec_vextractwm(__a);
18293 static __inline__ unsigned int __ATTRS_o_ai
18294 vec_extractm(vector unsigned long long __a) {
18295 return __builtin_altivec_vextractdm(__a);
18298 #ifdef __SIZEOF_INT128__
18299 static __inline__ unsigned int __ATTRS_o_ai
18300 vec_extractm(vector unsigned __int128 __a) {
18301 return __builtin_altivec_vextractqm(__a);
18303 #endif
18305 /* vec_expandm */
18307 static __inline__ vector unsigned char __ATTRS_o_ai
18308 vec_expandm(vector unsigned char __a) {
18309 return __builtin_altivec_vexpandbm(__a);
18312 static __inline__ vector unsigned short __ATTRS_o_ai
18313 vec_expandm(vector unsigned short __a) {
18314 return __builtin_altivec_vexpandhm(__a);
18317 static __inline__ vector unsigned int __ATTRS_o_ai
18318 vec_expandm(vector unsigned int __a) {
18319 return __builtin_altivec_vexpandwm(__a);
18322 static __inline__ vector unsigned long long __ATTRS_o_ai
18323 vec_expandm(vector unsigned long long __a) {
18324 return __builtin_altivec_vexpanddm(__a);
18327 #ifdef __SIZEOF_INT128__
18328 static __inline__ vector unsigned __int128 __ATTRS_o_ai
18329 vec_expandm(vector unsigned __int128 __a) {
18330 return __builtin_altivec_vexpandqm(__a);
18332 #endif
18334 /* vec_cntm */
18336 #define vec_cntm(__a, __mp) \
18337 _Generic((__a), vector unsigned char \
18338 : __builtin_altivec_vcntmbb((vector unsigned char)(__a), \
18339 (unsigned char)(__mp)), \
18340 vector unsigned short \
18341 : __builtin_altivec_vcntmbh((vector unsigned short)(__a), \
18342 (unsigned char)(__mp)), \
18343 vector unsigned int \
18344 : __builtin_altivec_vcntmbw((vector unsigned int)(__a), \
18345 (unsigned char)(__mp)), \
18346 vector unsigned long long \
18347 : __builtin_altivec_vcntmbd((vector unsigned long long)(__a), \
18348 (unsigned char)(__mp)))
18350 /* vec_gen[b|h|w|d|q]m */
18352 static __inline__ vector unsigned char __ATTRS_o_ai
18353 vec_genbm(unsigned long long __bm) {
18354 return __builtin_altivec_mtvsrbm(__bm);
18357 static __inline__ vector unsigned short __ATTRS_o_ai
18358 vec_genhm(unsigned long long __bm) {
18359 return __builtin_altivec_mtvsrhm(__bm);
18362 static __inline__ vector unsigned int __ATTRS_o_ai
18363 vec_genwm(unsigned long long __bm) {
18364 return __builtin_altivec_mtvsrwm(__bm);
18367 static __inline__ vector unsigned long long __ATTRS_o_ai
18368 vec_gendm(unsigned long long __bm) {
18369 return __builtin_altivec_mtvsrdm(__bm);
18372 #ifdef __SIZEOF_INT128__
18373 static __inline__ vector unsigned __int128 __ATTRS_o_ai
18374 vec_genqm(unsigned long long __bm) {
18375 return __builtin_altivec_mtvsrqm(__bm);
18377 #endif
18379 /* vec_pdep */
18381 static __inline__ vector unsigned long long __ATTRS_o_ai
18382 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) {
18383 return __builtin_altivec_vpdepd(__a, __b);
18386 /* vec_pext */
18388 static __inline__ vector unsigned long long __ATTRS_o_ai
18389 vec_pext(vector unsigned long long __a, vector unsigned long long __b) {
18390 return __builtin_altivec_vpextd(__a, __b);
18393 /* vec_cfuge */
18395 static __inline__ vector unsigned long long __ATTRS_o_ai
18396 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) {
18397 return __builtin_altivec_vcfuged(__a, __b);
18400 /* vec_gnb */
18402 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b)
18404 /* vec_ternarylogic */
18405 #ifdef __VSX__
18406 #ifdef __SIZEOF_INT128__
18407 #define vec_ternarylogic(__a, __b, __c, __imm) \
18408 _Generic((__a), vector unsigned char \
18409 : (vector unsigned char)__builtin_vsx_xxeval( \
18410 (vector unsigned long long)(__a), \
18411 (vector unsigned long long)(__b), \
18412 (vector unsigned long long)(__c), (__imm)), \
18413 vector unsigned short \
18414 : (vector unsigned short)__builtin_vsx_xxeval( \
18415 (vector unsigned long long)(__a), \
18416 (vector unsigned long long)(__b), \
18417 (vector unsigned long long)(__c), (__imm)), \
18418 vector unsigned int \
18419 : (vector unsigned int)__builtin_vsx_xxeval( \
18420 (vector unsigned long long)(__a), \
18421 (vector unsigned long long)(__b), \
18422 (vector unsigned long long)(__c), (__imm)), \
18423 vector unsigned long long \
18424 : (vector unsigned long long)__builtin_vsx_xxeval( \
18425 (vector unsigned long long)(__a), \
18426 (vector unsigned long long)(__b), \
18427 (vector unsigned long long)(__c), (__imm)), \
18428 vector unsigned __int128 \
18429 : (vector unsigned __int128)__builtin_vsx_xxeval( \
18430 (vector unsigned long long)(__a), \
18431 (vector unsigned long long)(__b), \
18432 (vector unsigned long long)(__c), (__imm)))
18433 #else
18434 #define vec_ternarylogic(__a, __b, __c, __imm) \
18435 _Generic((__a), vector unsigned char \
18436 : (vector unsigned char)__builtin_vsx_xxeval( \
18437 (vector unsigned long long)(__a), \
18438 (vector unsigned long long)(__b), \
18439 (vector unsigned long long)(__c), (__imm)), \
18440 vector unsigned short \
18441 : (vector unsigned short)__builtin_vsx_xxeval( \
18442 (vector unsigned long long)(__a), \
18443 (vector unsigned long long)(__b), \
18444 (vector unsigned long long)(__c), (__imm)), \
18445 vector unsigned int \
18446 : (vector unsigned int)__builtin_vsx_xxeval( \
18447 (vector unsigned long long)(__a), \
18448 (vector unsigned long long)(__b), \
18449 (vector unsigned long long)(__c), (__imm)), \
18450 vector unsigned long long \
18451 : (vector unsigned long long)__builtin_vsx_xxeval( \
18452 (vector unsigned long long)(__a), \
18453 (vector unsigned long long)(__b), \
18454 (vector unsigned long long)(__c), (__imm)))
18455 #endif /* __SIZEOF_INT128__ */
18456 #endif /* __VSX__ */
18458 /* vec_genpcvm */
18460 #ifdef __VSX__
18461 #define vec_genpcvm(__a, __imm) \
18462 _Generic( \
18463 (__a), vector unsigned char \
18464 : __builtin_vsx_xxgenpcvbm((vector unsigned char)(__a), (int)(__imm)), \
18465 vector unsigned short \
18466 : __builtin_vsx_xxgenpcvhm((vector unsigned short)(__a), (int)(__imm)), \
18467 vector unsigned int \
18468 : __builtin_vsx_xxgenpcvwm((vector unsigned int)(__a), (int)(__imm)), \
18469 vector unsigned long long \
18470 : __builtin_vsx_xxgenpcvdm((vector unsigned long long)(__a), \
18471 (int)(__imm)))
18472 #endif /* __VSX__ */
18474 /* vec_clr_first */
18476 static __inline__ vector signed char __ATTRS_o_ai
18477 vec_clr_first(vector signed char __a, unsigned int __n) {
18478 #ifdef __LITTLE_ENDIAN__
18479 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18480 __n);
18481 #else
18482 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18483 __n);
18484 #endif
18487 static __inline__ vector unsigned char __ATTRS_o_ai
18488 vec_clr_first(vector unsigned char __a, unsigned int __n) {
18489 #ifdef __LITTLE_ENDIAN__
18490 return (vector unsigned char)__builtin_altivec_vclrrb(
18491 (vector unsigned char)__a, __n);
18492 #else
18493 return (vector unsigned char)__builtin_altivec_vclrlb(
18494 (vector unsigned char)__a, __n);
18495 #endif
18498 /* vec_clr_last */
18500 static __inline__ vector signed char __ATTRS_o_ai
18501 vec_clr_last(vector signed char __a, unsigned int __n) {
18502 #ifdef __LITTLE_ENDIAN__
18503 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18504 __n);
18505 #else
18506 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18507 __n);
18508 #endif
18511 static __inline__ vector unsigned char __ATTRS_o_ai
18512 vec_clr_last(vector unsigned char __a, unsigned int __n) {
18513 #ifdef __LITTLE_ENDIAN__
18514 return (vector unsigned char)__builtin_altivec_vclrlb(
18515 (vector unsigned char)__a, __n);
18516 #else
18517 return (vector unsigned char)__builtin_altivec_vclrrb(
18518 (vector unsigned char)__a, __n);
18519 #endif
18522 /* vec_cntlzm */
18524 static __inline__ vector unsigned long long __ATTRS_o_ai
18525 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) {
18526 return __builtin_altivec_vclzdm(__a, __b);
18529 /* vec_cnttzm */
18531 static __inline__ vector unsigned long long __ATTRS_o_ai
18532 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) {
18533 return __builtin_altivec_vctzdm(__a, __b);
18536 /* vec_mod */
18538 static __inline__ vector signed int __ATTRS_o_ai
18539 vec_mod(vector signed int __a, vector signed int __b) {
18540 return __a % __b;
18543 static __inline__ vector unsigned int __ATTRS_o_ai
18544 vec_mod(vector unsigned int __a, vector unsigned int __b) {
18545 return __a % __b;
18548 static __inline__ vector signed long long __ATTRS_o_ai
18549 vec_mod(vector signed long long __a, vector signed long long __b) {
18550 return __a % __b;
18553 static __inline__ vector unsigned long long __ATTRS_o_ai
18554 vec_mod(vector unsigned long long __a, vector unsigned long long __b) {
18555 return __a % __b;
18558 #ifdef __SIZEOF_INT128__
18559 static __inline__ vector signed __int128 __ATTRS_o_ai
18560 vec_mod(vector signed __int128 __a, vector signed __int128 __b) {
18561 return __a % __b;
18564 static __inline__ vector unsigned __int128 __ATTRS_o_ai
18565 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18566 return __a % __b;
18568 #endif
18570 /* vec_sldb */
18571 #define vec_sldb(__a, __b, __c) \
18572 _Generic( \
18573 (__a), vector unsigned char \
18574 : (vector unsigned char)__builtin_altivec_vsldbi( \
18575 (vector unsigned char)__a, (vector unsigned char)__b, \
18576 (__c & 0x7)), \
18577 vector signed char \
18578 : (vector signed char)__builtin_altivec_vsldbi( \
18579 (vector unsigned char)__a, (vector unsigned char)__b, \
18580 (__c & 0x7)), \
18581 vector unsigned short \
18582 : (vector unsigned short)__builtin_altivec_vsldbi( \
18583 (vector unsigned char)__a, (vector unsigned char)__b, \
18584 (__c & 0x7)), \
18585 vector signed short \
18586 : (vector signed short)__builtin_altivec_vsldbi( \
18587 (vector unsigned char)__a, (vector unsigned char)__b, \
18588 (__c & 0x7)), \
18589 vector unsigned int \
18590 : (vector unsigned int)__builtin_altivec_vsldbi( \
18591 (vector unsigned char)__a, (vector unsigned char)__b, \
18592 (__c & 0x7)), \
18593 vector signed int \
18594 : (vector signed int)__builtin_altivec_vsldbi((vector unsigned char)__a, \
18595 (vector unsigned char)__b, \
18596 (__c & 0x7)), \
18597 vector unsigned long long \
18598 : (vector unsigned long long)__builtin_altivec_vsldbi( \
18599 (vector unsigned char)__a, (vector unsigned char)__b, \
18600 (__c & 0x7)), \
18601 vector signed long long \
18602 : (vector signed long long)__builtin_altivec_vsldbi( \
18603 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18605 /* vec_srdb */
18606 #define vec_srdb(__a, __b, __c) \
18607 _Generic( \
18608 (__a), vector unsigned char \
18609 : (vector unsigned char)__builtin_altivec_vsrdbi( \
18610 (vector unsigned char)__a, (vector unsigned char)__b, \
18611 (__c & 0x7)), \
18612 vector signed char \
18613 : (vector signed char)__builtin_altivec_vsrdbi( \
18614 (vector unsigned char)__a, (vector unsigned char)__b, \
18615 (__c & 0x7)), \
18616 vector unsigned short \
18617 : (vector unsigned short)__builtin_altivec_vsrdbi( \
18618 (vector unsigned char)__a, (vector unsigned char)__b, \
18619 (__c & 0x7)), \
18620 vector signed short \
18621 : (vector signed short)__builtin_altivec_vsrdbi( \
18622 (vector unsigned char)__a, (vector unsigned char)__b, \
18623 (__c & 0x7)), \
18624 vector unsigned int \
18625 : (vector unsigned int)__builtin_altivec_vsrdbi( \
18626 (vector unsigned char)__a, (vector unsigned char)__b, \
18627 (__c & 0x7)), \
18628 vector signed int \
18629 : (vector signed int)__builtin_altivec_vsrdbi((vector unsigned char)__a, \
18630 (vector unsigned char)__b, \
18631 (__c & 0x7)), \
18632 vector unsigned long long \
18633 : (vector unsigned long long)__builtin_altivec_vsrdbi( \
18634 (vector unsigned char)__a, (vector unsigned char)__b, \
18635 (__c & 0x7)), \
18636 vector signed long long \
18637 : (vector signed long long)__builtin_altivec_vsrdbi( \
18638 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18640 /* vec_insertl */
18642 static __inline__ vector unsigned char __ATTRS_o_ai
18643 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18644 #ifdef __LITTLE_ENDIAN__
18645 return __builtin_altivec_vinsbrx(__b, __c, __a);
18646 #else
18647 return __builtin_altivec_vinsblx(__b, __c, __a);
18648 #endif
18651 static __inline__ vector unsigned short __ATTRS_o_ai
18652 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18653 #ifdef __LITTLE_ENDIAN__
18654 return __builtin_altivec_vinshrx(__b, __c, __a);
18655 #else
18656 return __builtin_altivec_vinshlx(__b, __c, __a);
18657 #endif
18660 static __inline__ vector unsigned int __ATTRS_o_ai
18661 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18662 #ifdef __LITTLE_ENDIAN__
18663 return __builtin_altivec_vinswrx(__b, __c, __a);
18664 #else
18665 return __builtin_altivec_vinswlx(__b, __c, __a);
18666 #endif
18669 static __inline__ vector unsigned long long __ATTRS_o_ai
18670 vec_insertl(unsigned long long __a, vector unsigned long long __b,
18671 unsigned int __c) {
18672 #ifdef __LITTLE_ENDIAN__
18673 return __builtin_altivec_vinsdrx(__b, __c, __a);
18674 #else
18675 return __builtin_altivec_vinsdlx(__b, __c, __a);
18676 #endif
18679 static __inline__ vector unsigned char __ATTRS_o_ai
18680 vec_insertl(vector unsigned char __a, vector unsigned char __b,
18681 unsigned int __c) {
18682 #ifdef __LITTLE_ENDIAN__
18683 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18684 #else
18685 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18686 #endif
18689 static __inline__ vector unsigned short __ATTRS_o_ai
18690 vec_insertl(vector unsigned short __a, vector unsigned short __b,
18691 unsigned int __c) {
18692 #ifdef __LITTLE_ENDIAN__
18693 return __builtin_altivec_vinshvrx(__b, __c, __a);
18694 #else
18695 return __builtin_altivec_vinshvlx(__b, __c, __a);
18696 #endif
18699 static __inline__ vector unsigned int __ATTRS_o_ai
18700 vec_insertl(vector unsigned int __a, vector unsigned int __b,
18701 unsigned int __c) {
18702 #ifdef __LITTLE_ENDIAN__
18703 return __builtin_altivec_vinswvrx(__b, __c, __a);
18704 #else
18705 return __builtin_altivec_vinswvlx(__b, __c, __a);
18706 #endif
18709 /* vec_inserth */
18711 static __inline__ vector unsigned char __ATTRS_o_ai
18712 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18713 #ifdef __LITTLE_ENDIAN__
18714 return __builtin_altivec_vinsblx(__b, __c, __a);
18715 #else
18716 return __builtin_altivec_vinsbrx(__b, __c, __a);
18717 #endif
18720 static __inline__ vector unsigned short __ATTRS_o_ai
18721 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18722 #ifdef __LITTLE_ENDIAN__
18723 return __builtin_altivec_vinshlx(__b, __c, __a);
18724 #else
18725 return __builtin_altivec_vinshrx(__b, __c, __a);
18726 #endif
18729 static __inline__ vector unsigned int __ATTRS_o_ai
18730 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18731 #ifdef __LITTLE_ENDIAN__
18732 return __builtin_altivec_vinswlx(__b, __c, __a);
18733 #else
18734 return __builtin_altivec_vinswrx(__b, __c, __a);
18735 #endif
18738 static __inline__ vector unsigned long long __ATTRS_o_ai
18739 vec_inserth(unsigned long long __a, vector unsigned long long __b,
18740 unsigned int __c) {
18741 #ifdef __LITTLE_ENDIAN__
18742 return __builtin_altivec_vinsdlx(__b, __c, __a);
18743 #else
18744 return __builtin_altivec_vinsdrx(__b, __c, __a);
18745 #endif
18748 static __inline__ vector unsigned char __ATTRS_o_ai
18749 vec_inserth(vector unsigned char __a, vector unsigned char __b,
18750 unsigned int __c) {
18751 #ifdef __LITTLE_ENDIAN__
18752 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18753 #else
18754 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18755 #endif
18758 static __inline__ vector unsigned short __ATTRS_o_ai
18759 vec_inserth(vector unsigned short __a, vector unsigned short __b,
18760 unsigned int __c) {
18761 #ifdef __LITTLE_ENDIAN__
18762 return __builtin_altivec_vinshvlx(__b, __c, __a);
18763 #else
18764 return __builtin_altivec_vinshvrx(__b, __c, __a);
18765 #endif
18768 static __inline__ vector unsigned int __ATTRS_o_ai
18769 vec_inserth(vector unsigned int __a, vector unsigned int __b,
18770 unsigned int __c) {
18771 #ifdef __LITTLE_ENDIAN__
18772 return __builtin_altivec_vinswvlx(__b, __c, __a);
18773 #else
18774 return __builtin_altivec_vinswvrx(__b, __c, __a);
18775 #endif
18778 /* vec_extractl */
18780 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18781 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18782 #ifdef __LITTLE_ENDIAN__
18783 return __builtin_altivec_vextdubvrx(__a, __b, __c);
18784 #else
18785 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c);
18786 return vec_sld(__ret, __ret, 8);
18787 #endif
18790 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18791 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18792 #ifdef __LITTLE_ENDIAN__
18793 return __builtin_altivec_vextduhvrx(__a, __b, __c);
18794 #else
18795 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c);
18796 return vec_sld(__ret, __ret, 8);
18797 #endif
18800 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18801 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18802 #ifdef __LITTLE_ENDIAN__
18803 return __builtin_altivec_vextduwvrx(__a, __b, __c);
18804 #else
18805 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c);
18806 return vec_sld(__ret, __ret, 8);
18807 #endif
18810 static __inline__ vector unsigned long long __ATTRS_o_ai
18811 vec_extractl(vector unsigned long long __a, vector unsigned long long __b,
18812 unsigned int __c) {
18813 #ifdef __LITTLE_ENDIAN__
18814 return __builtin_altivec_vextddvrx(__a, __b, __c);
18815 #else
18816 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c);
18817 return vec_sld(__ret, __ret, 8);
18818 #endif
18821 /* vec_extracth */
18823 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18824 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18825 #ifdef __LITTLE_ENDIAN__
18826 return __builtin_altivec_vextdubvlx(__a, __b, __c);
18827 #else
18828 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c);
18829 return vec_sld(__ret, __ret, 8);
18830 #endif
18833 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18834 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18835 #ifdef __LITTLE_ENDIAN__
18836 return __builtin_altivec_vextduhvlx(__a, __b, __c);
18837 #else
18838 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c);
18839 return vec_sld(__ret, __ret, 8);
18840 #endif
18843 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18844 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18845 #ifdef __LITTLE_ENDIAN__
18846 return __builtin_altivec_vextduwvlx(__a, __b, __c);
18847 #else
18848 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c);
18849 return vec_sld(__ret, __ret, 8);
18850 #endif
18853 static __inline__ vector unsigned long long __ATTRS_o_ai
18854 vec_extracth(vector unsigned long long __a, vector unsigned long long __b,
18855 unsigned int __c) {
18856 #ifdef __LITTLE_ENDIAN__
18857 return __builtin_altivec_vextddvlx(__a, __b, __c);
18858 #else
18859 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c);
18860 return vec_sld(__ret, __ret, 8);
18861 #endif
18864 #ifdef __VSX__
18866 /* vec_permx */
18867 #define vec_permx(__a, __b, __c, __d) \
18868 _Generic( \
18869 (__a), vector unsigned char \
18870 : (vector unsigned char)__builtin_vsx_xxpermx( \
18871 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18872 vector signed char \
18873 : (vector signed char)__builtin_vsx_xxpermx( \
18874 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18875 vector unsigned short \
18876 : (vector unsigned short)__builtin_vsx_xxpermx( \
18877 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18878 vector signed short \
18879 : (vector signed short)__builtin_vsx_xxpermx( \
18880 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18881 vector unsigned int \
18882 : (vector unsigned int)__builtin_vsx_xxpermx( \
18883 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18884 vector signed int \
18885 : (vector signed int)__builtin_vsx_xxpermx( \
18886 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18887 vector unsigned long long \
18888 : (vector unsigned long long)__builtin_vsx_xxpermx( \
18889 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18890 vector signed long long \
18891 : (vector signed long long)__builtin_vsx_xxpermx( \
18892 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18893 vector float \
18894 : (vector float)__builtin_vsx_xxpermx( \
18895 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18896 vector double \
18897 : (vector double)__builtin_vsx_xxpermx( \
18898 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d))
18900 /* vec_blendv */
18902 static __inline__ vector signed char __ATTRS_o_ai
18903 vec_blendv(vector signed char __a, vector signed char __b,
18904 vector unsigned char __c) {
18905 return (vector signed char)__builtin_vsx_xxblendvb(
18906 (vector unsigned char)__a, (vector unsigned char)__b, __c);
18909 static __inline__ vector unsigned char __ATTRS_o_ai
18910 vec_blendv(vector unsigned char __a, vector unsigned char __b,
18911 vector unsigned char __c) {
18912 return __builtin_vsx_xxblendvb(__a, __b, __c);
18915 static __inline__ vector signed short __ATTRS_o_ai
18916 vec_blendv(vector signed short __a, vector signed short __b,
18917 vector unsigned short __c) {
18918 return (vector signed short)__builtin_vsx_xxblendvh(
18919 (vector unsigned short)__a, (vector unsigned short)__b, __c);
18922 static __inline__ vector unsigned short __ATTRS_o_ai
18923 vec_blendv(vector unsigned short __a, vector unsigned short __b,
18924 vector unsigned short __c) {
18925 return __builtin_vsx_xxblendvh(__a, __b, __c);
18928 static __inline__ vector signed int __ATTRS_o_ai
18929 vec_blendv(vector signed int __a, vector signed int __b,
18930 vector unsigned int __c) {
18931 return (vector signed int)__builtin_vsx_xxblendvw(
18932 (vector unsigned int)__a, (vector unsigned int)__b, __c);
18935 static __inline__ vector unsigned int __ATTRS_o_ai
18936 vec_blendv(vector unsigned int __a, vector unsigned int __b,
18937 vector unsigned int __c) {
18938 return __builtin_vsx_xxblendvw(__a, __b, __c);
18941 static __inline__ vector signed long long __ATTRS_o_ai
18942 vec_blendv(vector signed long long __a, vector signed long long __b,
18943 vector unsigned long long __c) {
18944 return (vector signed long long)__builtin_vsx_xxblendvd(
18945 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18948 static __inline__ vector unsigned long long __ATTRS_o_ai
18949 vec_blendv(vector unsigned long long __a, vector unsigned long long __b,
18950 vector unsigned long long __c) {
18951 return (vector unsigned long long)__builtin_vsx_xxblendvd(__a, __b, __c);
18954 static __inline__ vector float __ATTRS_o_ai
18955 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) {
18956 return (vector float)__builtin_vsx_xxblendvw((vector unsigned int)__a,
18957 (vector unsigned int)__b, __c);
18960 static __inline__ vector double __ATTRS_o_ai
18961 vec_blendv(vector double __a, vector double __b,
18962 vector unsigned long long __c) {
18963 return (vector double)__builtin_vsx_xxblendvd(
18964 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18967 #define vec_replace_unaligned(__a, __b, __c) \
18968 _Generic((__a), vector signed int \
18969 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18970 (unsigned int)__b, __c), \
18971 vector unsigned int \
18972 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18973 (unsigned int)__b, __c), \
18974 vector unsigned long long \
18975 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18976 (unsigned long long)__b, __c), \
18977 vector signed long long \
18978 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18979 (unsigned long long)__b, __c), \
18980 vector float \
18981 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18982 (unsigned int)__b, __c), \
18983 vector double \
18984 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18985 (unsigned long long)__b, __c))
18987 #define vec_replace_elt(__a, __b, __c) \
18988 _Generic((__a), vector signed int \
18989 : (vector signed int)__builtin_altivec_vinsw_elt( \
18990 (vector unsigned char)__a, (unsigned int)__b, __c), \
18991 vector unsigned int \
18992 : (vector unsigned int)__builtin_altivec_vinsw_elt( \
18993 (vector unsigned char)__a, (unsigned int)__b, __c), \
18994 vector unsigned long long \
18995 : (vector unsigned long long)__builtin_altivec_vinsd_elt( \
18996 (vector unsigned char)__a, (unsigned long long)__b, __c), \
18997 vector signed long long \
18998 : (vector signed long long)__builtin_altivec_vinsd_elt( \
18999 (vector unsigned char)__a, (unsigned long long)__b, __c), \
19000 vector float \
19001 : (vector float)__builtin_altivec_vinsw_elt( \
19002 (vector unsigned char)__a, (unsigned int)__b, __c), \
19003 vector double \
19004 : (vector double)__builtin_altivec_vinsd_elt( \
19005 (vector unsigned char)__a, (unsigned long long)__b, __c))
19007 /* vec_splati */
19009 #define vec_splati(__a) \
19010 _Generic((__a), signed int \
19011 : ((vector signed int)__a), unsigned int \
19012 : ((vector unsigned int)__a), float \
19013 : ((vector float)__a))
19015 /* vec_spatid */
19017 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) {
19018 return ((vector double)((double)__a));
19021 /* vec_splati_ins */
19023 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins(
19024 vector signed int __a, const unsigned int __b, const signed int __c) {
19025 const unsigned int __d = __b & 0x01;
19026 #ifdef __LITTLE_ENDIAN__
19027 __a[1 - __d] = __c;
19028 __a[3 - __d] = __c;
19029 #else
19030 __a[__d] = __c;
19031 __a[2 + __d] = __c;
19032 #endif
19033 return __a;
19036 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins(
19037 vector unsigned int __a, const unsigned int __b, const unsigned int __c) {
19038 const unsigned int __d = __b & 0x01;
19039 #ifdef __LITTLE_ENDIAN__
19040 __a[1 - __d] = __c;
19041 __a[3 - __d] = __c;
19042 #else
19043 __a[__d] = __c;
19044 __a[2 + __d] = __c;
19045 #endif
19046 return __a;
19049 static __inline__ vector float __ATTRS_o_ai
19050 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) {
19051 const unsigned int __d = __b & 0x01;
19052 #ifdef __LITTLE_ENDIAN__
19053 __a[1 - __d] = __c;
19054 __a[3 - __d] = __c;
19055 #else
19056 __a[__d] = __c;
19057 __a[2 + __d] = __c;
19058 #endif
19059 return __a;
19062 /* vec_test_lsbb_all_ones */
19064 static __inline__ int __ATTRS_o_ai
19065 vec_test_lsbb_all_ones(vector unsigned char __a) {
19066 return __builtin_vsx_xvtlsbb(__a, 1);
19069 /* vec_test_lsbb_all_zeros */
19071 static __inline__ int __ATTRS_o_ai
19072 vec_test_lsbb_all_zeros(vector unsigned char __a) {
19073 return __builtin_vsx_xvtlsbb(__a, 0);
19075 #endif /* __VSX__ */
19077 /* vec_stril */
19079 static __inline__ vector unsigned char __ATTRS_o_ai
19080 vec_stril(vector unsigned char __a) {
19081 #ifdef __LITTLE_ENDIAN__
19082 return (vector unsigned char)__builtin_altivec_vstribr(
19083 (vector unsigned char)__a);
19084 #else
19085 return (vector unsigned char)__builtin_altivec_vstribl(
19086 (vector unsigned char)__a);
19087 #endif
19090 static __inline__ vector signed char __ATTRS_o_ai
19091 vec_stril(vector signed char __a) {
19092 #ifdef __LITTLE_ENDIAN__
19093 return (vector signed char)__builtin_altivec_vstribr(
19094 (vector unsigned char)__a);
19095 #else
19096 return (vector signed char)__builtin_altivec_vstribl(
19097 (vector unsigned char)__a);
19098 #endif
19101 static __inline__ vector unsigned short __ATTRS_o_ai
19102 vec_stril(vector unsigned short __a) {
19103 #ifdef __LITTLE_ENDIAN__
19104 return (vector unsigned short)__builtin_altivec_vstrihr(
19105 (vector signed short)__a);
19106 #else
19107 return (vector unsigned short)__builtin_altivec_vstrihl(
19108 (vector signed short)__a);
19109 #endif
19112 static __inline__ vector signed short __ATTRS_o_ai
19113 vec_stril(vector signed short __a) {
19114 #ifdef __LITTLE_ENDIAN__
19115 return __builtin_altivec_vstrihr(__a);
19116 #else
19117 return __builtin_altivec_vstrihl(__a);
19118 #endif
19121 /* vec_stril_p */
19123 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) {
19124 #ifdef __LITTLE_ENDIAN__
19125 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19126 #else
19127 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19128 #endif
19131 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) {
19132 #ifdef __LITTLE_ENDIAN__
19133 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19134 #else
19135 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19136 #endif
19139 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) {
19140 #ifdef __LITTLE_ENDIAN__
19141 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19142 #else
19143 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19144 #endif
19147 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) {
19148 #ifdef __LITTLE_ENDIAN__
19149 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19150 #else
19151 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19152 #endif
19155 /* vec_strir */
19157 static __inline__ vector unsigned char __ATTRS_o_ai
19158 vec_strir(vector unsigned char __a) {
19159 #ifdef __LITTLE_ENDIAN__
19160 return (vector unsigned char)__builtin_altivec_vstribl(
19161 (vector unsigned char)__a);
19162 #else
19163 return (vector unsigned char)__builtin_altivec_vstribr(
19164 (vector unsigned char)__a);
19165 #endif
19168 static __inline__ vector signed char __ATTRS_o_ai
19169 vec_strir(vector signed char __a) {
19170 #ifdef __LITTLE_ENDIAN__
19171 return (vector signed char)__builtin_altivec_vstribl(
19172 (vector unsigned char)__a);
19173 #else
19174 return (vector signed char)__builtin_altivec_vstribr(
19175 (vector unsigned char)__a);
19176 #endif
19179 static __inline__ vector unsigned short __ATTRS_o_ai
19180 vec_strir(vector unsigned short __a) {
19181 #ifdef __LITTLE_ENDIAN__
19182 return (vector unsigned short)__builtin_altivec_vstrihl(
19183 (vector signed short)__a);
19184 #else
19185 return (vector unsigned short)__builtin_altivec_vstrihr(
19186 (vector signed short)__a);
19187 #endif
19190 static __inline__ vector signed short __ATTRS_o_ai
19191 vec_strir(vector signed short __a) {
19192 #ifdef __LITTLE_ENDIAN__
19193 return __builtin_altivec_vstrihl(__a);
19194 #else
19195 return __builtin_altivec_vstrihr(__a);
19196 #endif
19199 /* vec_strir_p */
19201 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) {
19202 #ifdef __LITTLE_ENDIAN__
19203 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19204 #else
19205 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19206 #endif
19209 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) {
19210 #ifdef __LITTLE_ENDIAN__
19211 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19212 #else
19213 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19214 #endif
19217 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) {
19218 #ifdef __LITTLE_ENDIAN__
19219 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19220 #else
19221 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19222 #endif
19225 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) {
19226 #ifdef __LITTLE_ENDIAN__
19227 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19228 #else
19229 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19230 #endif
19233 /* vs[l | r | ra] */
19235 #ifdef __SIZEOF_INT128__
19236 static __inline__ vector unsigned __int128 __ATTRS_o_ai
19237 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19238 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19239 __CHAR_BIT__));
19242 static __inline__ vector signed __int128 __ATTRS_o_ai
19243 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) {
19244 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19245 __CHAR_BIT__));
19248 static __inline__ vector unsigned __int128 __ATTRS_o_ai
19249 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19250 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19251 __CHAR_BIT__));
19254 static __inline__ vector signed __int128 __ATTRS_o_ai
19255 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) {
19256 return (
19257 vector signed __int128)(((vector unsigned __int128)__a) >>
19258 (__b %
19259 (vector unsigned __int128)(sizeof(
19260 unsigned __int128) *
19261 __CHAR_BIT__)));
19264 static __inline__ vector unsigned __int128 __ATTRS_o_ai
19265 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19266 return (
19267 vector unsigned __int128)(((vector signed __int128)__a) >>
19268 (__b %
19269 (vector unsigned __int128)(sizeof(
19270 unsigned __int128) *
19271 __CHAR_BIT__)));
19274 static __inline__ vector signed __int128 __ATTRS_o_ai
19275 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) {
19276 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19277 __CHAR_BIT__));
19280 #endif /* __SIZEOF_INT128__ */
19281 #endif /* __POWER10_VECTOR__ */
19283 #ifdef __POWER8_VECTOR__
19284 #define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps))
19285 #define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps))
19287 static __inline__ long __bcdadd_ofl(vector unsigned char __a,
19288 vector unsigned char __b) {
19289 return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b);
19292 static __inline__ long __bcdsub_ofl(vector unsigned char __a,
19293 vector unsigned char __b) {
19294 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b);
19297 static __inline__ long __bcd_invalid(vector unsigned char __a) {
19298 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a);
19301 static __inline__ long __bcdcmpeq(vector unsigned char __a,
19302 vector unsigned char __b) {
19303 return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b);
19306 static __inline__ long __bcdcmplt(vector unsigned char __a,
19307 vector unsigned char __b) {
19308 return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b);
19311 static __inline__ long __bcdcmpgt(vector unsigned char __a,
19312 vector unsigned char __b) {
19313 return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b);
19316 static __inline__ long __bcdcmple(vector unsigned char __a,
19317 vector unsigned char __b) {
19318 return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b);
19321 static __inline__ long __bcdcmpge(vector unsigned char __a,
19322 vector unsigned char __b) {
19323 return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b);
19326 #endif // __POWER8_VECTOR__
19328 #undef __ATTRS_o_ai
19330 #endif /* __ALTIVEC_H */