13 #error "AltiVec support not enabled"
19 #define __CR6_EQ_REV 1
21 #define __CR6_LT_REV 3
23 #define __CR6_GT_REV 5
25 #define __CR6_SO_REV 7
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__))
51 vector
signed char __a, vector
signed char __b, vector
unsigned char __c);
55 vector
unsigned char __c);
61 vector
signed short __b,
62 vector
unsigned char __c);
66 vector
unsigned char __c);
69 vector
bool short __a, vector
bool short __b, vector
unsigned char __c);
73 vector
unsigned char __c);
76 vector
signed int __b,
77 vector
unsigned char __c);
80 vector
unsigned int __a, vector
unsigned int __b, vector
unsigned char __c);
87 vector
unsigned char __c);
92 vector
unsigned char __c);
95 vec_perm(vector
unsigned long long __a, vector
unsigned long long __b,
96 vector
unsigned char __c);
100 vector
unsigned char __c);
104 vector
unsigned char __c);
112 #define __builtin_altivec_abs_v16qi vec_abs
113 #define __builtin_altivec_abs_v8hi vec_abs
114 #define __builtin_altivec_abs_v4si vec_abs
118 return __builtin_altivec_vmaxsb(
__a, -
__a);
123 return __builtin_altivec_vmaxsh(
__a, -
__a);
128 return __builtin_altivec_vmaxsw(
__a, -
__a);
131 #ifdef __POWER8_VECTOR__
134 return __builtin_altivec_vmaxsd(
__a, -
__a);
140 return __builtin_vsx_xvabssp(
__a);
142 vector
unsigned int __res =
143 (vector
unsigned int)
__a & (vector
unsigned int)(0x7FFFFFFF);
144 return (vector
float)__res;
150 return __builtin_vsx_xvabsdp(
__a);
155 #define __builtin_altivec_abss_v16qi vec_abss
156 #define __builtin_altivec_abss_v8hi vec_abss
157 #define __builtin_altivec_abss_v4si vec_abss
161 return __builtin_altivec_vmaxsb(
162 __a, __builtin_altivec_vsubsbs((vector
signed char)(0),
__a));
167 return __builtin_altivec_vmaxsh(
168 __a, __builtin_altivec_vsubshs((vector
signed short)(0),
__a));
173 return __builtin_altivec_vmaxsw(
174 __a, __builtin_altivec_vsubsws((vector
signed int)(0),
__a));
178 #if defined(__POWER9_VECTOR__)
181 vec_absd(vector
unsigned char __a, vector
unsigned char __b) {
182 return __builtin_altivec_vabsdub(
__a,
__b);
186 vec_absd(vector
unsigned short __a, vector
unsigned short __b) {
187 return __builtin_altivec_vabsduh(
__a,
__b);
191 vec_absd(vector
unsigned int __a, vector
unsigned int __b) {
192 return __builtin_altivec_vabsduw(
__a,
__b);
206 return (vector
signed char)
__a +
__b;
211 return __a + (vector
signed char)
__b;
221 return (vector
unsigned char)
__a +
__b;
226 return __a + (vector
unsigned char)
__b;
236 return (vector
short)
__a +
__b;
240 vector
bool short __b) {
241 return __a + (vector short)
__b;
251 return (vector
unsigned short)
__a +
__b;
256 return __a + (vector
unsigned short)
__b;
266 return (vector
int)
__a +
__b;
270 vector
bool int __b) {
281 return (vector
unsigned int)
__a +
__b;
289 #ifdef __POWER8_VECTOR__
291 vec_add(vector
signed long long __a, vector
signed long long __b) {
295 static __inline__ vector
unsigned long long __ATTRS_o_ai
296 vec_add(vector
unsigned long long __a, vector
unsigned long long __b) {
300 #ifdef __SIZEOF_INT128__
302 vec_add(vector
signed __int128
__a, vector
signed __int128
__b) {
307 vec_add(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
312 static __inline__ vector
unsigned char __attribute__((__always_inline__))
313 vec_add_u128(vector
unsigned char __a, vector
unsigned char __b) {
314 return __builtin_altivec_vadduqm(
__a,
__b);
316 #elif defined(__VSX__)
318 vec_add(vector
signed long long __a, vector
signed long long __b) {
319 #ifdef __LITTLE_ENDIAN__
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 = __builtin_shufflevector((vector
unsigned char)__carry,
329 (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);
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__
356 #ifdef __POWER8_VECTOR__
357 #ifdef __SIZEOF_INT128__
360 vector
signed __int128
__c) {
361 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
365 vec_adde(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
366 vector
unsigned __int128
__c) {
367 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
371 static __inline__ vector
unsigned char __attribute__((__always_inline__))
372 vec_adde_u128(vector
unsigned char __a, vector
unsigned char __b,
373 vector
unsigned char __c) {
374 return (vector
unsigned char)__builtin_altivec_vaddeuqm(
__a,
__b,
__c);
380 vector
signed int __c) {
381 vector
signed int __mask = {1, 1, 1, 1};
382 vector
signed int __carry =
__c & __mask;
388 vector
unsigned int __c) {
389 vector
unsigned int __mask = {1, 1, 1, 1};
390 vector
unsigned int __carry =
__c & __mask;
396 #ifdef __POWER8_VECTOR__
397 #ifdef __SIZEOF_INT128__
399 vec_addec(vector
signed __int128
__a, vector
signed __int128
__b,
400 vector
signed __int128
__c) {
401 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
405 vec_addec(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
406 vector
unsigned __int128
__c) {
407 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
411 static __inline__ vector
unsigned char __attribute__((__always_inline__))
412 vec_addec_u128(vector
unsigned char __a, vector
unsigned char __b,
413 vector
unsigned char __c) {
414 return (vector
unsigned char)__builtin_altivec_vaddecuq(
__a,
__b,
__c);
419 vec_addec(vector
signed int __a, vector
signed int __b,
420 vector
signed int __c) {
422 signed int __result[4];
423 for (
int i = 0; i < 4; i++) {
424 unsigned int __tempa = (
unsigned int)
__a[i];
425 unsigned int __tempb = (
unsigned int)
__b[i];
426 unsigned int __tempc = (
unsigned int)
__c[i];
427 __tempc = __tempc & 0x00000001;
428 unsigned long long __longa = (
unsigned long long) __tempa;
429 unsigned long long __longb = (
unsigned long long) __tempb;
430 unsigned long long __longc = (
unsigned long long) __tempc;
431 unsigned long long __sum = __longa + __longb + __longc;
432 unsigned long long __res = (__sum >> 32) & 0x01;
433 unsigned long long __tempres = (
unsigned int) __res;
434 __result[i] = (
signed int) __tempres;
437 vector
signed int ret = { __result[0], __result[1], __result[2], __result[3] };
442 vec_addec(vector
unsigned int __a, vector
unsigned int __b,
443 vector
unsigned int __c) {
445 unsigned int __result[4];
446 for (
int i = 0; i < 4; i++) {
447 unsigned int __tempc =
__c[i] & 1;
448 unsigned long long __longa = (
unsigned long long)
__a[i];
449 unsigned long long __longb = (
unsigned long long)
__b[i];
450 unsigned long long __longc = (
unsigned long long) __tempc;
451 unsigned long long __sum = __longa + __longb + __longc;
452 unsigned long long __res = (__sum >> 32) & 0x01;
453 unsigned long long __tempres = (
unsigned int) __res;
454 __result[i] = (
signed int) __tempres;
457 vector
unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
460 #endif // __powerpc64__
461 #endif // __POWER8_VECTOR__
465 #define __builtin_altivec_vaddubm vec_vaddubm
474 return (vector
signed char)
__a +
__b;
479 return __a + (vector
signed char)
__b;
489 return (vector
unsigned char)
__a +
__b;
494 return __a + (vector
unsigned char)
__b;
499 #define __builtin_altivec_vadduhm vec_vadduhm
508 return (vector
short)
__a +
__b;
512 vector
bool short __b) {
513 return __a + (vector short)
__b;
523 return (vector
unsigned short)
__a +
__b;
528 return __a + (vector
unsigned short)
__b;
533 #define __builtin_altivec_vadduwm vec_vadduwm
542 return (vector
int)
__a +
__b;
546 vector
bool int __b) {
557 return (vector
unsigned int)
__a +
__b;
567 #define __builtin_altivec_vaddfp vec_vaddfp
569 static __inline__ vector
float __attribute__((__always_inline__))
570 vec_vaddfp(vector
float __a, vector
float __b) {
578 return (vector
signed int)__builtin_altivec_vaddcuw((vector
unsigned int)
__a,
579 (vector
unsigned int)
__b);
584 return __builtin_altivec_vaddcuw(
__a,
__b);
587 #ifdef __POWER8_VECTOR__
588 #ifdef __SIZEOF_INT128__
590 vec_addc(vector
signed __int128
__a, vector
signed __int128
__b) {
591 return (vector
signed __int128)__builtin_altivec_vaddcuq(
592 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
596 vec_addc(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
597 return __builtin_altivec_vaddcuq(
__a,
__b);
601 static __inline__ vector
unsigned char __attribute__((__always_inline__))
602 vec_addc_u128(vector
unsigned char __a, vector
unsigned char __b) {
603 return (vector
unsigned char)__builtin_altivec_vaddcuq(
__a,
__b);
605 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
609 static __inline__ vector
unsigned int __attribute__((__always_inline__))
610 vec_vaddcuw(vector
unsigned int __a, vector
unsigned int __b) {
611 return __builtin_altivec_vaddcuw(
__a,
__b);
618 return __builtin_altivec_vaddsbs(
__a,
__b);
623 return __builtin_altivec_vaddsbs((vector
signed char)
__a,
__b);
628 return __builtin_altivec_vaddsbs(
__a, (vector
signed char)
__b);
633 return __builtin_altivec_vaddubs(
__a,
__b);
638 return __builtin_altivec_vaddubs((vector
unsigned char)
__a,
__b);
643 return __builtin_altivec_vaddubs(
__a, (vector
unsigned char)
__b);
648 return __builtin_altivec_vaddshs(
__a,
__b);
653 return __builtin_altivec_vaddshs((vector
short)
__a,
__b);
657 vector
bool short __b) {
658 return __builtin_altivec_vaddshs(
__a, (vector
short)
__b);
663 return __builtin_altivec_vadduhs(
__a,
__b);
668 return __builtin_altivec_vadduhs((vector
unsigned short)
__a,
__b);
673 return __builtin_altivec_vadduhs(
__a, (vector
unsigned short)
__b);
678 return __builtin_altivec_vaddsws(
__a,
__b);
683 return __builtin_altivec_vaddsws((vector
int)
__a,
__b);
687 vector
bool int __b) {
688 return __builtin_altivec_vaddsws(
__a, (vector
int)
__b);
693 return __builtin_altivec_vadduws(
__a,
__b);
698 return __builtin_altivec_vadduws((vector
unsigned int)
__a,
__b);
703 return __builtin_altivec_vadduws(
__a, (vector
unsigned int)
__b);
710 return __builtin_altivec_vaddsbs(
__a,
__b);
715 return __builtin_altivec_vaddsbs((vector
signed char)
__a,
__b);
720 return __builtin_altivec_vaddsbs(
__a, (vector
signed char)
__b);
727 return __builtin_altivec_vaddubs(
__a,
__b);
732 return __builtin_altivec_vaddubs((vector
unsigned char)
__a,
__b);
737 return __builtin_altivec_vaddubs(
__a, (vector
unsigned char)
__b);
744 return __builtin_altivec_vaddshs(
__a,
__b);
749 return __builtin_altivec_vaddshs((vector
short)
__a,
__b);
753 vector
bool short __b) {
754 return __builtin_altivec_vaddshs(
__a, (vector
short)
__b);
761 return __builtin_altivec_vadduhs(
__a,
__b);
766 return __builtin_altivec_vadduhs((vector
unsigned short)
__a,
__b);
771 return __builtin_altivec_vadduhs(
__a, (vector
unsigned short)
__b);
778 return __builtin_altivec_vaddsws(
__a,
__b);
783 return __builtin_altivec_vaddsws((vector
int)
__a,
__b);
787 vector
bool int __b) {
788 return __builtin_altivec_vaddsws(
__a, (vector
int)
__b);
795 return __builtin_altivec_vadduws(
__a,
__b);
800 return __builtin_altivec_vadduws((vector
unsigned int)
__a,
__b);
805 return __builtin_altivec_vadduws(
__a, (vector
unsigned int)
__b);
808 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
809 defined(__SIZEOF_INT128__)
813 vec_vadduqm(vector
signed __int128
__a, vector
signed __int128
__b) {
818 vec_vadduqm(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
825 vec_vaddeuqm(vector
signed __int128
__a, vector
signed __int128
__b,
826 vector
signed __int128
__c) {
827 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
831 vec_vaddeuqm(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
832 vector
unsigned __int128
__c) {
833 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
839 vec_vaddcuq(vector
signed __int128
__a, vector
signed __int128
__b) {
840 return __builtin_altivec_vaddcuq(
__a,
__b);
844 vec_vaddcuq(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
845 return __builtin_altivec_vaddcuq(
__a,
__b);
851 vec_vaddecuq(vector
signed __int128
__a, vector
signed __int128
__b,
852 vector
signed __int128
__c) {
853 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
857 vec_vaddecuq(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
858 vector
unsigned __int128
__c) {
859 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
861 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
865 #define __builtin_altivec_vand vec_and
874 return (vector
signed char)
__a &
__b;
879 return __a & (vector
signed char)
__b;
889 return (vector
unsigned char)
__a &
__b;
894 return __a & (vector
unsigned char)
__b;
898 vector
bool char __b) {
909 return (vector
short)
__a &
__b;
913 vector
bool short __b) {
914 return __a & (vector short)
__b;
924 return (vector
unsigned short)
__a &
__b;
929 return __a & (vector
unsigned short)
__b;
944 return (vector
int)
__a &
__b;
948 vector
bool int __b) {
959 return (vector
unsigned int)
__a &
__b;
968 vector
bool int __b) {
974 vector
unsigned int __res =
975 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
976 return (vector
float)__res;
981 vector
unsigned int __res =
982 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
983 return (vector
float)__res;
987 vector
bool int __b) {
988 vector
unsigned int __res =
989 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
990 return (vector
float)__res;
996 vector
unsigned long long __res =
997 (vector
unsigned long long)
__a & (vector
unsigned long long)
__b;
998 return (vector
double)__res;
1003 vector
unsigned long long __res =
1004 (vector
unsigned long long)
__a & (vector
unsigned long long)
__b;
1005 return (vector
double)__res;
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;
1016 vec_and(vector
signed long long __a, vector
signed long long __b) {
1021 vec_and(vector
bool long long __a, vector
signed long long __b) {
1022 return (vector
signed long long)
__a &
__b;
1026 vec_and(vector
signed long long __a, vector
bool long long __b) {
1027 return __a & (vector
signed long long)
__b;
1030 static __inline__ vector
unsigned long long __ATTRS_o_ai
1031 vec_and(vector
unsigned long long __a, vector
unsigned long long __b) {
1035 static __inline__ vector
unsigned long long __ATTRS_o_ai
1036 vec_and(vector
bool long long __a, vector
unsigned long long __b) {
1037 return (vector
unsigned long long)
__a &
__b;
1040 static __inline__ vector
unsigned long long __ATTRS_o_ai
1041 vec_and(vector
unsigned long long __a, vector
bool long long __b) {
1042 return __a & (vector
unsigned long long)
__b;
1046 vec_and(vector
bool long long __a, vector
bool long long __b) {
1060 return (vector
signed char)
__a &
__b;
1065 return __a & (vector
signed char)
__b;
1075 return (vector
unsigned char)
__a &
__b;
1080 return __a & (vector
unsigned char)
__b;
1084 vector
bool char __b) {
1095 return (vector
short)
__a &
__b;
1099 vector
bool short __b) {
1100 return __a & (vector short)
__b;
1110 return (vector
unsigned short)
__a &
__b;
1115 return __a & (vector
unsigned short)
__b;
1130 return (vector
int)
__a &
__b;
1134 vector
bool int __b) {
1145 return (vector
unsigned int)
__a &
__b;
1154 vector
bool int __b) {
1160 vector
unsigned int __res =
1161 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1162 return (vector
float)__res;
1167 vector
unsigned int __res =
1168 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1169 return (vector
float)__res;
1173 vector
bool int __b) {
1174 vector
unsigned int __res =
1175 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1176 return (vector
float)__res;
1181 vec_vand(vector
signed long long __a, vector
signed long long __b) {
1186 vec_vand(vector
bool long long __a, vector
signed long long __b) {
1187 return (vector
signed long long)
__a &
__b;
1191 vec_vand(vector
signed long long __a, vector
bool long long __b) {
1192 return __a & (vector
signed long long)
__b;
1195 static __inline__ vector
unsigned long long __ATTRS_o_ai
1196 vec_vand(vector
unsigned long long __a, vector
unsigned long long __b) {
1200 static __inline__ vector
unsigned long long __ATTRS_o_ai
1201 vec_vand(vector
bool long long __a, vector
unsigned long long __b) {
1202 return (vector
unsigned long long)
__a &
__b;
1205 static __inline__ vector
unsigned long long __ATTRS_o_ai
1206 vec_vand(vector
unsigned long long __a, vector
bool long long __b) {
1207 return __a & (vector
unsigned long long)
__b;
1218 #define __builtin_altivec_vandc vec_andc
1227 return (vector
signed char)
__a & ~
__b;
1232 return __a & ~(vector
signed char)
__b;
1242 return (vector
unsigned char)
__a & ~
__b;
1247 return __a & ~(vector
unsigned char)
__b;
1251 vector
bool char __b) {
1262 return (vector
short)
__a & ~
__b;
1266 vector
bool short __b) {
1267 return __a & ~(vector short)
__b;
1277 return (vector
unsigned short)
__a & ~
__b;
1282 return __a & ~(vector
unsigned short)
__b;
1297 return (vector
int)
__a & ~
__b;
1301 vector
bool int __b) {
1312 return (vector
unsigned int)
__a & ~
__b;
1321 vector
bool int __b) {
1327 vector
unsigned int __res =
1328 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1329 return (vector
float)__res;
1334 vector
unsigned int __res =
1335 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1336 return (vector
float)__res;
1340 vector
bool int __b) {
1341 vector
unsigned int __res =
1342 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1343 return (vector
float)__res;
1348 vector
double __b) {
1349 vector
unsigned long long __res =
1350 (vector
unsigned long long)
__a & ~(vector
unsigned long long)
__b;
1351 return (vector
double)__res;
1356 vector
unsigned long long __res =
1357 (vector
unsigned long long)
__a & ~(vector
unsigned long long)
__b;
1358 return (vector
double)__res;
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;
1369 vec_andc(vector
signed long long __a, vector
signed long long __b) {
1374 vec_andc(vector
bool long long __a, vector
signed long long __b) {
1375 return (vector
signed long long)
__a & ~
__b;
1379 vec_andc(vector
signed long long __a, vector
bool long long __b) {
1380 return __a & ~(vector
signed long long)
__b;
1383 static __inline__ vector
unsigned long long __ATTRS_o_ai
1384 vec_andc(vector
unsigned long long __a, vector
unsigned long long __b) {
1388 static __inline__ vector
unsigned long long __ATTRS_o_ai
1389 vec_andc(vector
bool long long __a, vector
unsigned long long __b) {
1390 return (vector
unsigned long long)
__a & ~
__b;
1393 static __inline__ vector
unsigned long long __ATTRS_o_ai
1394 vec_andc(vector
unsigned long long __a, vector
bool long long __b) {
1395 return __a & ~(vector
unsigned long long)
__b;
1413 return (vector
signed char)
__a & ~
__b;
1418 return __a & ~(vector
signed char)
__b;
1428 return (vector
unsigned char)
__a & ~
__b;
1433 return __a & ~(vector
unsigned char)
__b;
1448 return (vector
short)
__a & ~
__b;
1452 vector
bool short __b) {
1453 return __a & ~(vector short)
__b;
1463 return (vector
unsigned short)
__a & ~
__b;
1468 return __a & ~(vector
unsigned short)
__b;
1483 return (vector
int)
__a & ~
__b;
1487 vector
bool int __b) {
1498 return (vector
unsigned int)
__a & ~
__b;
1507 vector
bool int __b) {
1513 vector
unsigned int __res =
1514 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1515 return (vector
float)__res;
1520 vector
unsigned int __res =
1521 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1522 return (vector
float)__res;
1526 vector
bool int __b) {
1527 vector
unsigned int __res =
1528 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1529 return (vector
float)__res;
1540 return (vector
signed long long)
__a & ~
__b;
1545 return __a & ~(vector
signed long long)
__b;
1548 static __inline__ vector
unsigned long long __ATTRS_o_ai
1549 vec_vandc(vector
unsigned long long __a, vector
unsigned long long __b) {
1553 static __inline__ vector
unsigned long long __ATTRS_o_ai
1555 return (vector
unsigned long long)
__a & ~
__b;
1558 static __inline__ vector
unsigned long long __ATTRS_o_ai
1560 return __a & ~(vector
unsigned long long)
__b;
1573 return __builtin_altivec_vavgsb(
__a,
__b);
1578 return __builtin_altivec_vavgub(
__a,
__b);
1583 return __builtin_altivec_vavgsh(
__a,
__b);
1588 return __builtin_altivec_vavguh(
__a,
__b);
1593 return __builtin_altivec_vavgsw(
__a,
__b);
1598 return __builtin_altivec_vavguw(
__a,
__b);
1603 static __inline__ vector
signed char __attribute__((__always_inline__))
1604 vec_vavgsb(vector
signed char __a, vector
signed char __b) {
1605 return __builtin_altivec_vavgsb(
__a,
__b);
1610 static __inline__ vector
unsigned char __attribute__((__always_inline__))
1611 vec_vavgub(vector
unsigned char __a, vector
unsigned char __b) {
1612 return __builtin_altivec_vavgub(
__a,
__b);
1617 static __inline__ vector
short __attribute__((__always_inline__))
1618 vec_vavgsh(vector
short __a, vector
short __b) {
1619 return __builtin_altivec_vavgsh(
__a,
__b);
1624 static __inline__ vector
unsigned short __attribute__((__always_inline__))
1625 vec_vavguh(vector
unsigned short __a, vector
unsigned short __b) {
1626 return __builtin_altivec_vavguh(
__a,
__b);
1631 static __inline__ vector
int __attribute__((__always_inline__))
1632 vec_vavgsw(vector
int __a, vector
int __b) {
1633 return __builtin_altivec_vavgsw(
__a,
__b);
1638 static __inline__ vector
unsigned int __attribute__((__always_inline__))
1639 vec_vavguw(vector
unsigned int __a, vector
unsigned int __b) {
1640 return __builtin_altivec_vavguw(
__a,
__b);
1647 return __builtin_vsx_xvrspip(
__a);
1649 return __builtin_altivec_vrfip(
__a);
1655 return __builtin_vsx_xvrdpip(
__a);
1673 vec_vrfip(vector
float __a) {
1674 return __builtin_altivec_vrfip(
__a);
1679 static __inline__ vector
int __attribute__((__always_inline__))
1680 vec_cmpb(vector
float __a, vector
float __b) {
1681 return __builtin_altivec_vcmpbfp(
__a,
__b);
1686 static __inline__ vector
int __attribute__((__always_inline__))
1687 vec_vcmpbfp(vector
float __a, vector
float __b) {
1688 return __builtin_altivec_vcmpbfp(
__a,
__b);
1695 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1701 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1707 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1713 return (vector
bool short)__builtin_altivec_vcmpequh(
__a,
__b);
1718 return (vector
bool short)__builtin_altivec_vcmpequh((vector
short)
__a,
1724 return (vector
bool short)__builtin_altivec_vcmpequh((vector
short)
__a,
1730 return (vector
bool int)__builtin_altivec_vcmpequw(
__a,
__b);
1735 return (vector
bool int)__builtin_altivec_vcmpequw((vector
int)
__a,
1740 vector
bool int __b) {
1741 return (vector
bool int)__builtin_altivec_vcmpequw((vector
int)
__a,
1745 #ifdef __POWER8_VECTOR__
1748 return (vector
bool long long)__builtin_altivec_vcmpequd(
__a,
__b);
1752 vec_cmpeq(vector
unsigned long long __a, vector
unsigned long long __b) {
1753 return (vector
bool long long)__builtin_altivec_vcmpequd(
1754 (vector
long long)
__a, (vector
long long)
__b);
1759 return (vector
bool long long)__builtin_altivec_vcmpequd(
1760 (vector
long long)
__a, (vector
long long)
__b);
1762 #elif defined(__VSX__)
1765 vector
bool int __wordcmp =
1767 #ifdef __LITTLE_ENDIAN__
1768 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2);
1769 return (vector
bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1,
1772 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0);
1773 return (vector
bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0,
1779 vec_cmpeq(vector
unsigned long long __a, vector
unsigned long long __b) {
1780 return vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b);
1785 return vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b);
1792 return (vector
bool int)__builtin_vsx_xvcmpeqsp(
__a,
__b);
1794 return (vector
bool int)__builtin_altivec_vcmpeqfp(
__a,
__b);
1801 return (vector
bool long long)__builtin_vsx_xvcmpeqdp(
__a,
__b);
1805 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1808 return (vector
bool __int128)__builtin_altivec_vcmpequq(
1809 (vector
bool __int128)
__a, (vector
bool __int128)
__b);
1813 vec_cmpeq(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
1814 return (vector
bool __int128)__builtin_altivec_vcmpequq(
1815 (vector
bool __int128)
__a, (vector
bool __int128)
__b);
1820 return (vector
bool __int128)__builtin_altivec_vcmpequq(
__a,
__b);
1824 #ifdef __POWER9_VECTOR__
1829 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1835 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1841 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1847 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1853 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1859 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1865 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1871 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1877 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1883 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1887 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1889 vec_cmpne(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
1890 return (vector
bool __int128) ~(__builtin_altivec_vcmpequq(
1891 (vector
bool __int128)
__a, (vector
bool __int128)
__b));
1896 return (vector
bool __int128) ~(__builtin_altivec_vcmpequq(
1897 (vector
bool __int128)
__a, (vector
bool __int128)
__b));
1902 return (vector
bool __int128) ~(__builtin_altivec_vcmpequq(
__a,
__b));
1909 vec_cmpnez(vector
signed char __a, vector
signed char __b) {
1910 return (vector
bool char)__builtin_altivec_vcmpnezb((vector
char)
__a,
1915 vec_cmpnez(vector
unsigned char __a, vector
unsigned char __b) {
1916 return (vector
bool char)__builtin_altivec_vcmpnezb((vector
char)
__a,
1921 vec_cmpnez(vector
signed short __a, vector
signed short __b) {
1922 return (vector
bool short)__builtin_altivec_vcmpnezh((vector
short)
__a,
1927 vec_cmpnez(vector
unsigned short __a, vector
unsigned short __b) {
1928 return (vector
bool short)__builtin_altivec_vcmpnezh((vector
short)
__a,
1933 vec_cmpnez(vector
signed int __a, vector
signed int __b) {
1934 return (vector
bool int)__builtin_altivec_vcmpnezw((vector
int)
__a,
1939 vec_cmpnez(vector
unsigned int __a, vector
unsigned int __b) {
1940 return (vector
bool int)__builtin_altivec_vcmpnezw((vector
int)
__a,
1945 vec_cntlz_lsbb(vector
signed char __a) {
1946 #ifdef __LITTLE_ENDIAN__
1947 return __builtin_altivec_vctzlsbb(
__a);
1949 return __builtin_altivec_vclzlsbb(
__a);
1954 vec_cntlz_lsbb(vector
unsigned char __a) {
1955 #ifdef __LITTLE_ENDIAN__
1956 return __builtin_altivec_vctzlsbb(
__a);
1958 return __builtin_altivec_vclzlsbb(
__a);
1963 vec_cnttz_lsbb(vector
signed char __a) {
1964 #ifdef __LITTLE_ENDIAN__
1965 return __builtin_altivec_vclzlsbb(
__a);
1967 return __builtin_altivec_vctzlsbb(
__a);
1972 vec_cnttz_lsbb(vector
unsigned char __a) {
1973 #ifdef __LITTLE_ENDIAN__
1974 return __builtin_altivec_vclzlsbb(
__a);
1976 return __builtin_altivec_vctzlsbb(
__a);
1981 vec_parity_lsbb(vector
unsigned int __a) {
1982 return __builtin_altivec_vprtybw(
__a);
1986 vec_parity_lsbb(vector
signed int __a) {
1987 return __builtin_altivec_vprtybw(
__a);
1990 #ifdef __SIZEOF_INT128__
1991 static __inline__ vector
unsigned __int128
__ATTRS_o_ai
1992 vec_parity_lsbb(vector
unsigned __int128
__a) {
1993 return __builtin_altivec_vprtybq(
__a);
1996 static __inline__ vector
unsigned __int128
__ATTRS_o_ai
1997 vec_parity_lsbb(vector
signed __int128
__a) {
1998 return __builtin_altivec_vprtybq(
__a);
2002 static __inline__ vector
unsigned long long __ATTRS_o_ai
2003 vec_parity_lsbb(vector
unsigned long long __a) {
2004 return __builtin_altivec_vprtybd(
__a);
2007 static __inline__ vector
unsigned long long __ATTRS_o_ai
2008 vec_parity_lsbb(vector
signed long long __a) {
2009 return __builtin_altivec_vprtybd(
__a);
2066 #ifdef __POWER8_VECTOR__
2069 return (vector
bool long long)
2070 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2075 return (vector
bool long long)
2076 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2080 vec_cmpne(vector
unsigned long long __a, vector
unsigned long long __b) {
2081 return (vector
bool long long)
2082 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2084 #elif defined(__VSX__)
2087 return (vector
bool long long)~(
2088 vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b));
2093 return (vector
bool long long)~(
2094 vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b));
2098 vec_cmpne(vector
unsigned long long __a, vector
unsigned long long __b) {
2099 return (vector
bool long long)~(
2100 vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b));
2107 return (vector
bool long long)
2108 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2116 return (vector
bool char)__builtin_altivec_vcmpgtsb(
__a,
__b);
2121 return (vector
bool char)__builtin_altivec_vcmpgtub(
__a,
__b);
2126 return (vector
bool short)__builtin_altivec_vcmpgtsh(
__a,
__b);
2131 return (vector
bool short)__builtin_altivec_vcmpgtuh(
__a,
__b);
2136 return (vector
bool int)__builtin_altivec_vcmpgtsw(
__a,
__b);
2141 return (vector
bool int)__builtin_altivec_vcmpgtuw(
__a,
__b);
2144 #ifdef __POWER8_VECTOR__
2147 return (vector
bool long long)__builtin_altivec_vcmpgtsd(
__a,
__b);
2151 vec_cmpgt(vector
unsigned long long __a, vector
unsigned long long __b) {
2152 return (vector
bool long long)__builtin_altivec_vcmpgtud(
__a,
__b);
2154 #elif defined(__VSX__)
2157 vector
signed int __sgtw = (vector
signed int)
vec_cmpgt(
2158 (vector
signed int)
__a, (vector
signed int)
__b);
2159 vector
unsigned int __ugtw = (vector
unsigned int)
vec_cmpgt(
2160 (vector
unsigned int)
__a, (vector
unsigned int)
__b);
2161 vector
unsigned int __eqw = (vector
unsigned int)
vec_cmpeq(
2162 (vector
signed int)
__a, (vector
signed int)
__b);
2163 #ifdef __LITTLE_ENDIAN__
2164 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2165 __sgtw |= (vector
signed int)__ugtw;
2166 return (vector
bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3,
2169 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2170 __sgtw |= (vector
signed int)__ugtw;
2171 return (vector
bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2,
2177 vec_cmpgt(vector
unsigned long long __a, vector
unsigned long long __b) {
2178 vector
unsigned int __ugtw = (vector
unsigned int)
vec_cmpgt(
2179 (vector
unsigned int)
__a, (vector
unsigned int)
__b);
2180 vector
unsigned int __eqw = (vector
unsigned int)
vec_cmpeq(
2181 (vector
signed int)
__a, (vector
signed int)
__b);
2182 #ifdef __LITTLE_ENDIAN__
2183 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2185 return (vector
bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3,
2188 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2190 return (vector
bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2,
2199 return (vector
bool int)__builtin_vsx_xvcmpgtsp(
__a,
__b);
2201 return (vector
bool int)__builtin_altivec_vcmpgtfp(
__a,
__b);
2208 return (vector
bool long long)__builtin_vsx_xvcmpgtdp(
__a,
__b);
2212 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2215 return (vector
bool __int128)__builtin_altivec_vcmpgtsq(
2216 (vector
bool __int128)
__a, (vector
bool __int128)
__b);
2220 vec_cmpgt(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2221 return (vector
bool __int128)__builtin_altivec_vcmpgtuq(
2222 (vector
bool __int128)
__a, (vector
bool __int128)
__b);
2261 return (vector
bool int)__builtin_vsx_xvcmpgesp(
__a,
__b);
2263 return (vector
bool int)__builtin_altivec_vcmpgefp(
__a,
__b);
2270 return (vector
bool long long)__builtin_vsx_xvcmpgedp(
__a,
__b);
2279 vec_cmpge(vector
unsigned long long __a, vector
unsigned long long __b) {
2284 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2291 vec_cmpge(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2298 static __inline__ vector
bool int __attribute__((__always_inline__))
2299 vec_vcmpgefp(vector
float __a, vector
float __b) {
2300 return (vector
bool int)__builtin_altivec_vcmpgefp(
__a,
__b);
2305 static __inline__ vector
bool char __attribute__((__always_inline__))
2306 vec_vcmpgtsb(vector
signed char __a, vector
signed char __b) {
2307 return (vector
bool char)__builtin_altivec_vcmpgtsb(
__a,
__b);
2312 static __inline__ vector
bool char __attribute__((__always_inline__))
2313 vec_vcmpgtub(vector
unsigned char __a, vector
unsigned char __b) {
2314 return (vector
bool char)__builtin_altivec_vcmpgtub(
__a,
__b);
2319 static __inline__ vector
bool short __attribute__((__always_inline__))
2320 vec_vcmpgtsh(vector
short __a, vector
short __b) {
2321 return (vector
bool short)__builtin_altivec_vcmpgtsh(
__a,
__b);
2326 static __inline__ vector
bool short __attribute__((__always_inline__))
2327 vec_vcmpgtuh(vector
unsigned short __a, vector
unsigned short __b) {
2328 return (vector
bool short)__builtin_altivec_vcmpgtuh(
__a,
__b);
2333 static __inline__ vector
bool int __attribute__((__always_inline__))
2334 vec_vcmpgtsw(vector
int __a, vector
int __b) {
2335 return (vector
bool int)__builtin_altivec_vcmpgtsw(
__a,
__b);
2340 static __inline__ vector
bool int __attribute__((__always_inline__))
2341 vec_vcmpgtuw(vector
unsigned int __a, vector
unsigned int __b) {
2342 return (vector
bool int)__builtin_altivec_vcmpgtuw(
__a,
__b);
2347 static __inline__ vector
bool int __attribute__((__always_inline__))
2348 vec_vcmpgtfp(vector
float __a, vector
float __b) {
2349 return (vector
bool int)__builtin_altivec_vcmpgtfp(
__a,
__b);
2401 vec_cmple(vector
unsigned long long __a, vector
unsigned long long __b) {
2406 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2413 vec_cmple(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2462 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2469 vec_cmplt(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2481 vec_cmplt(vector
unsigned long long __a, vector
unsigned long long __b) {
2486 #ifdef __POWER8_VECTOR__
2490 vec_popcnt(vector
signed char __a) {
2491 return __builtin_altivec_vpopcntb(
__a);
2494 vec_popcnt(vector
unsigned char __a) {
2495 return __builtin_altivec_vpopcntb(
__a);
2498 vec_popcnt(vector
signed short __a) {
2499 return __builtin_altivec_vpopcnth(
__a);
2502 vec_popcnt(vector
unsigned short __a) {
2503 return __builtin_altivec_vpopcnth(
__a);
2506 vec_popcnt(vector
signed int __a) {
2507 return __builtin_altivec_vpopcntw(
__a);
2510 vec_popcnt(vector
unsigned int __a) {
2511 return __builtin_altivec_vpopcntw(
__a);
2513 static __inline__ vector
unsigned long long __ATTRS_o_ai
2514 vec_popcnt(vector
signed long long __a) {
2515 return __builtin_altivec_vpopcntd(
__a);
2517 static __inline__ vector
unsigned long long __ATTRS_o_ai
2518 vec_popcnt(vector
unsigned long long __a) {
2519 return __builtin_altivec_vpopcntd(
__a);
2522 #define vec_vclz vec_cntlz
2526 vec_cntlz(vector
signed char __a) {
2527 return __builtin_altivec_vclzb(
__a);
2530 vec_cntlz(vector
unsigned char __a) {
2531 return __builtin_altivec_vclzb(
__a);
2534 vec_cntlz(vector
signed short __a) {
2535 return __builtin_altivec_vclzh(
__a);
2538 vec_cntlz(vector
unsigned short __a) {
2539 return __builtin_altivec_vclzh(
__a);
2542 vec_cntlz(vector
signed int __a) {
2543 return __builtin_altivec_vclzw(
__a);
2546 vec_cntlz(vector
unsigned int __a) {
2547 return __builtin_altivec_vclzw(
__a);
2550 vec_cntlz(vector
signed long long __a) {
2551 return __builtin_altivec_vclzd(
__a);
2553 static __inline__ vector
unsigned long long __ATTRS_o_ai
2554 vec_cntlz(vector
unsigned long long __a) {
2555 return __builtin_altivec_vclzd(
__a);
2559 #ifdef __POWER9_VECTOR__
2564 vec_cnttz(vector
signed char __a) {
2565 return __builtin_altivec_vctzb(
__a);
2568 vec_cnttz(vector
unsigned char __a) {
2569 return __builtin_altivec_vctzb(
__a);
2572 vec_cnttz(vector
signed short __a) {
2573 return __builtin_altivec_vctzh(
__a);
2576 vec_cnttz(vector
unsigned short __a) {
2577 return __builtin_altivec_vctzh(
__a);
2580 vec_cnttz(vector
signed int __a) {
2581 return __builtin_altivec_vctzw(
__a);
2584 vec_cnttz(vector
unsigned int __a) {
2585 return __builtin_altivec_vctzw(
__a);
2588 vec_cnttz(vector
signed long long __a) {
2589 return __builtin_altivec_vctzd(
__a);
2591 static __inline__ vector
unsigned long long __ATTRS_o_ai
2592 vec_cnttz(vector
unsigned long long __a) {
2593 return __builtin_altivec_vctzd(
__a);
2599 vec_first_match_index(vector
signed char __a, vector
signed char __b) {
2600 vector
unsigned long long __res =
2601 #ifdef __LITTLE_ENDIAN__
2606 if (__res[0] == 64) {
2607 return (__res[1] + 64) >> 3;
2609 return __res[0] >> 3;
2613 vec_first_match_index(vector
unsigned char __a, vector
unsigned char __b) {
2614 vector
unsigned long long __res =
2615 #ifdef __LITTLE_ENDIAN__
2620 if (__res[0] == 64) {
2621 return (__res[1] + 64) >> 3;
2623 return __res[0] >> 3;
2627 vec_first_match_index(vector
signed short __a, vector
signed short __b) {
2628 vector
unsigned long long __res =
2629 #ifdef __LITTLE_ENDIAN__
2634 if (__res[0] == 64) {
2635 return (__res[1] + 64) >> 4;
2637 return __res[0] >> 4;
2641 vec_first_match_index(vector
unsigned short __a, vector
unsigned short __b) {
2642 vector
unsigned long long __res =
2643 #ifdef __LITTLE_ENDIAN__
2648 if (__res[0] == 64) {
2649 return (__res[1] + 64) >> 4;
2651 return __res[0] >> 4;
2655 vec_first_match_index(vector
signed int __a, vector
signed int __b) {
2656 vector
unsigned long long __res =
2657 #ifdef __LITTLE_ENDIAN__
2662 if (__res[0] == 64) {
2663 return (__res[1] + 64) >> 5;
2665 return __res[0] >> 5;
2669 vec_first_match_index(vector
unsigned int __a, vector
unsigned int __b) {
2670 vector
unsigned long long __res =
2671 #ifdef __LITTLE_ENDIAN__
2676 if (__res[0] == 64) {
2677 return (__res[1] + 64) >> 5;
2679 return __res[0] >> 5;
2685 vec_first_match_or_eos_index(vector
signed char __a, vector
signed char __b) {
2691 vector
bool char __tmp2 = __tmp1 |
2695 vector
unsigned long long __res =
2696 #ifdef __LITTLE_ENDIAN__
2697 vec_cnttz((vector
unsigned long long)__tmp2);
2699 vec_cntlz((vector
unsigned long long)__tmp2);
2701 if (__res[0] == 64) {
2702 return (__res[1] + 64) >> 3;
2704 return __res[0] >> 3;
2708 vec_first_match_or_eos_index(vector
unsigned char __a,
2709 vector
unsigned char __b) {
2711 vector
bool char __tmp2 = __tmp1 |
2715 vector
unsigned long long __res =
2716 #ifdef __LITTLE_ENDIAN__
2717 vec_cnttz((vector
unsigned long long)__tmp2);
2719 vec_cntlz((vector
unsigned long long)__tmp2);
2721 if (__res[0] == 64) {
2722 return (__res[1] + 64) >> 3;
2724 return __res[0] >> 3;
2728 vec_first_match_or_eos_index(vector
signed short __a, vector
signed short __b) {
2730 vector
bool short __tmp2 = __tmp1 |
2734 vector
unsigned long long __res =
2735 #ifdef __LITTLE_ENDIAN__
2736 vec_cnttz((vector
unsigned long long)__tmp2);
2738 vec_cntlz((vector
unsigned long long)__tmp2);
2740 if (__res[0] == 64) {
2741 return (__res[1] + 64) >> 4;
2743 return __res[0] >> 4;
2747 vec_first_match_or_eos_index(vector
unsigned short __a,
2748 vector
unsigned short __b) {
2750 vector
bool short __tmp2 = __tmp1 |
2754 vector
unsigned long long __res =
2755 #ifdef __LITTLE_ENDIAN__
2756 vec_cnttz((vector
unsigned long long)__tmp2);
2758 vec_cntlz((vector
unsigned long long)__tmp2);
2760 if (__res[0] == 64) {
2761 return (__res[1] + 64) >> 4;
2763 return __res[0] >> 4;
2767 vec_first_match_or_eos_index(vector
signed int __a, vector
signed int __b) {
2769 vector
bool int __tmp2 = __tmp1 |
vec_cmpeq((vector
signed int)__tmp1,
__a) |
2772 vector
unsigned long long __res =
2773 #ifdef __LITTLE_ENDIAN__
2774 vec_cnttz((vector
unsigned long long)__tmp2);
2776 vec_cntlz((vector
unsigned long long)__tmp2);
2778 if (__res[0] == 64) {
2779 return (__res[1] + 64) >> 5;
2781 return __res[0] >> 5;
2785 vec_first_match_or_eos_index(vector
unsigned int __a, vector
unsigned int __b) {
2787 vector
bool int __tmp2 = __tmp1 |
2791 vector
unsigned long long __res =
2792 #ifdef __LITTLE_ENDIAN__
2793 vec_cnttz((vector
unsigned long long)__tmp2);
2795 vec_cntlz((vector
unsigned long long)__tmp2);
2797 if (__res[0] == 64) {
2798 return (__res[1] + 64) >> 5;
2800 return __res[0] >> 5;
2806 vec_first_mismatch_index(vector
signed char __a, vector
signed char __b) {
2807 vector
unsigned long long __res =
2808 #ifdef __LITTLE_ENDIAN__
2813 if (__res[0] == 64) {
2814 return (__res[1] + 64) >> 3;
2816 return __res[0] >> 3;
2820 vec_first_mismatch_index(vector
unsigned char __a, vector
unsigned char __b) {
2821 vector
unsigned long long __res =
2822 #ifdef __LITTLE_ENDIAN__
2827 if (__res[0] == 64) {
2828 return (__res[1] + 64) >> 3;
2830 return __res[0] >> 3;
2834 vec_first_mismatch_index(vector
signed short __a, vector
signed short __b) {
2835 vector
unsigned long long __res =
2836 #ifdef __LITTLE_ENDIAN__
2841 if (__res[0] == 64) {
2842 return (__res[1] + 64) >> 4;
2844 return __res[0] >> 4;
2848 vec_first_mismatch_index(vector
unsigned short __a, vector
unsigned short __b) {
2849 vector
unsigned long long __res =
2850 #ifdef __LITTLE_ENDIAN__
2855 if (__res[0] == 64) {
2856 return (__res[1] + 64) >> 4;
2858 return __res[0] >> 4;
2862 vec_first_mismatch_index(vector
signed int __a, vector
signed int __b) {
2863 vector
unsigned long long __res =
2864 #ifdef __LITTLE_ENDIAN__
2869 if (__res[0] == 64) {
2870 return (__res[1] + 64) >> 5;
2872 return __res[0] >> 5;
2876 vec_first_mismatch_index(vector
unsigned int __a, vector
unsigned int __b) {
2877 vector
unsigned long long __res =
2878 #ifdef __LITTLE_ENDIAN__
2883 if (__res[0] == 64) {
2884 return (__res[1] + 64) >> 5;
2886 return __res[0] >> 5;
2892 vec_first_mismatch_or_eos_index(vector
signed char __a,
2893 vector
signed char __b) {
2894 vector
unsigned long long __res =
2895 #ifdef __LITTLE_ENDIAN__
2896 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2898 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2900 if (__res[0] == 64) {
2901 return (__res[1] + 64) >> 3;
2903 return __res[0] >> 3;
2907 vec_first_mismatch_or_eos_index(vector
unsigned char __a,
2908 vector
unsigned char __b) {
2909 vector
unsigned long long __res =
2910 #ifdef __LITTLE_ENDIAN__
2911 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2913 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2915 if (__res[0] == 64) {
2916 return (__res[1] + 64) >> 3;
2918 return __res[0] >> 3;
2922 vec_first_mismatch_or_eos_index(vector
signed short __a,
2923 vector
signed short __b) {
2924 vector
unsigned long long __res =
2925 #ifdef __LITTLE_ENDIAN__
2926 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2928 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2930 if (__res[0] == 64) {
2931 return (__res[1] + 64) >> 4;
2933 return __res[0] >> 4;
2937 vec_first_mismatch_or_eos_index(vector
unsigned short __a,
2938 vector
unsigned short __b) {
2939 vector
unsigned long long __res =
2940 #ifdef __LITTLE_ENDIAN__
2941 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2943 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2945 if (__res[0] == 64) {
2946 return (__res[1] + 64) >> 4;
2948 return __res[0] >> 4;
2952 vec_first_mismatch_or_eos_index(vector
signed int __a, vector
signed int __b) {
2953 vector
unsigned long long __res =
2954 #ifdef __LITTLE_ENDIAN__
2955 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2957 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2959 if (__res[0] == 64) {
2960 return (__res[1] + 64) >> 5;
2962 return __res[0] >> 5;
2966 vec_first_mismatch_or_eos_index(vector
unsigned int __a,
2967 vector
unsigned int __b) {
2968 vector
unsigned long long __res =
2969 #ifdef __LITTLE_ENDIAN__
2970 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2972 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2974 if (__res[0] == 64) {
2975 return (__res[1] + 64) >> 5;
2977 return __res[0] >> 5;
2981 vec_insert_exp(vector
double __a, vector
unsigned long long __b) {
2982 return __builtin_vsx_xviexpdp((vector
unsigned long long)
__a,
__b);
2986 vec_insert_exp(vector
unsigned long long __a, vector
unsigned long long __b) {
2987 return __builtin_vsx_xviexpdp(
__a,
__b);
2991 vec_insert_exp(vector
float __a, vector
unsigned int __b) {
2992 return __builtin_vsx_xviexpsp((vector
unsigned int)
__a,
__b);
2996 vec_insert_exp(vector
unsigned int __a, vector
unsigned int __b) {
2997 return __builtin_vsx_xviexpsp(
__a,
__b);
3000 #if defined(__powerpc64__)
3001 static __inline__ vector
signed char __ATTRS_o_ai vec_xl_len(
const signed char *
__a,
3003 return (vector
signed char)__builtin_vsx_lxvl(
__a, (
__b << 56));
3007 vec_xl_len(
const unsigned char *
__a,
size_t __b) {
3008 return (vector
unsigned char)__builtin_vsx_lxvl(
__a, (
__b << 56));
3011 static __inline__ vector
signed short __ATTRS_o_ai vec_xl_len(
const signed short *
__a,
3013 return (vector
signed short)__builtin_vsx_lxvl(
__a, (
__b << 56));
3017 vec_xl_len(
const unsigned short *
__a,
size_t __b) {
3018 return (vector
unsigned short)__builtin_vsx_lxvl(
__a, (
__b << 56));
3021 static __inline__ vector
signed int __ATTRS_o_ai vec_xl_len(
const signed int *
__a,
3023 return (vector
signed int)__builtin_vsx_lxvl(
__a, (
__b << 56));
3026 static __inline__ vector
unsigned int __ATTRS_o_ai vec_xl_len(
const unsigned int *
__a,
3028 return (vector
unsigned int)__builtin_vsx_lxvl(
__a, (
__b << 56));
3031 static __inline__ vector
float __ATTRS_o_ai vec_xl_len(
const float *
__a,
size_t __b) {
3032 return (vector
float)__builtin_vsx_lxvl(
__a, (
__b << 56));
3035 #ifdef __SIZEOF_INT128__
3037 vec_xl_len(
const signed __int128 *
__a,
size_t __b) {
3038 return (vector
signed __int128)__builtin_vsx_lxvl(
__a, (
__b << 56));
3041 static __inline__ vector
unsigned __int128
__ATTRS_o_ai
3042 vec_xl_len(
const unsigned __int128 *
__a,
size_t __b) {
3043 return (vector
unsigned __int128)__builtin_vsx_lxvl(
__a, (
__b << 56));
3048 vec_xl_len(
const signed long long *
__a,
size_t __b) {
3049 return (vector
signed long long)__builtin_vsx_lxvl(
__a, (
__b << 56));
3052 static __inline__ vector
unsigned long long __ATTRS_o_ai
3053 vec_xl_len(
const unsigned long long *
__a,
size_t __b) {
3054 return (vector
unsigned long long)__builtin_vsx_lxvl(
__a, (
__b << 56));
3057 static __inline__ vector
double __ATTRS_o_ai vec_xl_len(
const double *
__a,
3059 return (vector
double)__builtin_vsx_lxvl(
__a, (
__b << 56));
3063 vec_xl_len_r(
const unsigned char *
__a,
size_t __b) {
3064 vector
unsigned char __res =
3065 (vector
unsigned char)__builtin_vsx_lxvll(
__a, (
__b << 56));
3066 vector
unsigned char __mask =
3067 (vector
unsigned char)__builtin_altivec_lvsr(16 -
__b, (
int *)
NULL);
3068 return (vector
unsigned char)__builtin_altivec_vperm_4si(
3069 (vector
int)__res, (vector
int)__res, __mask);
3073 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned char __a,
3076 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3079 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed char __a,
3080 signed char *
__b,
size_t __c) {
3081 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3084 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed short __a,
3085 signed short *
__b,
size_t __c) {
3086 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3089 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned short __a,
3090 unsigned short *
__b,
3092 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3095 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed int __a,
3096 signed int *
__b,
size_t __c) {
3097 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3100 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned int __a,
3101 unsigned int *
__b,
size_t __c) {
3102 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3107 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3110 #ifdef __SIZEOF_INT128__
3111 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed __int128
__a,
3112 signed __int128 *
__b,
3114 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3117 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned __int128
__a,
3118 unsigned __int128 *
__b,
3120 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3124 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed long long __a,
3125 signed long long *
__b,
3127 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3130 static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned long long __a,
3131 unsigned long long *
__b,
3133 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3138 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3141 static __inline__
void __ATTRS_o_ai vec_xst_len_r(vector
unsigned char __a,
3144 vector
unsigned char __mask =
3145 (vector
unsigned char)__builtin_altivec_lvsl(16 -
__c, (
int *)
NULL);
3146 vector
unsigned char __res =
3147 __builtin_altivec_vperm_4si((vector
int)
__a, (vector
int)
__a, __mask);
3148 return __builtin_vsx_stxvll((vector
int)__res,
__b, (
__c << 56));
3153 #if defined(__POWER9_VECTOR__) && defined(__powerpc64__)
3154 #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT))
3155 #define __vec_strmb(PTR, CNT, VAL) \
3156 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT))
3158 #define __vec_ldrmb __builtin_vsx_ldrmb
3159 #define __vec_strmb __builtin_vsx_strmb
3165 static __inline__ vector
float __ATTRS_o_ai vec_cpsgn(vector
float __a,
3167 return __builtin_vsx_xvcpsgnsp(
__b,
__a);
3170 static __inline__ vector
double __ATTRS_o_ai vec_cpsgn(vector
double __a,
3171 vector
double __b) {
3172 return __builtin_vsx_xvcpsgndp(
__b,
__a);
3182 #ifdef __XL_COMPAT_ALTIVEC__
3183 #define vec_ctf(__a, __b) \
3184 _Generic((__a), vector int \
3185 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3186 vector unsigned int \
3187 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3189 vector unsigned long long \
3190 : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \
3191 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \
3192 vector signed long long \
3193 : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \
3194 (vector float)(vector unsigned)((0x7f - (__b)) << 23)))
3195 #else // __XL_COMPAT_ALTIVEC__
3196 #define vec_ctf(__a, __b) \
3197 _Generic((__a), vector int \
3198 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3199 vector unsigned int \
3200 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3202 vector unsigned long long \
3203 : (__builtin_convertvector((vector unsigned long long)(__a), \
3205 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3207 vector signed long long \
3208 : (__builtin_convertvector((vector signed long long)(__a), \
3210 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3212 #endif // __XL_COMPAT_ALTIVEC__
3214 #define vec_ctf(__a, __b) \
3215 _Generic((__a), vector int \
3216 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3217 vector unsigned int \
3218 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
3224 #define vec_ctd(__a, __b) \
3225 _Generic((__a), vector signed int \
3226 : (vec_doublee((vector signed int)(__a)) * \
3227 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3229 vector unsigned int \
3230 : (vec_doublee((vector unsigned int)(__a)) * \
3231 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3233 vector unsigned long long \
3234 : (__builtin_convertvector((vector unsigned long long)(__a), \
3236 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3238 vector signed long long \
3239 : (__builtin_convertvector((vector signed long long)(__a), \
3241 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3247 #define vec_vcfux __builtin_altivec_vcfux
3250 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
3255 #ifdef __XL_COMPAT_ALTIVEC__
3256 #define vec_cts(__a, __b) \
3257 _Generic((__a), vector float \
3258 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \
3261 vector double __ret = \
3262 (vector double)(__a) * \
3263 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3265 __builtin_vsx_xvcvdpsxws(__ret); \
3267 #else // __XL_COMPAT_ALTIVEC__
3268 #define vec_cts(__a, __b) \
3269 _Generic((__a), vector float \
3270 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \
3273 vector double __ret = \
3274 (vector double)(__a) * \
3275 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3277 __builtin_convertvector(__ret, vector signed long long); \
3279 #endif // __XL_COMPAT_ALTIVEC__
3281 #define vec_cts __builtin_altivec_vctsxs
3286 #define vec_vctsxs __builtin_altivec_vctsxs
3291 #ifdef __XL_COMPAT_ALTIVEC__
3292 #define vec_ctu(__a, __b) \
3293 _Generic((__a), vector float \
3294 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \
3297 vector double __ret = \
3298 (vector double)(__a) * \
3299 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3301 __builtin_vsx_xvcvdpuxws(__ret); \
3303 #else // __XL_COMPAT_ALTIVEC__
3304 #define vec_ctu(__a, __b) \
3305 _Generic((__a), vector float \
3306 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \
3309 vector double __ret = \
3310 (vector double)(__a) * \
3311 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3313 __builtin_convertvector(__ret, vector unsigned long long); \
3315 #endif // __XL_COMPAT_ALTIVEC__
3317 #define vec_ctu __builtin_altivec_vctuxs
3320 #ifdef __LITTLE_ENDIAN__
3324 #define vec_ctsl(__a, __b) \
3325 _Generic((__a), vector float \
3327 vector float __ret = \
3328 (vector float)(__a) * \
3329 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3330 __builtin_vsx_xvcvspsxds( \
3331 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3335 vector double __ret = \
3336 (vector double)(__a) * \
3337 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3339 __builtin_convertvector(__ret, vector signed long long); \
3344 #define vec_ctul(__a, __b) \
3345 _Generic((__a), vector float \
3347 vector float __ret = \
3348 (vector float)(__a) * \
3349 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3350 __builtin_vsx_xvcvspuxds( \
3351 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3355 vector double __ret = \
3356 (vector double)(__a) * \
3357 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3359 __builtin_convertvector(__ret, vector unsigned long long); \
3362 #else // __LITTLE_ENDIAN__
3366 #define vec_ctsl(__a, __b) \
3367 _Generic((__a), vector float \
3369 vector float __ret = \
3370 (vector float)(__a) * \
3371 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3372 __builtin_vsx_xvcvspsxds(__ret); \
3376 vector double __ret = \
3377 (vector double)(__a) * \
3378 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3380 __builtin_convertvector(__ret, vector signed long long); \
3385 #define vec_ctul(__a, __b) \
3386 _Generic((__a), vector float \
3388 vector float __ret = \
3389 (vector float)(__a) * \
3390 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3391 __builtin_vsx_xvcvspuxds(__ret); \
3395 vector double __ret = \
3396 (vector double)(__a) * \
3397 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3399 __builtin_convertvector(__ret, vector unsigned long long); \
3402 #endif // __LITTLE_ENDIAN__
3406 #define vec_vctuxs __builtin_altivec_vctuxs
3410 #ifdef __POWER9_VECTOR__
3412 vec_signexti(vector
signed char __a) {
3413 return __builtin_altivec_vextsb2w(
__a);
3417 vec_signexti(vector
signed short __a) {
3418 return __builtin_altivec_vextsh2w(
__a);
3422 vec_signextll(vector
signed char __a) {
3423 return __builtin_altivec_vextsb2d(
__a);
3427 vec_signextll(vector
signed short __a) {
3428 return __builtin_altivec_vextsh2d(
__a);
3432 vec_signextll(vector
signed int __a) {
3433 return __builtin_altivec_vextsw2d(
__a);
3437 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3439 vec_signextq(vector
signed long long __a) {
3440 return __builtin_altivec_vextsd2q(
__a);
3447 vec_sld(vector
signed int, vector
signed int,
unsigned const int __c);
3451 return __builtin_convertvector(
__a, vector
signed int);
3457 return __builtin_convertvector(
__a, vector
signed long long);
3460 static __inline__ vector
signed int __attribute__((__always_inline__))
3461 vec_signed2(vector
double __a, vector
double __b) {
3462 return (vector
signed int) {
__a[0],
__a[1],
__b[0],
__b[1] };
3466 vec_signede(vector
double __a) {
3467 #ifdef __LITTLE_ENDIAN__
3468 vector
signed int __ret = __builtin_vsx_xvcvdpsxws(
__a);
3469 return vec_sld(__ret, __ret, 12);
3471 return __builtin_vsx_xvcvdpsxws(
__a);
3476 vec_signedo(vector
double __a) {
3477 #ifdef __LITTLE_ENDIAN__
3478 return __builtin_vsx_xvcvdpsxws(
__a);
3480 vector
signed int __ret = __builtin_vsx_xvcvdpsxws(
__a);
3481 return vec_sld(__ret, __ret, 12);
3489 vec_sld(vector
unsigned int, vector
unsigned int,
unsigned const int __c);
3493 return __builtin_convertvector(
__a, vector
unsigned int);
3497 static __inline__ vector
unsigned long long __ATTRS_o_ai
3499 return __builtin_convertvector(
__a, vector
unsigned long long);
3502 static __inline__ vector
unsigned int __attribute__((__always_inline__))
3503 vec_unsigned2(vector
double __a, vector
double __b) {
3504 return (vector
unsigned int) {
__a[0],
__a[1],
__b[0],
__b[1] };
3508 vec_unsignede(vector
double __a) {
3509 #ifdef __LITTLE_ENDIAN__
3510 vector
unsigned int __ret = __builtin_vsx_xvcvdpuxws(
__a);
3511 return vec_sld(__ret, __ret, 12);
3513 return __builtin_vsx_xvcvdpuxws(
__a);
3518 vec_unsignedo(vector
double __a) {
3519 #ifdef __LITTLE_ENDIAN__
3520 return __builtin_vsx_xvcvdpuxws(
__a);
3522 vector
unsigned int __ret = __builtin_vsx_xvcvdpuxws(
__a);
3523 return vec_sld(__ret, __ret, 12);
3531 vec_sld(vector
float, vector
float,
unsigned const int __c);
3535 return __builtin_convertvector(
__a, vector
float);
3540 return __builtin_convertvector(
__a, vector
float);
3545 vec_float2(vector
signed long long __a, vector
signed long long __b) {
3546 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3550 vec_float2(vector
unsigned long long __a, vector
unsigned long long __b) {
3551 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3555 vec_float2(vector
double __a, vector
double __b) {
3556 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3560 vec_floate(vector
signed long long __a) {
3561 #ifdef __LITTLE_ENDIAN__
3562 vector
float __ret = __builtin_vsx_xvcvsxdsp(
__a);
3563 return vec_sld(__ret, __ret, 12);
3565 return __builtin_vsx_xvcvsxdsp(
__a);
3570 vec_floate(vector
unsigned long long __a) {
3571 #ifdef __LITTLE_ENDIAN__
3572 vector
float __ret = __builtin_vsx_xvcvuxdsp(
__a);
3573 return vec_sld(__ret, __ret, 12);
3575 return __builtin_vsx_xvcvuxdsp(
__a);
3580 vec_floate(vector
double __a) {
3581 #ifdef __LITTLE_ENDIAN__
3582 vector
float __ret = __builtin_vsx_xvcvdpsp(
__a);
3583 return vec_sld(__ret, __ret, 12);
3585 return __builtin_vsx_xvcvdpsp(
__a);
3590 vec_floato(vector
signed long long __a) {
3591 #ifdef __LITTLE_ENDIAN__
3592 return __builtin_vsx_xvcvsxdsp(
__a);
3594 vector
float __ret = __builtin_vsx_xvcvsxdsp(
__a);
3595 return vec_sld(__ret, __ret, 12);
3600 vec_floato(vector
unsigned long long __a) {
3601 #ifdef __LITTLE_ENDIAN__
3602 return __builtin_vsx_xvcvuxdsp(
__a);
3604 vector
float __ret = __builtin_vsx_xvcvuxdsp(
__a);
3605 return vec_sld(__ret, __ret, 12);
3610 vec_floato(vector
double __a) {
3611 #ifdef __LITTLE_ENDIAN__
3612 return __builtin_vsx_xvcvdpsp(
__a);
3614 vector
float __ret = __builtin_vsx_xvcvdpsp(
__a);
3615 return vec_sld(__ret, __ret, 12);
3624 vec_double(vector
signed long long __a) {
3625 return __builtin_convertvector(
__a, vector
double);
3629 vec_double(vector
unsigned long long __a) {
3630 return __builtin_convertvector(
__a, vector
double);
3634 vec_doublee(vector
signed int __a) {
3635 #ifdef __LITTLE_ENDIAN__
3638 return __builtin_vsx_xvcvsxwdp(
__a);
3643 vec_doublee(vector
unsigned int __a) {
3644 #ifdef __LITTLE_ENDIAN__
3647 return __builtin_vsx_xvcvuxwdp(
__a);
3652 vec_doublee(vector
float __a) {
3653 #ifdef __LITTLE_ENDIAN__
3656 return __builtin_vsx_xvcvspdp(
__a);
3661 vec_doubleh(vector
signed int __a) {
3662 vector
double __ret = {
__a[0],
__a[1]};
3667 vec_doubleh(vector
unsigned int __a) {
3668 vector
double __ret = {
__a[0],
__a[1]};
3673 vec_doubleh(vector
float __a) {
3674 vector
double __ret = {
__a[0],
__a[1]};
3679 vec_doublel(vector
signed int __a) {
3680 vector
double __ret = {
__a[2],
__a[3]};
3685 vec_doublel(vector
unsigned int __a) {
3686 vector
double __ret = {
__a[2],
__a[3]};
3691 vec_doublel(vector
float __a) {
3692 vector
double __ret = {
__a[2],
__a[3]};
3697 vec_doubleo(vector
signed int __a) {
3698 #ifdef __LITTLE_ENDIAN__
3699 return __builtin_vsx_xvcvsxwdp(
__a);
3706 vec_doubleo(vector
unsigned int __a) {
3707 #ifdef __LITTLE_ENDIAN__
3708 return __builtin_vsx_xvcvuxwdp(
__a);
3715 vec_doubleo(vector
float __a) {
3716 #ifdef __LITTLE_ENDIAN__
3717 return __builtin_vsx_xvcvspdp(
__a);
3724 static __inline__ vector
double __ATTRS_o_ai vec_cvf(vector
float __a) {
3725 return vec_doublee(
__a);
3728 static __inline__ vector
float __ATTRS_o_ai vec_cvf(vector
double __a) {
3729 return vec_floate(
__a);
3770 vec_div(vector
signed long long __a, vector
signed long long __b) {
3774 static __inline__ vector
unsigned long long __ATTRS_o_ai
3775 vec_div(vector
unsigned long long __a, vector
unsigned long long __b) {
3785 vector
double __b) {
3792 #ifdef __POWER10_VECTOR__
3794 vec_dive(vector
signed int __a, vector
signed int __b) {
3795 return __builtin_altivec_vdivesw(
__a,
__b);
3799 vec_dive(vector
unsigned int __a, vector
unsigned int __b) {
3800 return __builtin_altivec_vdiveuw(
__a,
__b);
3804 vec_dive(vector
signed long long __a, vector
signed long long __b) {
3805 return __builtin_altivec_vdivesd(
__a,
__b);
3808 static __inline__ vector
unsigned long long __ATTRS_o_ai
3809 vec_dive(vector
unsigned long long __a, vector
unsigned long long __b) {
3810 return __builtin_altivec_vdiveud(
__a,
__b);
3813 #ifdef __SIZEOF_INT128__
3814 static __inline__ vector
unsigned __int128
__ATTRS_o_ai
3815 vec_dive(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
3816 return __builtin_altivec_vdiveuq(
__a,
__b);
3820 vec_dive(vector
signed __int128
__a, vector
signed __int128
__b) {
3821 return __builtin_altivec_vdivesq(
__a,
__b);
3826 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3827 static __inline__ vector
unsigned __int128
__ATTRS_o_ai
3828 vec_div(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
3833 vec_div(vector
signed __int128
__a, vector
signed __int128
__b) {
3842 vector
double __b) {
3843 return __builtin_vsx_xvtdivdp(
__a,
__b);
3848 return __builtin_vsx_xvtdivsp(
__a,
__b);
3854 #define vec_dss __builtin_altivec_dss
3858 static __inline__
void __attribute__((__always_inline__)) vec_dssall(
void) {
3859 __builtin_altivec_dssall();
3863 #define vec_dst(__PTR, __CW, __STR) \
3864 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3867 #define vec_dstst(__PTR, __CW, __STR) \
3868 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3871 #define vec_dststt(__PTR, __CW, __STR) \
3872 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3875 #define vec_dstt(__PTR, __CW, __STR) \
3876 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3880 #ifdef __POWER8_VECTOR__
3882 vec_eqv(vector
signed char __a, vector
signed char __b) {
3883 return (vector
signed char)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3884 (vector
unsigned int)
__b);
3888 vec_eqv(vector
unsigned char __a, vector
unsigned char __b) {
3889 return (vector
unsigned char)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3890 (vector
unsigned int)
__b);
3893 static __inline__ vector
bool char __ATTRS_o_ai vec_eqv(vector
bool char __a,
3894 vector
bool char __b) {
3895 return (vector
bool char)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3896 (vector
unsigned int)
__b);
3900 vec_eqv(vector
signed short __a, vector
signed short __b) {
3901 return (vector
signed short)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3902 (vector
unsigned int)
__b);
3906 vec_eqv(vector
unsigned short __a, vector
unsigned short __b) {
3907 return (vector
unsigned short)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3908 (vector
unsigned int)
__b);
3912 vec_eqv(vector
bool short __a, vector
bool short __b) {
3913 return (vector
bool short)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3914 (vector
unsigned int)
__b);
3918 vec_eqv(vector
signed int __a, vector
signed int __b) {
3919 return (vector
signed int)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3920 (vector
unsigned int)
__b);
3924 vec_eqv(vector
unsigned int __a, vector
unsigned int __b) {
3925 return __builtin_vsx_xxleqv(
__a,
__b);
3928 static __inline__ vector
bool int __ATTRS_o_ai vec_eqv(vector
bool int __a,
3929 vector
bool int __b) {
3930 return (vector
bool int)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3931 (vector
unsigned int)
__b);
3935 vec_eqv(vector
signed long long __a, vector
signed long long __b) {
3936 return (vector
signed long long)__builtin_vsx_xxleqv(
3937 (vector
unsigned int)
__a, (vector
unsigned int)
__b);
3940 static __inline__ vector
unsigned long long __ATTRS_o_ai
3941 vec_eqv(vector
unsigned long long __a, vector
unsigned long long __b) {
3942 return (vector
unsigned long long)__builtin_vsx_xxleqv(
3943 (vector
unsigned int)
__a, (vector
unsigned int)
__b);
3947 vec_eqv(vector
bool long long __a, vector
bool long long __b) {
3948 return (vector
bool long long)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3949 (vector
unsigned int)
__b);
3954 return (vector
float)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3955 (vector
unsigned int)
__b);
3958 static __inline__ vector
double __ATTRS_o_ai vec_eqv(vector
double __a,
3959 vector
double __b) {
3960 return (vector
double)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3961 (vector
unsigned int)
__b);
3967 static __inline__ vector
float __attribute__((__always_inline__))
3968 vec_expte(vector
float __a) {
3969 return __builtin_altivec_vexptefp(
__a);
3974 static __inline__ vector
float __attribute__((__always_inline__))
3975 vec_vexptefp(vector
float __a) {
3976 return __builtin_altivec_vexptefp(
__a);
3983 return __builtin_vsx_xvrspim(
__a);
3985 return __builtin_altivec_vrfim(
__a);
3991 return __builtin_vsx_xvrdpim(
__a);
4008 static __inline__ vector
float __attribute__((__always_inline__))
4009 vec_vrfim(vector
float __a) {
4010 return __builtin_altivec_vrfim(
__a);
4017 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4022 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4027 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4032 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4037 return (vector
bool char)__builtin_altivec_lvx(
__a,
__b);
4041 const vector
short *
__b) {
4042 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4046 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4051 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);
4056 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);
4061 return (vector
bool short)__builtin_altivec_lvx(
__a,
__b);
4065 const vector pixel *
__b) {
4066 return (vector pixel)__builtin_altivec_lvx(
__a,
__b);
4070 const vector
int *
__b) {
4071 return (vector
int)__builtin_altivec_lvx(
__a,
__b);
4075 return (vector
int)__builtin_altivec_lvx(
__a,
__b);
4080 return (vector
unsigned int)__builtin_altivec_lvx(
__a,
__b);
4085 return (vector
unsigned int)__builtin_altivec_lvx(
__a,
__b);
4090 return (vector
bool int)__builtin_altivec_lvx(
__a,
__b);
4094 const vector
float *
__b) {
4095 return (vector
float)__builtin_altivec_lvx(
__a,
__b);
4099 return (vector
float)__builtin_altivec_lvx(
__a,
__b);
4106 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4111 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4116 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4121 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4126 return (vector
bool char)__builtin_altivec_lvx(
__a,
__b);
4130 const vector
short *
__b) {
4131 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4135 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4140 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);
4145 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);
4150 return (vector
bool short)__builtin_altivec_lvx(
__a,
__b);
4154 const vector pixel *
__b) {
4155 return (vector pixel)__builtin_altivec_lvx(
__a,
__b);
4159 const vector
int *
__b) {
4160 return (vector
int)__builtin_altivec_lvx(
__a,
__b);
4164 return (vector
int)__builtin_altivec_lvx(
__a,
__b);
4169 return (vector
unsigned int)__builtin_altivec_lvx(
__a,
__b);
4174 return (vector
unsigned int)__builtin_altivec_lvx(
__a,
__b);
4179 return (vector
bool int)__builtin_altivec_lvx(
__a,
__b);
4183 const vector
float *
__b) {
4184 return (vector
float)__builtin_altivec_lvx(
__a,
__b);
4188 return (vector
float)__builtin_altivec_lvx(
__a,
__b);
4195 return (vector
signed char)__builtin_altivec_lvebx(
__a,
__b);
4200 return (vector
unsigned char)__builtin_altivec_lvebx(
__a,
__b);
4204 return (vector
short)__builtin_altivec_lvehx(
__a,
__b);
4209 return (vector
unsigned short)__builtin_altivec_lvehx(
__a,
__b);
4213 return (vector
int)__builtin_altivec_lvewx(
__a,
__b);
4218 return (vector
unsigned int)__builtin_altivec_lvewx(
__a,
__b);
4222 return (vector
float)__builtin_altivec_lvewx(
__a,
__b);
4229 return (vector
signed char)__builtin_altivec_lvebx(
__a,
__b);
4234 return (vector
unsigned char)__builtin_altivec_lvebx(
__a,
__b);
4241 return (vector
short)__builtin_altivec_lvehx(
__a,
__b);
4246 return (vector
unsigned short)__builtin_altivec_lvehx(
__a,
__b);
4252 return (vector
int)__builtin_altivec_lvewx(
__a,
__b);
4257 return (vector
unsigned int)__builtin_altivec_lvewx(
__a,
__b);
4262 return (vector
float)__builtin_altivec_lvewx(
__a,
__b);
4269 return (vector
signed char)__builtin_altivec_lvxl(
__a,
__b);
4274 return (vector
signed char)__builtin_altivec_lvxl(
__a,
__b);
4279 return (vector
unsigned char)__builtin_altivec_lvxl(
__a,
__b);
4284 return (vector
unsigned char)__builtin_altivec_lvxl(
__a,
__b);
4289 return (vector
bool char)__builtin_altivec_lvxl(
__a,
__b);
4293 const vector
short *
__b) {
4294 return (vector
short)__builtin_altivec_lvxl(
__a,
__b);
4298 return (vector
short)__builtin_altivec_lvxl(
__a,
__b);
4303 return (vector
unsigned short)__builtin_altivec_lvxl(
__a,
__b);
4308 return (vector
unsigned short)__builtin_altivec_lvxl(
__a,
__b);
4311 static __inline__ vector
bool short