13#error "AltiVec support not enabled"
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);
95vec_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__)
181vec_absd(vector
unsigned char __a, vector
unsigned char __b) {
182 return __builtin_altivec_vabsdub(
__a,
__b);
186vec_absd(vector
unsigned short __a, vector
unsigned short __b) {
187 return __builtin_altivec_vabsduh(
__a,
__b);
191vec_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__
291vec_add(vector
signed long long __a, vector
signed long long __b) {
296vec_add(vector
unsigned long long __a, vector
unsigned long long __b) {
300#ifdef __SIZEOF_INT128__
302vec_add(vector
signed __int128
__a, vector
signed __int128
__b) {
307vec_add(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
312static __inline__ vector
unsigned char __attribute__((__always_inline__))
313vec_add_u128(vector
unsigned char __a, vector
unsigned char __b) {
314 return (vector
unsigned char)__builtin_altivec_vadduqm(
__a,
__b);
316#elif defined(__VSX__)
318vec_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 = (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);
336vec_add(vector
unsigned long long __a, vector
unsigned long long __b) {
337 return (vector
unsigned long long)
vec_add((vector
signed long long)
__a,
338 (vector
signed long long)
__b);
356#ifdef __POWER8_VECTOR__
357#ifdef __SIZEOF_INT128__
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);
367vec_adde(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
368 vector
unsigned __int128
__c) {
369 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
373static __inline__ vector
unsigned char __attribute__((__always_inline__))
374vec_adde_u128(vector
unsigned char __a, vector
unsigned char __b,
375 vector
unsigned char __c) {
376 return (vector
unsigned char)__builtin_altivec_vaddeuqm_c(
377 (vector
unsigned char)
__a, (vector
unsigned char)
__b,
378 (vector
unsigned char)
__c);
384 vector
signed int __c) {
385 vector
signed int __mask = {1, 1, 1, 1};
386 vector
signed int __carry =
__c & __mask;
392 vector
unsigned int __c) {
393 vector
unsigned int __mask = {1, 1, 1, 1};
394 vector
unsigned int __carry =
__c & __mask;
400#ifdef __POWER8_VECTOR__
401#ifdef __SIZEOF_INT128__
403vec_addec(vector
signed __int128
__a, vector
signed __int128
__b,
404 vector
signed __int128
__c) {
405 return (vector
signed __int128)__builtin_altivec_vaddecuq(
406 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b,
407 (vector
unsigned __int128)
__c);
411vec_addec(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
412 vector
unsigned __int128
__c) {
413 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
417static __inline__ vector
unsigned char __attribute__((__always_inline__))
418vec_addec_u128(vector
unsigned char __a, vector
unsigned char __b,
419 vector
unsigned char __c) {
420 return (vector
unsigned char)__builtin_altivec_vaddecuq_c(
421 (vector
unsigned char)
__a, (vector
unsigned char)
__b,
422 (vector
unsigned char)
__c);
427vec_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] };
450vec_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] };
473#define __builtin_altivec_vaddubm vec_vaddubm
482 return (vector
signed char)
__a +
__b;
487 return __a + (vector
signed char)
__b;
497 return (vector
unsigned char)
__a +
__b;
502 return __a + (vector
unsigned char)
__b;
507#define __builtin_altivec_vadduhm vec_vadduhm
516 return (vector
short)
__a +
__b;
520 vector
bool short __b) {
521 return __a + (vector short)
__b;
531 return (vector
unsigned short)
__a +
__b;
536 return __a + (vector
unsigned short)
__b;
541#define __builtin_altivec_vadduwm vec_vadduwm
550 return (vector
int)
__a +
__b;
554 vector
bool int __b) {
565 return (vector
unsigned int)
__a +
__b;
575#define __builtin_altivec_vaddfp vec_vaddfp
577static __inline__ vector
float __attribute__((__always_inline__))
578vec_vaddfp(vector
float __a, vector
float __b) {
586 return (vector
signed int)__builtin_altivec_vaddcuw((vector
unsigned int)
__a,
587 (vector
unsigned int)
__b);
592 return __builtin_altivec_vaddcuw(
__a,
__b);
595#ifdef __POWER8_VECTOR__
596#ifdef __SIZEOF_INT128__
599 return (vector
signed __int128)__builtin_altivec_vaddcuq(
600 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
604vec_addc(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
605 return __builtin_altivec_vaddcuq(
__a,
__b);
609static __inline__ vector
unsigned char __attribute__((__always_inline__))
610vec_addc_u128(vector
unsigned char __a, vector
unsigned char __b) {
611 return (vector
unsigned char)__builtin_altivec_vaddcuq_c(
612 (vector
unsigned char)
__a, (vector
unsigned char)
__b);
618static __inline__ vector
unsigned int __attribute__((__always_inline__))
619vec_vaddcuw(vector
unsigned int __a, vector
unsigned int __b) {
620 return __builtin_altivec_vaddcuw(
__a,
__b);
627 return __builtin_altivec_vaddsbs(
__a,
__b);
632 return __builtin_altivec_vaddsbs((vector
signed char)
__a,
__b);
637 return __builtin_altivec_vaddsbs(
__a, (vector
signed char)
__b);
642 return __builtin_altivec_vaddubs(
__a,
__b);
647 return __builtin_altivec_vaddubs((vector
unsigned char)
__a,
__b);
652 return __builtin_altivec_vaddubs(
__a, (vector
unsigned char)
__b);
657 return __builtin_altivec_vaddshs(
__a,
__b);
662 return __builtin_altivec_vaddshs((vector
short)
__a,
__b);
666 vector
bool short __b) {
667 return __builtin_altivec_vaddshs(
__a, (vector
short)
__b);
672 return __builtin_altivec_vadduhs(
__a,
__b);
677 return __builtin_altivec_vadduhs((vector
unsigned short)
__a,
__b);
682 return __builtin_altivec_vadduhs(
__a, (vector
unsigned short)
__b);
687 return __builtin_altivec_vaddsws(
__a,
__b);
692 return __builtin_altivec_vaddsws((vector
int)
__a,
__b);
696 vector
bool int __b) {
697 return __builtin_altivec_vaddsws(
__a, (vector
int)
__b);
702 return __builtin_altivec_vadduws(
__a,
__b);
707 return __builtin_altivec_vadduws((vector
unsigned int)
__a,
__b);
712 return __builtin_altivec_vadduws(
__a, (vector
unsigned int)
__b);
719 return __builtin_altivec_vaddsbs(
__a,
__b);
724 return __builtin_altivec_vaddsbs((vector
signed char)
__a,
__b);
729 return __builtin_altivec_vaddsbs(
__a, (vector
signed char)
__b);
736 return __builtin_altivec_vaddubs(
__a,
__b);
741 return __builtin_altivec_vaddubs((vector
unsigned char)
__a,
__b);
746 return __builtin_altivec_vaddubs(
__a, (vector
unsigned char)
__b);
753 return __builtin_altivec_vaddshs(
__a,
__b);
758 return __builtin_altivec_vaddshs((vector
short)
__a,
__b);
762 vector
bool short __b) {
763 return __builtin_altivec_vaddshs(
__a, (vector
short)
__b);
770 return __builtin_altivec_vadduhs(
__a,
__b);
775 return __builtin_altivec_vadduhs((vector
unsigned short)
__a,
__b);
780 return __builtin_altivec_vadduhs(
__a, (vector
unsigned short)
__b);
787 return __builtin_altivec_vaddsws(
__a,
__b);
792 return __builtin_altivec_vaddsws((vector
int)
__a,
__b);
796 vector
bool int __b) {
797 return __builtin_altivec_vaddsws(
__a, (vector
int)
__b);
804 return __builtin_altivec_vadduws(
__a,
__b);
809 return __builtin_altivec_vadduws((vector
unsigned int)
__a,
__b);
814 return __builtin_altivec_vadduws(
__a, (vector
unsigned int)
__b);
817#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
818 defined(__SIZEOF_INT128__)
822vec_vadduqm(vector
signed __int128
__a, vector
signed __int128
__b) {
827vec_vadduqm(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
834vec_vaddeuqm(vector
signed __int128
__a, vector
signed __int128
__b,
835 vector
signed __int128
__c) {
836 return (vector
signed __int128)__builtin_altivec_vaddeuqm(
837 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b,
838 (vector
unsigned __int128)
__c);
842vec_vaddeuqm(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
843 vector
unsigned __int128
__c) {
844 return __builtin_altivec_vaddeuqm(
__a,
__b,
__c);
850vec_vaddcuq(vector
signed __int128
__a, vector
signed __int128
__b) {
851 return (vector
signed __int128)__builtin_altivec_vaddcuq(
852 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
856vec_vaddcuq(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
857 return __builtin_altivec_vaddcuq(
__a,
__b);
863vec_vaddecuq(vector
signed __int128
__a, vector
signed __int128
__b,
864 vector
signed __int128
__c) {
865 return (vector
signed __int128)__builtin_altivec_vaddecuq(
866 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b,
867 (vector
unsigned __int128)
__c);
871vec_vaddecuq(vector
unsigned __int128
__a, vector
unsigned __int128
__b,
872 vector
unsigned __int128
__c) {
873 return __builtin_altivec_vaddecuq(
__a,
__b,
__c);
879#define __builtin_altivec_vand vec_and
888 return (vector
signed char)
__a &
__b;
893 return __a & (vector
signed char)
__b;
903 return (vector
unsigned char)
__a &
__b;
908 return __a & (vector
unsigned char)
__b;
912 vector
bool char __b) {
923 return (vector
short)
__a &
__b;
927 vector
bool short __b) {
928 return __a & (vector short)
__b;
938 return (vector
unsigned short)
__a &
__b;
943 return __a & (vector
unsigned short)
__b;
958 return (vector
int)
__a &
__b;
962 vector
bool int __b) {
973 return (vector
unsigned int)
__a &
__b;
982 vector
bool int __b) {
988 vector
unsigned int __res =
989 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
990 return (vector
float)__res;
995 vector
unsigned int __res =
996 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
997 return (vector
float)__res;
1001 vector
bool int __b) {
1002 vector
unsigned int __res =
1003 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1004 return (vector
float)__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;
1017 vector
unsigned long long __res =
1018 (vector
unsigned long long)
__a & (vector
unsigned long long)
__b;
1019 return (vector
double)__res;
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;
1030vec_and(vector
signed long long __a, vector
signed long long __b) {
1035vec_and(vector
bool long long __a, vector
signed long long __b) {
1036 return (vector
signed long long)
__a &
__b;
1040vec_and(vector
signed long long __a, vector
bool long long __b) {
1041 return __a & (vector
signed long long)
__b;
1044static __inline__ vector
unsigned long long __ATTRS_o_ai
1045vec_and(vector
unsigned long long __a, vector
unsigned long long __b) {
1049static __inline__ vector
unsigned long long __ATTRS_o_ai
1050vec_and(vector
bool long long __a, vector
unsigned long long __b) {
1051 return (vector
unsigned long long)
__a &
__b;
1054static __inline__ vector
unsigned long long __ATTRS_o_ai
1055vec_and(vector
unsigned long long __a, vector
bool long long __b) {
1056 return __a & (vector
unsigned long long)
__b;
1060vec_and(vector
bool long long __a, vector
bool long long __b) {
1074 return (vector
signed char)
__a &
__b;
1079 return __a & (vector
signed char)
__b;
1089 return (vector
unsigned char)
__a &
__b;
1094 return __a & (vector
unsigned char)
__b;
1098 vector
bool char __b) {
1109 return (vector
short)
__a &
__b;
1113 vector
bool short __b) {
1114 return __a & (vector short)
__b;
1124 return (vector
unsigned short)
__a &
__b;
1129 return __a & (vector
unsigned short)
__b;
1144 return (vector
int)
__a &
__b;
1148 vector
bool int __b) {
1159 return (vector
unsigned int)
__a &
__b;
1168 vector
bool int __b) {
1174 vector
unsigned int __res =
1175 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1176 return (vector
float)__res;
1181 vector
unsigned int __res =
1182 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1183 return (vector
float)__res;
1187 vector
bool int __b) {
1188 vector
unsigned int __res =
1189 (vector
unsigned int)
__a & (vector
unsigned int)
__b;
1190 return (vector
float)__res;
1195vec_vand(vector
signed long long __a, vector
signed long long __b) {
1200vec_vand(vector
bool long long __a, vector
signed long long __b) {
1201 return (vector
signed long long)
__a &
__b;
1205vec_vand(vector
signed long long __a, vector
bool long long __b) {
1206 return __a & (vector
signed long long)
__b;
1209static __inline__ vector
unsigned long long __ATTRS_o_ai
1210vec_vand(vector
unsigned long long __a, vector
unsigned long long __b) {
1214static __inline__ vector
unsigned long long __ATTRS_o_ai
1215vec_vand(vector
bool long long __a, vector
unsigned long long __b) {
1216 return (vector
unsigned long long)
__a &
__b;
1219static __inline__ vector
unsigned long long __ATTRS_o_ai
1220vec_vand(vector
unsigned long long __a, vector
bool long long __b) {
1221 return __a & (vector
unsigned long long)
__b;
1232#define __builtin_altivec_vandc vec_andc
1241 return (vector
signed char)
__a & ~__b;
1246 return __a & ~(vector
signed char)
__b;
1256 return (vector
unsigned char)
__a & ~__b;
1261 return __a & ~(vector
unsigned char)
__b;
1265 vector
bool char __b) {
1276 return (vector
short)
__a & ~__b;
1280 vector
bool short __b) {
1281 return __a & ~(vector short)
__b;
1291 return (vector
unsigned short)
__a & ~__b;
1296 return __a & ~(vector
unsigned short)
__b;
1311 return (vector
int)
__a & ~__b;
1315 vector
bool int __b) {
1326 return (vector
unsigned int)
__a & ~__b;
1335 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
unsigned int __res =
1349 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1350 return (vector
float)__res;
1354 vector
bool int __b) {
1355 vector
unsigned int __res =
1356 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1357 return (vector
float)__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;
1370 vector
unsigned long long __res =
1371 (vector
unsigned long long)
__a & ~(vector
unsigned long long)
__b;
1372 return (vector
double)__res;
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;
1383vec_andc(vector
signed long long __a, vector
signed long long __b) {
1388vec_andc(vector
bool long long __a, vector
signed long long __b) {
1389 return (vector
signed long long)
__a & ~__b;
1393vec_andc(vector
signed long long __a, vector
bool long long __b) {
1394 return __a & ~(vector
signed long long)
__b;
1397static __inline__ vector
unsigned long long __ATTRS_o_ai
1398vec_andc(vector
unsigned long long __a, vector
unsigned long long __b) {
1402static __inline__ vector
unsigned long long __ATTRS_o_ai
1403vec_andc(vector
bool long long __a, vector
unsigned long long __b) {
1404 return (vector
unsigned long long)
__a & ~__b;
1407static __inline__ vector
unsigned long long __ATTRS_o_ai
1408vec_andc(vector
unsigned long long __a, vector
bool long long __b) {
1409 return __a & ~(vector
unsigned long long)
__b;
1427 return (vector
signed char)
__a & ~__b;
1432 return __a & ~(vector
signed char)
__b;
1442 return (vector
unsigned char)
__a & ~__b;
1447 return __a & ~(vector
unsigned char)
__b;
1462 return (vector
short)
__a & ~__b;
1466 vector
bool short __b) {
1467 return __a & ~(vector short)
__b;
1477 return (vector
unsigned short)
__a & ~__b;
1482 return __a & ~(vector
unsigned short)
__b;
1497 return (vector
int)
__a & ~__b;
1501 vector
bool int __b) {
1512 return (vector
unsigned int)
__a & ~__b;
1521 vector
bool int __b) {
1527 vector
unsigned int __res =
1528 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1529 return (vector
float)__res;
1534 vector
unsigned int __res =
1535 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1536 return (vector
float)__res;
1540 vector
bool int __b) {
1541 vector
unsigned int __res =
1542 (vector
unsigned int)
__a & ~(vector
unsigned int)
__b;
1543 return (vector
float)__res;
1554 return (vector
signed long long)
__a & ~__b;
1559 return __a & ~(vector
signed long long)
__b;
1562static __inline__ vector
unsigned long long __ATTRS_o_ai
1563vec_vandc(vector
unsigned long long __a, vector
unsigned long long __b) {
1567static __inline__ vector
unsigned long long __ATTRS_o_ai
1569 return (vector
unsigned long long)
__a & ~__b;
1572static __inline__ vector
unsigned long long __ATTRS_o_ai
1574 return __a & ~(vector
unsigned long long)
__b;
1587 return __builtin_altivec_vavgsb(
__a,
__b);
1592 return __builtin_altivec_vavgub(
__a,
__b);
1597 return __builtin_altivec_vavgsh(
__a,
__b);
1602 return __builtin_altivec_vavguh(
__a,
__b);
1607 return __builtin_altivec_vavgsw(
__a,
__b);
1612 return __builtin_altivec_vavguw(
__a,
__b);
1617static __inline__ vector
signed char __attribute__((__always_inline__))
1618vec_vavgsb(vector
signed char __a, vector
signed char __b) {
1619 return __builtin_altivec_vavgsb(
__a,
__b);
1624static __inline__ vector
unsigned char __attribute__((__always_inline__))
1625vec_vavgub(vector
unsigned char __a, vector
unsigned char __b) {
1626 return __builtin_altivec_vavgub(
__a,
__b);
1631static __inline__ vector
short __attribute__((__always_inline__))
1632vec_vavgsh(vector
short __a, vector
short __b) {
1633 return __builtin_altivec_vavgsh(
__a,
__b);
1638static __inline__ vector
unsigned short __attribute__((__always_inline__))
1639vec_vavguh(vector
unsigned short __a, vector
unsigned short __b) {
1640 return __builtin_altivec_vavguh(
__a,
__b);
1645static __inline__ vector
int __attribute__((__always_inline__))
1646vec_vavgsw(vector
int __a, vector
int __b) {
1647 return __builtin_altivec_vavgsw(
__a,
__b);
1652static __inline__ vector
unsigned int __attribute__((__always_inline__))
1653vec_vavguw(vector
unsigned int __a, vector
unsigned int __b) {
1654 return __builtin_altivec_vavguw(
__a,
__b);
1661 return __builtin_vsx_xvrspip(
__a);
1663 return __builtin_altivec_vrfip(
__a);
1669 return __builtin_vsx_xvrdpip(
__a);
1687vec_vrfip(vector
float __a) {
1688 return __builtin_altivec_vrfip(
__a);
1693static __inline__ vector
int __attribute__((__always_inline__))
1694vec_cmpb(vector
float __a, vector
float __b) {
1695 return __builtin_altivec_vcmpbfp(
__a,
__b);
1700static __inline__ vector
int __attribute__((__always_inline__))
1701vec_vcmpbfp(vector
float __a, vector
float __b) {
1702 return __builtin_altivec_vcmpbfp(
__a,
__b);
1709 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1715 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1721 return (vector
bool char)__builtin_altivec_vcmpequb((vector
char)
__a,
1727 return (vector
bool short)__builtin_altivec_vcmpequh(
__a,
__b);
1732 return (vector
bool short)__builtin_altivec_vcmpequh((vector
short)
__a,
1738 return (vector
bool short)__builtin_altivec_vcmpequh((vector
short)
__a,
1744 return (vector
bool int)__builtin_altivec_vcmpequw(
__a,
__b);
1749 return (vector
bool int)__builtin_altivec_vcmpequw((vector
int)
__a,
1754 vector
bool int __b) {
1755 return (vector
bool int)__builtin_altivec_vcmpequw((vector
int)
__a,
1759#ifdef __POWER8_VECTOR__
1762 return (vector
bool long long)__builtin_altivec_vcmpequd(
__a,
__b);
1766vec_cmpeq(vector
unsigned long long __a, vector
unsigned long long __b) {
1767 return (vector
bool long long)__builtin_altivec_vcmpequd(
1768 (vector
long long)
__a, (vector
long long)
__b);
1773 return (vector
bool long long)__builtin_altivec_vcmpequd(
1774 (vector
long long)
__a, (vector
long long)
__b);
1776#elif defined(__VSX__)
1779 vector
bool int __wordcmp =
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,
1786 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0);
1787 return (vector
bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0,
1793vec_cmpeq(vector
unsigned long long __a, vector
unsigned long long __b) {
1794 return vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b);
1799 return vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b);
1806 return (vector
bool int)__builtin_vsx_xvcmpeqsp(
__a,
__b);
1808 return (vector
bool int)__builtin_altivec_vcmpeqfp(
__a,
__b);
1815 return (vector
bool long long)__builtin_vsx_xvcmpeqdp(
__a,
__b);
1819#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1822 return (vector
bool __int128)__builtin_altivec_vcmpequq(
1823 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
1827vec_cmpeq(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
1828 return (vector
bool __int128)__builtin_altivec_vcmpequq(
1829 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
1834 return (vector
bool __int128)__builtin_altivec_vcmpequq(
1835 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b);
1839#ifdef __POWER9_VECTOR__
1844 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1850 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1856 return (vector
bool char)__builtin_altivec_vcmpneb((vector
char)
__a,
1862 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1868 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1874 return (vector
bool short)__builtin_altivec_vcmpneh((vector
short)
__a,
1880 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1886 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1892 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1898 return (vector
bool int)__builtin_altivec_vcmpnew((vector
int)
__a,
1902#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1904vec_cmpne(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
1905 return (vector
bool __int128)~(__builtin_altivec_vcmpequq(
1906 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b));
1911 return (vector
bool __int128)~(__builtin_altivec_vcmpequq(
1912 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b));
1917 return (vector
bool __int128)~(__builtin_altivec_vcmpequq(
1918 (vector
unsigned __int128)
__a, (vector
unsigned __int128)
__b));
1925vec_cmpnez(vector
signed char __a, vector
signed char __b) {
1926 return (vector
bool char)__builtin_altivec_vcmpnezb((vector
char)
__a,
1931vec_cmpnez(vector
unsigned char __a, vector
unsigned char __b) {
1932 return (vector
bool char)__builtin_altivec_vcmpnezb((vector
char)
__a,
1937vec_cmpnez(vector
signed short __a, vector
signed short __b) {
1938 return (vector
bool short)__builtin_altivec_vcmpnezh((vector
short)
__a,
1943vec_cmpnez(vector
unsigned short __a, vector
unsigned short __b) {
1944 return (vector
bool short)__builtin_altivec_vcmpnezh((vector
short)
__a,
1949vec_cmpnez(vector
signed int __a, vector
signed int __b) {
1950 return (vector
bool int)__builtin_altivec_vcmpnezw((vector
int)
__a,
1955vec_cmpnez(vector
unsigned int __a, vector
unsigned int __b) {
1956 return (vector
bool int)__builtin_altivec_vcmpnezw((vector
int)
__a,
1961vec_cntlz_lsbb(vector
signed char __a) {
1962#ifdef __LITTLE_ENDIAN__
1963 return __builtin_altivec_vctzlsbb((vector
unsigned char)
__a);
1965 return __builtin_altivec_vclzlsbb((vector
unsigned char)
__a);
1970vec_cntlz_lsbb(vector
unsigned char __a) {
1971#ifdef __LITTLE_ENDIAN__
1972 return __builtin_altivec_vctzlsbb((vector
unsigned char)
__a);
1974 return __builtin_altivec_vclzlsbb(
__a);
1979vec_cnttz_lsbb(vector
signed char __a) {
1980#ifdef __LITTLE_ENDIAN__
1981 return __builtin_altivec_vclzlsbb((vector
unsigned char)
__a);
1983 return __builtin_altivec_vctzlsbb((vector
unsigned char)
__a);
1988vec_cnttz_lsbb(vector
unsigned char __a) {
1989#ifdef __LITTLE_ENDIAN__
1990 return __builtin_altivec_vclzlsbb(
__a);
1992 return __builtin_altivec_vctzlsbb(
__a);
1997vec_parity_lsbb(vector
unsigned int __a) {
1998 return __builtin_altivec_vprtybw(
__a);
2002vec_parity_lsbb(vector
signed int __a) {
2003 return __builtin_altivec_vprtybw((vector
unsigned int)
__a);
2006#ifdef __SIZEOF_INT128__
2008vec_parity_lsbb(vector
unsigned __int128
__a) {
2009 return __builtin_altivec_vprtybq(
__a);
2013vec_parity_lsbb(vector
signed __int128
__a) {
2014 return __builtin_altivec_vprtybq((vector
unsigned __int128)
__a);
2018static __inline__ vector
unsigned long long __ATTRS_o_ai
2019vec_parity_lsbb(vector
unsigned long long __a) {
2020 return __builtin_altivec_vprtybd(
__a);
2023static __inline__ vector
unsigned long long __ATTRS_o_ai
2024vec_parity_lsbb(vector
signed long long __a) {
2025 return __builtin_altivec_vprtybd((vector
unsigned long long)
__a);
2082#ifdef __POWER8_VECTOR__
2085 return (vector
bool long long)
2086 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2091 return (vector
bool long long)
2092 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2096vec_cmpne(vector
unsigned long long __a, vector
unsigned long long __b) {
2097 return (vector
bool long long)
2098 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2100#elif defined(__VSX__)
2103 return (vector
bool long long)~(
2104 vec_cmpeq((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));
2114vec_cmpne(vector
unsigned long long __a, vector
unsigned long long __b) {
2115 return (vector
bool long long)~(
2116 vec_cmpeq((vector
signed long long)
__a, (vector
signed long long)
__b));
2123 return (vector
bool long long)
2124 ~(__builtin_altivec_vcmpequd((vector
long long)
__a, (vector
long long)
__b));
2132 return (vector
bool char)__builtin_altivec_vcmpgtsb(
__a,
__b);
2137 return (vector
bool char)__builtin_altivec_vcmpgtub(
__a,
__b);
2142 return (vector
bool short)__builtin_altivec_vcmpgtsh(
__a,
__b);
2147 return (vector
bool short)__builtin_altivec_vcmpgtuh(
__a,
__b);
2152 return (vector
bool int)__builtin_altivec_vcmpgtsw(
__a,
__b);
2157 return (vector
bool int)__builtin_altivec_vcmpgtuw(
__a,
__b);
2160#ifdef __POWER8_VECTOR__
2163 return (vector
bool long long)__builtin_altivec_vcmpgtsd(
__a,
__b);
2167vec_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__)
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,
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,
2193vec_cmpgt(vector
unsigned long long __a, vector
unsigned long long __b) {
2194 vector
unsigned int __ugtw = (vector
unsigned int)
vec_cmpgt(
2195 (vector
unsigned int)
__a, (vector
unsigned int)
__b);
2196 vector
unsigned int __eqw = (vector
unsigned int)
vec_cmpeq(
2197 (vector
signed int)
__a, (vector
signed int)
__b);
2198#ifdef __LITTLE_ENDIAN__
2199 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2201 return (vector
bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3,
2204 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2206 return (vector
bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2,
2215 return (vector
bool int)__builtin_vsx_xvcmpgtsp(
__a,
__b);
2217 return (vector
bool int)__builtin_altivec_vcmpgtfp(
__a,
__b);
2224 return (vector
bool long long)__builtin_vsx_xvcmpgtdp(
__a,
__b);
2228#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2231 return (vector
bool __int128)__builtin_altivec_vcmpgtsq(
__a,
__b);
2235vec_cmpgt(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2236 return (vector
bool __int128)__builtin_altivec_vcmpgtuq(
__a,
__b);
2275 return (vector
bool int)__builtin_vsx_xvcmpgesp(
__a,
__b);
2277 return (vector
bool int)__builtin_altivec_vcmpgefp(
__a,
__b);
2284 return (vector
bool long long)__builtin_vsx_xvcmpgedp(
__a,
__b);
2293vec_cmpge(vector
unsigned long long __a, vector
unsigned long long __b) {
2298#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2305vec_cmpge(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2312static __inline__ vector
bool int __attribute__((__always_inline__))
2313vec_vcmpgefp(vector
float __a, vector
float __b) {
2314 return (vector
bool int)__builtin_altivec_vcmpgefp(
__a,
__b);
2319static __inline__ vector
bool char __attribute__((__always_inline__))
2320vec_vcmpgtsb(vector
signed char __a, vector
signed char __b) {
2321 return (vector
bool char)__builtin_altivec_vcmpgtsb(
__a,
__b);
2326static __inline__ vector
bool char __attribute__((__always_inline__))
2327vec_vcmpgtub(vector
unsigned char __a, vector
unsigned char __b) {
2328 return (vector
bool char)__builtin_altivec_vcmpgtub(
__a,
__b);
2333static __inline__ vector
bool short __attribute__((__always_inline__))
2334vec_vcmpgtsh(vector
short __a, vector
short __b) {
2335 return (vector
bool short)__builtin_altivec_vcmpgtsh(
__a,
__b);
2340static __inline__ vector
bool short __attribute__((__always_inline__))
2341vec_vcmpgtuh(vector
unsigned short __a, vector
unsigned short __b) {
2342 return (vector
bool short)__builtin_altivec_vcmpgtuh(
__a,
__b);
2347static __inline__ vector
bool int __attribute__((__always_inline__))
2348vec_vcmpgtsw(vector
int __a, vector
int __b) {
2349 return (vector
bool int)__builtin_altivec_vcmpgtsw(
__a,
__b);
2354static __inline__ vector
bool int __attribute__((__always_inline__))
2355vec_vcmpgtuw(vector
unsigned int __a, vector
unsigned int __b) {
2356 return (vector
bool int)__builtin_altivec_vcmpgtuw(
__a,
__b);
2361static __inline__ vector
bool int __attribute__((__always_inline__))
2362vec_vcmpgtfp(vector
float __a, vector
float __b) {
2363 return (vector
bool int)__builtin_altivec_vcmpgtfp(
__a,
__b);
2415vec_cmple(vector
unsigned long long __a, vector
unsigned long long __b) {
2420#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2427vec_cmple(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2476#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2483vec_cmplt(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
2495vec_cmplt(vector
unsigned long long __a, vector
unsigned long long __b) {
2500#ifdef __POWER8_VECTOR__
2504vec_popcnt(vector
signed char __a) {
2505 return (vector
unsigned char)__builtin_altivec_vpopcntb(
2506 (vector
unsigned char)
__a);
2509vec_popcnt(vector
unsigned char __a) {
2510 return __builtin_altivec_vpopcntb(
__a);
2513vec_popcnt(vector
signed short __a) {
2514 return (vector
unsigned short)__builtin_altivec_vpopcnth(
2515 (vector
unsigned short)
__a);
2518vec_popcnt(vector
unsigned short __a) {
2519 return __builtin_altivec_vpopcnth(
__a);
2522vec_popcnt(vector
signed int __a) {
2523 return __builtin_altivec_vpopcntw((vector
unsigned int)
__a);
2526vec_popcnt(vector
unsigned int __a) {
2527 return __builtin_altivec_vpopcntw(
__a);
2529static __inline__ vector
unsigned long long __ATTRS_o_ai
2530vec_popcnt(vector
signed long long __a) {
2531 return __builtin_altivec_vpopcntd((vector
unsigned long long)
__a);
2533static __inline__ vector
unsigned long long __ATTRS_o_ai
2534vec_popcnt(vector
unsigned long long __a) {
2535 return __builtin_altivec_vpopcntd(
__a);
2538#define vec_vclz vec_cntlz
2542vec_cntlz(vector
signed char __a) {
2543 return (vector
signed char)__builtin_altivec_vclzb((vector
unsigned char)
__a);
2546vec_cntlz(vector
unsigned char __a) {
2547 return __builtin_altivec_vclzb(
__a);
2550vec_cntlz(vector
signed short __a) {
2551 return (vector
signed short)__builtin_altivec_vclzh(
2552 (vector
unsigned short)
__a);
2555vec_cntlz(vector
unsigned short __a) {
2556 return __builtin_altivec_vclzh(
__a);
2559vec_cntlz(vector
signed int __a) {
2560 return (vector
signed int)__builtin_altivec_vclzw((vector
unsigned int)
__a);
2563vec_cntlz(vector
unsigned int __a) {
2564 return __builtin_altivec_vclzw(
__a);
2567vec_cntlz(vector
signed long long __a) {
2568 return (vector
signed long long)__builtin_altivec_vclzd(
2569 (vector
unsigned long long)
__a);
2571static __inline__ vector
unsigned long long __ATTRS_o_ai
2572vec_cntlz(vector
unsigned long long __a) {
2573 return __builtin_altivec_vclzd(
__a);
2577#ifdef __POWER9_VECTOR__
2582vec_cnttz(vector
signed char __a) {
2583 return (vector
signed char)__builtin_altivec_vctzb((vector
unsigned char)
__a);
2586vec_cnttz(vector
unsigned char __a) {
2587 return __builtin_altivec_vctzb(
__a);
2590vec_cnttz(vector
signed short __a) {
2591 return (vector
signed short)__builtin_altivec_vctzh(
2592 (vector
unsigned short)
__a);
2595vec_cnttz(vector
unsigned short __a) {
2596 return __builtin_altivec_vctzh(
__a);
2599vec_cnttz(vector
signed int __a) {
2600 return (vector
signed int)__builtin_altivec_vctzw((vector
unsigned int)
__a);
2603vec_cnttz(vector
unsigned int __a) {
2604 return __builtin_altivec_vctzw(
__a);
2607vec_cnttz(vector
signed long long __a) {
2608 return (vector
signed long long)__builtin_altivec_vctzd(
2609 (vector
unsigned long long)
__a);
2611static __inline__ vector
unsigned long long __ATTRS_o_ai
2612vec_cnttz(vector
unsigned long long __a) {
2613 return __builtin_altivec_vctzd(
__a);
2619vec_first_match_index(vector
signed char __a, vector
signed char __b) {
2620 vector
unsigned long long __res =
2621#ifdef __LITTLE_ENDIAN__
2626 if (__res[0] == 64) {
2627 return (__res[1] + 64) >> 3;
2629 return __res[0] >> 3;
2633vec_first_match_index(vector
unsigned char __a, vector
unsigned char __b) {
2634 vector
unsigned long long __res =
2635#ifdef __LITTLE_ENDIAN__
2640 if (__res[0] == 64) {
2641 return (__res[1] + 64) >> 3;
2643 return __res[0] >> 3;
2647vec_first_match_index(vector
signed short __a, vector
signed short __b) {
2648 vector
unsigned long long __res =
2649#ifdef __LITTLE_ENDIAN__
2654 if (__res[0] == 64) {
2655 return (__res[1] + 64) >> 4;
2657 return __res[0] >> 4;
2661vec_first_match_index(vector
unsigned short __a, vector
unsigned short __b) {
2662 vector
unsigned long long __res =
2663#ifdef __LITTLE_ENDIAN__
2668 if (__res[0] == 64) {
2669 return (__res[1] + 64) >> 4;
2671 return __res[0] >> 4;
2675vec_first_match_index(vector
signed int __a, vector
signed int __b) {
2676 vector
unsigned long long __res =
2677#ifdef __LITTLE_ENDIAN__
2682 if (__res[0] == 64) {
2683 return (__res[1] + 64) >> 5;
2685 return __res[0] >> 5;
2689vec_first_match_index(vector
unsigned int __a, vector
unsigned int __b) {
2690 vector
unsigned long long __res =
2691#ifdef __LITTLE_ENDIAN__
2696 if (__res[0] == 64) {
2697 return (__res[1] + 64) >> 5;
2699 return __res[0] >> 5;
2705vec_first_match_or_eos_index(vector
signed char __a, vector
signed 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;
2728vec_first_match_or_eos_index(vector
unsigned char __a,
2729 vector
unsigned char __b) {
2731 vector
bool char __tmp2 = __tmp1 |
2735 vector
unsigned long long __res =
2736#ifdef __LITTLE_ENDIAN__
2737 vec_cnttz((vector
unsigned long long)__tmp2);
2739 vec_cntlz((vector
unsigned long long)__tmp2);
2741 if (__res[0] == 64) {
2742 return (__res[1] + 64) >> 3;
2744 return __res[0] >> 3;
2748vec_first_match_or_eos_index(vector
signed short __a, vector
signed 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;
2767vec_first_match_or_eos_index(vector
unsigned short __a,
2768 vector
unsigned short __b) {
2770 vector
bool short __tmp2 = __tmp1 |
2774 vector
unsigned long long __res =
2775#ifdef __LITTLE_ENDIAN__
2776 vec_cnttz((vector
unsigned long long)__tmp2);
2778 vec_cntlz((vector
unsigned long long)__tmp2);
2780 if (__res[0] == 64) {
2781 return (__res[1] + 64) >> 4;
2783 return __res[0] >> 4;
2787vec_first_match_or_eos_index(vector
signed int __a, vector
signed int __b) {
2789 vector
bool int __tmp2 = __tmp1 |
vec_cmpeq((vector
signed int)__tmp1,
__a) |
2792 vector
unsigned long long __res =
2793#ifdef __LITTLE_ENDIAN__
2794 vec_cnttz((vector
unsigned long long)__tmp2);
2796 vec_cntlz((vector
unsigned long long)__tmp2);
2798 if (__res[0] == 64) {
2799 return (__res[1] + 64) >> 5;
2801 return __res[0] >> 5;
2805vec_first_match_or_eos_index(vector
unsigned int __a, vector
unsigned int __b) {
2807 vector
bool int __tmp2 = __tmp1 |
2811 vector
unsigned long long __res =
2812#ifdef __LITTLE_ENDIAN__
2813 vec_cnttz((vector
unsigned long long)__tmp2);
2815 vec_cntlz((vector
unsigned long long)__tmp2);
2817 if (__res[0] == 64) {
2818 return (__res[1] + 64) >> 5;
2820 return __res[0] >> 5;
2826vec_first_mismatch_index(vector
signed char __a, vector
signed char __b) {
2827 vector
unsigned long long __res =
2828#ifdef __LITTLE_ENDIAN__
2833 if (__res[0] == 64) {
2834 return (__res[1] + 64) >> 3;
2836 return __res[0] >> 3;
2840vec_first_mismatch_index(vector
unsigned char __a, vector
unsigned char __b) {
2841 vector
unsigned long long __res =
2842#ifdef __LITTLE_ENDIAN__
2847 if (__res[0] == 64) {
2848 return (__res[1] + 64) >> 3;
2850 return __res[0] >> 3;
2854vec_first_mismatch_index(vector
signed short __a, vector
signed short __b) {
2855 vector
unsigned long long __res =
2856#ifdef __LITTLE_ENDIAN__
2861 if (__res[0] == 64) {
2862 return (__res[1] + 64) >> 4;
2864 return __res[0] >> 4;
2868vec_first_mismatch_index(vector
unsigned short __a, vector
unsigned short __b) {
2869 vector
unsigned long long __res =
2870#ifdef __LITTLE_ENDIAN__
2875 if (__res[0] == 64) {
2876 return (__res[1] + 64) >> 4;
2878 return __res[0] >> 4;
2882vec_first_mismatch_index(vector
signed int __a, vector
signed int __b) {
2883 vector
unsigned long long __res =
2884#ifdef __LITTLE_ENDIAN__
2889 if (__res[0] == 64) {
2890 return (__res[1] + 64) >> 5;
2892 return __res[0] >> 5;
2896vec_first_mismatch_index(vector
unsigned int __a, vector
unsigned int __b) {
2897 vector
unsigned long long __res =
2898#ifdef __LITTLE_ENDIAN__
2903 if (__res[0] == 64) {
2904 return (__res[1] + 64) >> 5;
2906 return __res[0] >> 5;
2912vec_first_mismatch_or_eos_index(vector
signed char __a,
2913 vector
signed char __b) {
2914 vector
unsigned long long __res =
2915#ifdef __LITTLE_ENDIAN__
2916 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2918 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2920 if (__res[0] == 64) {
2921 return (__res[1] + 64) >> 3;
2923 return __res[0] >> 3;
2927vec_first_mismatch_or_eos_index(vector
unsigned char __a,
2928 vector
unsigned char __b) {
2929 vector
unsigned long long __res =
2930#ifdef __LITTLE_ENDIAN__
2931 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2933 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2935 if (__res[0] == 64) {
2936 return (__res[1] + 64) >> 3;
2938 return __res[0] >> 3;
2942vec_first_mismatch_or_eos_index(vector
signed short __a,
2943 vector
signed short __b) {
2944 vector
unsigned long long __res =
2945#ifdef __LITTLE_ENDIAN__
2946 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2948 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2950 if (__res[0] == 64) {
2951 return (__res[1] + 64) >> 4;
2953 return __res[0] >> 4;
2957vec_first_mismatch_or_eos_index(vector
unsigned short __a,
2958 vector
unsigned short __b) {
2959 vector
unsigned long long __res =
2960#ifdef __LITTLE_ENDIAN__
2961 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2963 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2965 if (__res[0] == 64) {
2966 return (__res[1] + 64) >> 4;
2968 return __res[0] >> 4;
2972vec_first_mismatch_or_eos_index(vector
signed int __a, vector
signed int __b) {
2973 vector
unsigned long long __res =
2974#ifdef __LITTLE_ENDIAN__
2975 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2977 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2979 if (__res[0] == 64) {
2980 return (__res[1] + 64) >> 5;
2982 return __res[0] >> 5;
2986vec_first_mismatch_or_eos_index(vector
unsigned int __a,
2987 vector
unsigned int __b) {
2988 vector
unsigned long long __res =
2989#ifdef __LITTLE_ENDIAN__
2990 vec_cnttz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2992 vec_cntlz((vector
unsigned long long)vec_cmpnez(
__a,
__b));
2994 if (__res[0] == 64) {
2995 return (__res[1] + 64) >> 5;
2997 return __res[0] >> 5;
3001vec_insert_exp(vector
double __a, vector
unsigned long long __b) {
3002 return __builtin_vsx_xviexpdp((vector
unsigned long long)
__a,
__b);
3006vec_insert_exp(vector
unsigned long long __a, vector
unsigned long long __b) {
3007 return __builtin_vsx_xviexpdp(
__a,
__b);
3011vec_insert_exp(vector
float __a, vector
unsigned int __b) {
3012 return __builtin_vsx_xviexpsp((vector
unsigned int)
__a,
__b);
3016vec_insert_exp(vector
unsigned int __a, vector
unsigned int __b) {
3017 return __builtin_vsx_xviexpsp(
__a,
__b);
3020#if defined(__powerpc64__)
3021static __inline__ vector
signed char __ATTRS_o_ai vec_xl_len(
const signed char *
__a,
3023 return (vector
signed char)__builtin_vsx_lxvl(
__a, (
__b << 56));
3027vec_xl_len(
const unsigned char *
__a,
size_t __b) {
3028 return (vector
unsigned char)__builtin_vsx_lxvl(
__a, (
__b << 56));
3031static __inline__ vector
signed short __ATTRS_o_ai vec_xl_len(
const signed short *
__a,
3033 return (vector
signed short)__builtin_vsx_lxvl(
__a, (
__b << 56));
3037vec_xl_len(
const unsigned short *
__a,
size_t __b) {
3038 return (vector
unsigned short)__builtin_vsx_lxvl(
__a, (
__b << 56));
3041static __inline__ vector
signed int __ATTRS_o_ai vec_xl_len(
const signed int *
__a,
3043 return (vector
signed int)__builtin_vsx_lxvl(
__a, (
__b << 56));
3046static __inline__ vector
unsigned int __ATTRS_o_ai vec_xl_len(
const unsigned int *
__a,
3048 return (vector
unsigned int)__builtin_vsx_lxvl(
__a, (
__b << 56));
3051static __inline__ vector
float __ATTRS_o_ai vec_xl_len(
const float *
__a,
size_t __b) {
3052 return (vector
float)__builtin_vsx_lxvl(
__a, (
__b << 56));
3055#ifdef __SIZEOF_INT128__
3057vec_xl_len(
const signed __int128 *
__a,
size_t __b) {
3058 return (vector
signed __int128)__builtin_vsx_lxvl(
__a, (
__b << 56));
3062vec_xl_len(
const unsigned __int128 *
__a,
size_t __b) {
3063 return (vector
unsigned __int128)__builtin_vsx_lxvl(
__a, (
__b << 56));
3068vec_xl_len(
const signed long long *
__a,
size_t __b) {
3069 return (vector
signed long long)__builtin_vsx_lxvl(
__a, (
__b << 56));
3072static __inline__ vector
unsigned long long __ATTRS_o_ai
3073vec_xl_len(
const unsigned long long *
__a,
size_t __b) {
3074 return (vector
unsigned long long)__builtin_vsx_lxvl(
__a, (
__b << 56));
3077static __inline__ vector
double __ATTRS_o_ai vec_xl_len(
const double *
__a,
3079 return (vector
double)__builtin_vsx_lxvl(
__a, (
__b << 56));
3083vec_xl_len_r(
const unsigned char *
__a,
size_t __b) {
3084 vector
unsigned char __res =
3085 (vector
unsigned char)__builtin_vsx_lxvll(
__a, (
__b << 56));
3086 vector
unsigned char __mask =
3087 (vector
unsigned char)__builtin_altivec_lvsr(16 -
__b, (
int *)
NULL);
3088 return (vector
unsigned char)__builtin_altivec_vperm_4si(
3089 (vector
int)__res, (vector
int)__res, __mask);
3093static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned char __a,
3096 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3099static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed char __a,
3100 signed char *
__b,
size_t __c) {
3101 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3104static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed short __a,
3105 signed short *
__b,
size_t __c) {
3106 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3109static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned short __a,
3110 unsigned short *
__b,
3112 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3116 signed int *
__b,
size_t __c) {
3117 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3120static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned int __a,
3121 unsigned int *
__b,
size_t __c) {
3122 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3127 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3130#ifdef __SIZEOF_INT128__
3131static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed __int128
__a,
3132 signed __int128 *
__b,
3134 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3137static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned __int128
__a,
3138 unsigned __int128 *
__b,
3140 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3144static __inline__
void __ATTRS_o_ai vec_xst_len(vector
signed long long __a,
3145 signed long long *
__b,
3147 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3150static __inline__
void __ATTRS_o_ai vec_xst_len(vector
unsigned long long __a,
3151 unsigned long long *
__b,
3153 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3158 return __builtin_vsx_stxvl((vector
int)
__a,
__b, (
__c << 56));
3161static __inline__
void __ATTRS_o_ai vec_xst_len_r(vector
unsigned char __a,
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));
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))
3179#define __vec_ldrmb __builtin_vsx_ldrmb
3180#define __vec_strmb __builtin_vsx_strmb
3186static __inline__ vector
float __ATTRS_o_ai vec_cpsgn(vector
float __a,
3188 return __builtin_vsx_xvcpsgnsp(
__b,
__a);
3191static __inline__ vector
double __ATTRS_o_ai vec_cpsgn(vector
double __a,
3192 vector
double __b) {
3193 return __builtin_vsx_xvcpsgndp(
__b,
__a);
3203#ifdef __XL_COMPAT_ALTIVEC__
3204#define vec_ctf(__a, __b) \
3207 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3208 vector unsigned int \
3209 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
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)))
3220#define vec_ctf(__a, __b) \
3223 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \
3224 vector unsigned int \
3225 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
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 - \
3233 vector signed long long \
3234 : (vector float)(__builtin_convertvector((vector signed long long)(__a), \
3236 (vector double)(vector unsigned long long)((0x3ffULL - \
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), \
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)) \
3256 vector unsigned int \
3257 : (vec_doublee((vector unsigned int)(__a)) * \
3258 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3260 vector unsigned long long \
3261 : (__builtin_convertvector((vector unsigned long long)(__a), \
3263 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3265 vector signed long long \
3266 : (__builtin_convertvector((vector signed long long)(__a), \
3268 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
3274#define vec_vcfux __builtin_altivec_vcfux
3277#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
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), \
3289 vector double __ret = \
3290 (vector double)(__a) * \
3291 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3293 (vector signed long long)__builtin_vsx_xvcvdpsxws(__ret); \
3296#define vec_cts(__a, __b) \
3297 _Generic((__a), vector float \
3298 : (vector signed int)__builtin_altivec_vctsxs((vector float)(__a), \
3302 vector double __ret = \
3303 (vector double)(__a) * \
3304 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
3306 (vector signed long long)__builtin_convertvector( \
3307 __ret, vector signed long long); \
3311#define vec_cts __builtin_altivec_vctsxs
3316#define vec_vctsxs __builtin_altivec_vctsxs
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)), \
3328 vector double __ret = \
3329 (vector double)(__a) * \
3330 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3332 (vector unsigned long long)__builtin_vsx_xvcvdpuxws(__ret); \
3335#define vec_ctu(__a, __b) \
3336 _Generic((__a), vector float \
3337 : (vector unsigned int)__builtin_altivec_vctuxs( \
3338 (vector float)(__a), (__b)), \
3341 vector double __ret = \
3342 (vector double)(__a) * \
3343 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3345 (vector unsigned long long)__builtin_convertvector( \
3346 __ret, vector unsigned long long); \
3350#define vec_ctu __builtin_altivec_vctuxs
3353#ifdef __LITTLE_ENDIAN__
3357#define vec_ctsl(__a, __b) \
3358 _Generic((__a), vector float \
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)); \
3368 vector double __ret = \
3369 (vector double)(__a) * \
3370 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3372 __builtin_convertvector(__ret, vector signed long long); \
3377#define vec_ctul(__a, __b) \
3378 _Generic((__a), vector float \
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)); \
3388 vector double __ret = \
3389 (vector double)(__a) * \
3390 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3392 __builtin_convertvector(__ret, vector unsigned long long); \
3399#define vec_ctsl(__a, __b) \
3400 _Generic((__a), vector float \
3402 vector float __ret = \
3403 (vector float)(__a) * \
3404 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3405 __builtin_vsx_xvcvspsxds(__ret); \
3409 vector double __ret = \
3410 (vector double)(__a) * \
3411 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3413 __builtin_convertvector(__ret, vector signed long long); \
3418#define vec_ctul(__a, __b) \
3419 _Generic((__a), vector float \
3421 vector float __ret = \
3422 (vector float)(__a) * \
3423 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \
3424 __builtin_vsx_xvcvspuxds(__ret); \
3428 vector double __ret = \
3429 (vector double)(__a) * \
3430 (vector double)(vector unsigned long long)((0x3ffULL + __b) \
3432 __builtin_convertvector(__ret, vector unsigned long long); \
3439#define vec_vctuxs __builtin_altivec_vctuxs
3443#ifdef __POWER9_VECTOR__
3445vec_signexti(vector
signed char __a) {
3446 return __builtin_altivec_vextsb2w(
__a);
3450vec_signexti(vector
signed short __a) {
3451 return __builtin_altivec_vextsh2w(
__a);
3455vec_signextll(vector
signed char __a) {
3456 return __builtin_altivec_vextsb2d(
__a);
3460vec_signextll(vector
signed short __a) {
3461 return __builtin_altivec_vextsh2d(
__a);
3465vec_signextll(vector
signed int __a) {
3466 return __builtin_altivec_vextsw2d(
__a);
3470#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3472vec_signextq(vector
signed long long __a) {
3473 return __builtin_altivec_vextsd2q(
__a);
3480vec_sld(vector
signed int, vector
signed int,
unsigned const int __c);
3484 return __builtin_convertvector(
__a, vector
signed int);
3490 return __builtin_convertvector(
__a, vector
signed long long);
3493static __inline__ vector
signed int __attribute__((__always_inline__))
3494vec_signed2(vector
double __a, vector
double __b) {
3495 return (vector
signed int) {
__a[0],
__a[1],
__b[0],
__b[1] };
3499vec_signede(vector
double __a) {
3500#ifdef __LITTLE_ENDIAN__
3501 vector
signed int __ret = __builtin_vsx_xvcvdpsxws(
__a);
3502 return vec_sld(__ret, __ret, 12);
3504 return __builtin_vsx_xvcvdpsxws(
__a);
3509vec_signedo(vector
double __a) {
3510#ifdef __LITTLE_ENDIAN__
3511 return __builtin_vsx_xvcvdpsxws(
__a);
3513 vector
signed int __ret = __builtin_vsx_xvcvdpsxws(
__a);
3514 return vec_sld(__ret, __ret, 12);
3522vec_sld(vector
unsigned int, vector
unsigned int,
unsigned const int __c);
3526 return __builtin_convertvector(
__a, vector
unsigned int);
3530static __inline__ vector
unsigned long long __ATTRS_o_ai
3532 return __builtin_convertvector(
__a, vector
unsigned long long);
3535static __inline__ vector
unsigned int __attribute__((__always_inline__))
3536vec_unsigned2(vector
double __a, vector
double __b) {
3537 return (vector
unsigned int) {
__a[0],
__a[1],
__b[0],
__b[1] };
3541vec_unsignede(vector
double __a) {
3542#ifdef __LITTLE_ENDIAN__
3543 vector
unsigned int __ret = __builtin_vsx_xvcvdpuxws(
__a);
3544 return vec_sld(__ret, __ret, 12);
3546 return __builtin_vsx_xvcvdpuxws(
__a);
3551vec_unsignedo(vector
double __a) {
3552#ifdef __LITTLE_ENDIAN__
3553 return __builtin_vsx_xvcvdpuxws(
__a);
3555 vector
unsigned int __ret = __builtin_vsx_xvcvdpuxws(
__a);
3556 return vec_sld(__ret, __ret, 12);
3564vec_sld(vector
float, vector
float,
unsigned const int __c);
3568 return __builtin_convertvector(
__a, vector
float);
3573 return __builtin_convertvector(
__a, vector
float);
3578vec_float2(vector
signed long long __a, vector
signed long long __b) {
3579 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3583vec_float2(vector
unsigned long long __a, vector
unsigned long long __b) {
3584 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3588vec_float2(vector
double __a, vector
double __b) {
3589 return (vector
float) {
__a[0],
__a[1],
__b[0],
__b[1] };
3593vec_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);
3598 return __builtin_vsx_xvcvsxdsp(
__a);
3603vec_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);
3608 return __builtin_vsx_xvcvuxdsp(
__a);
3613vec_floate(vector
double __a) {
3614#ifdef __LITTLE_ENDIAN__
3615 vector
float __ret = __builtin_vsx_xvcvdpsp(
__a);
3616 return vec_sld(__ret, __ret, 12);
3618 return __builtin_vsx_xvcvdpsp(
__a);
3623vec_floato(vector
signed long long __a) {
3624#ifdef __LITTLE_ENDIAN__
3625 return __builtin_vsx_xvcvsxdsp(
__a);
3627 vector
float __ret = __builtin_vsx_xvcvsxdsp(
__a);
3628 return vec_sld(__ret, __ret, 12);
3633vec_floato(vector
unsigned long long __a) {
3634#ifdef __LITTLE_ENDIAN__
3635 return __builtin_vsx_xvcvuxdsp(
__a);
3637 vector
float __ret = __builtin_vsx_xvcvuxdsp(
__a);
3638 return vec_sld(__ret, __ret, 12);
3643vec_floato(vector
double __a) {
3644#ifdef __LITTLE_ENDIAN__
3645 return __builtin_vsx_xvcvdpsp(
__a);
3647 vector
float __ret = __builtin_vsx_xvcvdpsp(
__a);
3648 return vec_sld(__ret, __ret, 12);
3657vec_double(vector
signed long long __a) {
3658 return __builtin_convertvector(
__a, vector
double);
3662vec_double(vector
unsigned long long __a) {
3663 return __builtin_convertvector(
__a, vector
double);
3667vec_doublee(vector
signed int __a) {
3668#ifdef __LITTLE_ENDIAN__
3671 return __builtin_vsx_xvcvsxwdp(
__a);
3676vec_doublee(vector
unsigned int __a) {
3677#ifdef __LITTLE_ENDIAN__
3680 return __builtin_vsx_xvcvuxwdp(
__a);
3685vec_doublee(vector
float __a) {
3686#ifdef __LITTLE_ENDIAN__
3689 return __builtin_vsx_xvcvspdp(
__a);
3694vec_doubleh(vector
signed int __a) {
3695 vector
double __ret = {
__a[0],
__a[1]};
3700vec_doubleh(vector
unsigned int __a) {
3701 vector
double __ret = {
__a[0],
__a[1]};
3706vec_doubleh(vector
float __a) {
3707 vector
double __ret = {
__a[0],
__a[1]};
3712vec_doublel(vector
signed int __a) {
3713 vector
double __ret = {
__a[2],
__a[3]};
3718vec_doublel(vector
unsigned int __a) {
3719 vector
double __ret = {
__a[2],
__a[3]};
3724vec_doublel(vector
float __a) {
3725 vector
double __ret = {
__a[2],
__a[3]};
3730vec_doubleo(vector
signed int __a) {
3731#ifdef __LITTLE_ENDIAN__
3732 return __builtin_vsx_xvcvsxwdp(
__a);
3739vec_doubleo(vector
unsigned int __a) {
3740#ifdef __LITTLE_ENDIAN__
3741 return __builtin_vsx_xvcvuxwdp(
__a);
3748vec_doubleo(vector
float __a) {
3749#ifdef __LITTLE_ENDIAN__
3750 return __builtin_vsx_xvcvspdp(
__a);
3757static __inline__ vector
double __ATTRS_o_ai vec_cvf(vector
float __a) {
3758 return vec_doublee(
__a);
3761static __inline__ vector
float __ATTRS_o_ai vec_cvf(vector
double __a) {
3762 return vec_floate(
__a);
3803vec_div(vector
signed long long __a, vector
signed long long __b) {
3807static __inline__ vector
unsigned long long __ATTRS_o_ai
3808vec_div(vector
unsigned long long __a, vector
unsigned long long __b) {
3818 vector
double __b) {
3825#ifdef __POWER10_VECTOR__
3827vec_dive(vector
signed int __a, vector
signed int __b) {
3828 return __builtin_altivec_vdivesw(
__a,
__b);
3832vec_dive(vector
unsigned int __a, vector
unsigned int __b) {
3833 return __builtin_altivec_vdiveuw(
__a,
__b);
3837vec_dive(vector
signed long long __a, vector
signed long long __b) {
3838 return __builtin_altivec_vdivesd(
__a,
__b);
3841static __inline__ vector
unsigned long long __ATTRS_o_ai
3842vec_dive(vector
unsigned long long __a, vector
unsigned long long __b) {
3843 return __builtin_altivec_vdiveud(
__a,
__b);
3846#ifdef __SIZEOF_INT128__
3848vec_dive(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
3849 return __builtin_altivec_vdiveuq(
__a,
__b);
3853vec_dive(vector
signed __int128
__a, vector
signed __int128
__b) {
3854 return __builtin_altivec_vdivesq(
__a,
__b);
3859#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3861vec_div(vector
unsigned __int128
__a, vector
unsigned __int128
__b) {
3866vec_div(vector
signed __int128
__a, vector
signed __int128
__b) {
3875 vector
double __b) {
3876 return __builtin_vsx_xvtdivdp(
__a,
__b);
3881 return __builtin_vsx_xvtdivsp(
__a,
__b);
3887#define vec_dss __builtin_altivec_dss
3891static __inline__
void __attribute__((__always_inline__)) vec_dssall(
void) {
3892 __builtin_altivec_dssall();
3896#define vec_dst(__PTR, __CW, __STR) \
3897 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3900#define vec_dstst(__PTR, __CW, __STR) \
3901 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3904#define vec_dststt(__PTR, __CW, __STR) \
3905 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3908#define vec_dstt(__PTR, __CW, __STR) \
3909 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3913#ifdef __POWER8_VECTOR__
3915vec_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);
3921vec_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);
3926static __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);
3933vec_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);
3939vec_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);
3945vec_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);
3951vec_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);
3957vec_eqv(vector
unsigned int __a, vector
unsigned int __b) {
3958 return __builtin_vsx_xxleqv(
__a,
__b);
3961static __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);
3968vec_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);
3973static __inline__ vector
unsigned long long __ATTRS_o_ai
3974vec_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);
3980vec_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);
3987 return (vector
float)__builtin_vsx_xxleqv((vector
unsigned int)
__a,
3988 (vector
unsigned int)
__b);
3991static __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);
4000static __inline__ vector
float __attribute__((__always_inline__))
4001vec_expte(vector
float __a) {
4002 return __builtin_altivec_vexptefp(
__a);
4007static __inline__ vector
float __attribute__((__always_inline__))
4008vec_vexptefp(vector
float __a) {
4009 return __builtin_altivec_vexptefp(
__a);
4016 return __builtin_vsx_xvrspim(
__a);
4018 return __builtin_altivec_vrfim(
__a);
4024 return __builtin_vsx_xvrdpim(
__a);
4041static __inline__ vector
float __attribute__((__always_inline__))
4042vec_vrfim(vector
float __a) {
4043 return __builtin_altivec_vrfim(
__a);
4050 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4055 return (vector
signed char)__builtin_altivec_lvx(
__a,
__b);
4060 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4065 return (vector
unsigned char)__builtin_altivec_lvx(
__a,
__b);
4070 return (vector
bool char)__builtin_altivec_lvx(
__a,
__b);
4074 const vector
short *
__b) {
4075 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4079 return (vector
short)__builtin_altivec_lvx(
__a,
__b);
4084 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);
4089 return (vector
unsigned short)__builtin_altivec_lvx(
__a,
__b);