| /*===---- altivec.h - Standard header for type generic math ---------------===*\ |
| * |
| * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| * See https://llvm.org/LICENSE.txt for license information. |
| * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| * |
| \*===----------------------------------------------------------------------===*/ |
| |
| #ifndef __ALTIVEC_H |
| #define __ALTIVEC_H |
| |
| #ifndef __ALTIVEC__ |
| #error "AltiVec support not enabled" |
| #endif |
| |
| /* Constants for mapping CR6 bits to predicate result. */ |
| |
| #define __CR6_EQ 0 |
| #define __CR6_EQ_REV 1 |
| #define __CR6_LT 2 |
| #define __CR6_LT_REV 3 |
| #define __CR6_GT 4 |
| #define __CR6_GT_REV 5 |
| #define __CR6_SO 6 |
| #define __CR6_SO_REV 7 |
| |
| /* Constants for vec_test_data_class */ |
| #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) |
| #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) |
| #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ |
| __VEC_CLASS_FP_SUBNORMAL_N) |
| #define __VEC_CLASS_FP_ZERO_N (1<<2) |
| #define __VEC_CLASS_FP_ZERO_P (1<<3) |
| #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ |
| __VEC_CLASS_FP_ZERO_N) |
| #define __VEC_CLASS_FP_INFINITY_N (1<<4) |
| #define __VEC_CLASS_FP_INFINITY_P (1<<5) |
| #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ |
| __VEC_CLASS_FP_INFINITY_N) |
| #define __VEC_CLASS_FP_NAN (1<<6) |
| #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ |
| __VEC_CLASS_FP_SUBNORMAL | \ |
| __VEC_CLASS_FP_ZERO | \ |
| __VEC_CLASS_FP_INFINITY) |
| |
| #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) |
| |
| #include <stddef.h> |
| |
| static __inline__ vector signed char __ATTRS_o_ai vec_perm( |
| vector signed char __a, vector signed char __b, vector unsigned char __c); |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_perm(vector unsigned char __a, vector unsigned char __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); |
| |
| static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, |
| vector signed short __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_perm(vector unsigned short __a, vector unsigned short __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector bool short __ATTRS_o_ai vec_perm( |
| vector bool short __a, vector bool short __b, vector unsigned char __c); |
| |
| static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, |
| vector pixel __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, |
| vector signed int __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( |
| vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); |
| |
| static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, |
| vector float __b, |
| vector unsigned char __c); |
| |
| #ifdef __VSX__ |
| static __inline__ vector long long __ATTRS_o_ai |
| vec_perm(vector signed long long __a, vector signed long long __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_perm(vector unsigned long long __a, vector unsigned long long __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_perm(vector bool long long __a, vector bool long long __b, |
| vector unsigned char __c); |
| |
| static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, |
| vector double __b, |
| vector unsigned char __c); |
| #endif |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_xor(vector unsigned char __a, vector unsigned char __b); |
| |
| /* vec_abs */ |
| |
| #define __builtin_altivec_abs_v16qi vec_abs |
| #define __builtin_altivec_abs_v8hi vec_abs |
| #define __builtin_altivec_abs_v4si vec_abs |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_abs(vector signed char __a) { |
| return __builtin_altivec_vmaxsb(__a, -__a); |
| } |
| |
| static __inline__ vector signed short __ATTRS_o_ai |
| vec_abs(vector signed short __a) { |
| return __builtin_altivec_vmaxsh(__a, -__a); |
| } |
| |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_abs(vector signed int __a) { |
| return __builtin_altivec_vmaxsw(__a, -__a); |
| } |
| |
| #ifdef __POWER8_VECTOR__ |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_abs(vector signed long long __a) { |
| return __builtin_altivec_vmaxsd(__a, -__a); |
| } |
| #endif |
| |
| static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { |
| #ifdef __VSX__ |
| return __builtin_vsx_xvabssp(__a); |
| #else |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); |
| return (vector float)__res; |
| #endif |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { |
| return __builtin_vsx_xvabsdp(__a); |
| } |
| #endif |
| |
| /* vec_abss */ |
| #define __builtin_altivec_abss_v16qi vec_abss |
| #define __builtin_altivec_abss_v8hi vec_abss |
| #define __builtin_altivec_abss_v4si vec_abss |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_abss(vector signed char __a) { |
| return __builtin_altivec_vmaxsb( |
| __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); |
| } |
| |
| static __inline__ vector signed short __ATTRS_o_ai |
| vec_abss(vector signed short __a) { |
| return __builtin_altivec_vmaxsh( |
| __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); |
| } |
| |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_abss(vector signed int __a) { |
| return __builtin_altivec_vmaxsw( |
| __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); |
| } |
| |
| /* vec_absd */ |
| #if defined(__POWER9_VECTOR__) |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_absd(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vabsdub(__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_absd(vector unsigned short __a, vector unsigned short __b) { |
| return __builtin_altivec_vabsduh(__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_absd(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vabsduw(__a, __b); |
| } |
| |
| #endif /* End __POWER9_VECTOR__ */ |
| |
| /* vec_add */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_add(vector signed char __a, vector signed char __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_add(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a + __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_add(vector signed char __a, vector bool char __b) { |
| return __a + (vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_add(vector unsigned char __a, vector unsigned char __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_add(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a + __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_add(vector unsigned char __a, vector bool char __b) { |
| return __a + (vector unsigned char)__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, |
| vector short __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a + __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, |
| vector bool short __b) { |
| return __a + (vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_add(vector unsigned short __a, vector unsigned short __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_add(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a + __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_add(vector unsigned short __a, vector bool short __b) { |
| return __a + (vector unsigned short)__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, |
| vector int __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a + __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, |
| vector bool int __b) { |
| return __a + (vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_add(vector unsigned int __a, vector unsigned int __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_add(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a + __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_add(vector unsigned int __a, vector bool int __b) { |
| return __a + (vector unsigned int)__b; |
| } |
| |
| #ifdef __POWER8_VECTOR__ |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_add(vector signed long long __a, vector signed long long __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_add(vector unsigned long long __a, vector unsigned long long __b) { |
| return __a + __b; |
| } |
| |
| #ifdef __SIZEOF_INT128__ |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_add(vector signed __int128 __a, vector signed __int128 __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return __a + __b; |
| } |
| #endif |
| |
| static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| vec_add_u128(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vadduqm(__a, __b); |
| } |
| #elif defined(__VSX__) |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_add(vector signed long long __a, vector signed long long __b) { |
| #ifdef __LITTLE_ENDIAN__ |
| // Little endian systems on CPU's prior to Power8 don't really exist |
| // so scalarizing is fine. |
| return __a + __b; |
| #else |
| vector unsigned int __res = |
| (vector unsigned int)__a + (vector unsigned int)__b; |
| vector unsigned int __carry = __builtin_altivec_vaddcuw( |
| (vector unsigned int)__a, (vector unsigned int)__b); |
| __carry = __builtin_shufflevector((vector unsigned char)__carry, |
| (vector unsigned char)__carry, 0, 0, 0, 7, |
| 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); |
| return (vector signed long long)(__res + __carry); |
| #endif |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_add(vector unsigned long long __a, vector unsigned long long __b) { |
| return (vector unsigned long long)vec_add((vector signed long long)__a, |
| (vector signed long long)__b); |
| } |
| #endif // __POWER8_VECTOR__ |
| |
| static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, |
| vector float __b) { |
| return __a + __b; |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, |
| vector double __b) { |
| return __a + __b; |
| } |
| #endif // __VSX__ |
| |
| /* vec_adde */ |
| |
| #ifdef __POWER8_VECTOR__ |
| #ifdef __SIZEOF_INT128__ |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_adde(vector signed __int128 __a, vector signed __int128 __b, |
| vector signed __int128 __c) { |
| return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| vector unsigned __int128 __c) { |
| return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| } |
| #endif |
| |
| static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| vec_adde_u128(vector unsigned char __a, vector unsigned char __b, |
| vector unsigned char __c) { |
| return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); |
| } |
| #endif |
| |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_adde(vector signed int __a, vector signed int __b, |
| vector signed int __c) { |
| vector signed int __mask = {1, 1, 1, 1}; |
| vector signed int __carry = __c & __mask; |
| return vec_add(vec_add(__a, __b), __carry); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_adde(vector unsigned int __a, vector unsigned int __b, |
| vector unsigned int __c) { |
| vector unsigned int __mask = {1, 1, 1, 1}; |
| vector unsigned int __carry = __c & __mask; |
| return vec_add(vec_add(__a, __b), __carry); |
| } |
| |
| /* vec_addec */ |
| |
| #ifdef __POWER8_VECTOR__ |
| #ifdef __SIZEOF_INT128__ |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_addec(vector signed __int128 __a, vector signed __int128 __b, |
| vector signed __int128 __c) { |
| return __builtin_altivec_vaddecuq(__a, __b, __c); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| vector unsigned __int128 __c) { |
| return __builtin_altivec_vaddecuq(__a, __b, __c); |
| } |
| #endif |
| |
| static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| vec_addec_u128(vector unsigned char __a, vector unsigned char __b, |
| vector unsigned char __c) { |
| return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); |
| } |
| |
| #ifdef __powerpc64__ |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_addec(vector signed int __a, vector signed int __b, |
| vector signed int __c) { |
| |
| signed int __result[4]; |
| for (int i = 0; i < 4; i++) { |
| unsigned int __tempa = (unsigned int) __a[i]; |
| unsigned int __tempb = (unsigned int) __b[i]; |
| unsigned int __tempc = (unsigned int) __c[i]; |
| __tempc = __tempc & 0x00000001; |
| unsigned long long __longa = (unsigned long long) __tempa; |
| unsigned long long __longb = (unsigned long long) __tempb; |
| unsigned long long __longc = (unsigned long long) __tempc; |
| unsigned long long __sum = __longa + __longb + __longc; |
| unsigned long long __res = (__sum >> 32) & 0x01; |
| unsigned long long __tempres = (unsigned int) __res; |
| __result[i] = (signed int) __tempres; |
| } |
| |
| vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; |
| return ret; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_addec(vector unsigned int __a, vector unsigned int __b, |
| vector unsigned int __c) { |
| |
| unsigned int __result[4]; |
| for (int i = 0; i < 4; i++) { |
| unsigned int __tempc = __c[i] & 1; |
| unsigned long long __longa = (unsigned long long) __a[i]; |
| unsigned long long __longb = (unsigned long long) __b[i]; |
| unsigned long long __longc = (unsigned long long) __tempc; |
| unsigned long long __sum = __longa + __longb + __longc; |
| unsigned long long __res = (__sum >> 32) & 0x01; |
| unsigned long long __tempres = (unsigned int) __res; |
| __result[i] = (signed int) __tempres; |
| } |
| |
| vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; |
| return ret; |
| } |
| #endif // __powerpc64__ |
| #endif // __POWER8_VECTOR__ |
| |
| /* vec_vaddubm */ |
| |
| #define __builtin_altivec_vaddubm vec_vaddubm |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddubm(vector signed char __a, vector signed char __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddubm(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a + __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddubm(vector signed char __a, vector bool char __b) { |
| return __a + (vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubm(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a + __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubm(vector unsigned char __a, vector bool char __b) { |
| return __a + (vector unsigned char)__b; |
| } |
| |
| /* vec_vadduhm */ |
| |
| #define __builtin_altivec_vadduhm vec_vadduhm |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, |
| vector short __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a + __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, |
| vector bool short __b) { |
| return __a + (vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhm(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a + __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhm(vector unsigned short __a, vector bool short __b) { |
| return __a + (vector unsigned short)__b; |
| } |
| |
| /* vec_vadduwm */ |
| |
| #define __builtin_altivec_vadduwm vec_vadduwm |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, |
| vector int __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a + __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, |
| vector bool int __b) { |
| return __a + (vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduwm(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a + __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduwm(vector unsigned int __a, vector bool int __b) { |
| return __a + (vector unsigned int)__b; |
| } |
| |
| /* vec_vaddfp */ |
| |
| #define __builtin_altivec_vaddfp vec_vaddfp |
| |
| static __inline__ vector float __attribute__((__always_inline__)) |
| vec_vaddfp(vector float __a, vector float __b) { |
| return __a + __b; |
| } |
| |
| /* vec_addc */ |
| |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_addc(vector signed int __a, vector signed int __b) { |
| return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, |
| (vector unsigned int)__b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_addc(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vaddcuw(__a, __b); |
| } |
| |
| #ifdef __POWER8_VECTOR__ |
| #ifdef __SIZEOF_INT128__ |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_addc(vector signed __int128 __a, vector signed __int128 __b) { |
| return (vector signed __int128)__builtin_altivec_vaddcuq( |
| (vector unsigned __int128)__a, (vector unsigned __int128)__b); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return __builtin_altivec_vaddcuq(__a, __b); |
| } |
| #endif |
| |
| static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { |
| return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); |
| } |
| #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) |
| |
| /* vec_vaddcuw */ |
| |
| static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vaddcuw(__a, __b); |
| } |
| |
| /* vec_adds */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_adds(vector signed char __a, vector signed char __b) { |
| return __builtin_altivec_vaddsbs(__a, __b); |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_adds(vector bool char __a, vector signed char __b) { |
| return __builtin_altivec_vaddsbs((vector signed char)__a, __b); |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_adds(vector signed char __a, vector bool char __b) { |
| return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_adds(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vaddubs(__a, __b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_adds(vector bool char __a, vector unsigned char __b) { |
| return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_adds(vector unsigned char __a, vector bool char __b) { |
| return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, |
| vector short __b) { |
| return __builtin_altivec_vaddshs(__a, __b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, |
| vector short __b) { |
| return __builtin_altivec_vaddshs((vector short)__a, __b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, |
| vector bool short __b) { |
| return __builtin_altivec_vaddshs(__a, (vector short)__b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_adds(vector unsigned short __a, vector unsigned short __b) { |
| return __builtin_altivec_vadduhs(__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_adds(vector bool short __a, vector unsigned short __b) { |
| return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_adds(vector unsigned short __a, vector bool short __b) { |
| return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, |
| vector int __b) { |
| return __builtin_altivec_vaddsws(__a, __b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, |
| vector int __b) { |
| return __builtin_altivec_vaddsws((vector int)__a, __b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, |
| vector bool int __b) { |
| return __builtin_altivec_vaddsws(__a, (vector int)__b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_adds(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vadduws(__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_adds(vector bool int __a, vector unsigned int __b) { |
| return __builtin_altivec_vadduws((vector unsigned int)__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_adds(vector unsigned int __a, vector bool int __b) { |
| return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); |
| } |
| |
| /* vec_vaddsbs */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddsbs(vector signed char __a, vector signed char __b) { |
| return __builtin_altivec_vaddsbs(__a, __b); |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddsbs(vector bool char __a, vector signed char __b) { |
| return __builtin_altivec_vaddsbs((vector signed char)__a, __b); |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vaddsbs(vector signed char __a, vector bool char __b) { |
| return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); |
| } |
| |
| /* vec_vaddubs */ |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vaddubs(__a, __b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubs(vector bool char __a, vector unsigned char __b) { |
| return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vaddubs(vector unsigned char __a, vector bool char __b) { |
| return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); |
| } |
| |
| /* vec_vaddshs */ |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, |
| vector short __b) { |
| return __builtin_altivec_vaddshs(__a, __b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, |
| vector short __b) { |
| return __builtin_altivec_vaddshs((vector short)__a, __b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, |
| vector bool short __b) { |
| return __builtin_altivec_vaddshs(__a, (vector short)__b); |
| } |
| |
| /* vec_vadduhs */ |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { |
| return __builtin_altivec_vadduhs(__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhs(vector bool short __a, vector unsigned short __b) { |
| return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vadduhs(vector unsigned short __a, vector bool short __b) { |
| return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); |
| } |
| |
| /* vec_vaddsws */ |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, |
| vector int __b) { |
| return __builtin_altivec_vaddsws(__a, __b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, |
| vector int __b) { |
| return __builtin_altivec_vaddsws((vector int)__a, __b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, |
| vector bool int __b) { |
| return __builtin_altivec_vaddsws(__a, (vector int)__b); |
| } |
| |
| /* vec_vadduws */ |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduws(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vadduws(__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduws(vector bool int __a, vector unsigned int __b) { |
| return __builtin_altivec_vadduws((vector unsigned int)__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vadduws(vector unsigned int __a, vector bool int __b) { |
| return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); |
| } |
| |
| #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ |
| defined(__SIZEOF_INT128__) |
| /* vec_vadduqm */ |
| |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { |
| return __a + __b; |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return __a + __b; |
| } |
| |
| /* vec_vaddeuqm */ |
| |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, |
| vector signed __int128 __c) { |
| return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| vector unsigned __int128 __c) { |
| return __builtin_altivec_vaddeuqm(__a, __b, __c); |
| } |
| |
| /* vec_vaddcuq */ |
| |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { |
| return __builtin_altivec_vaddcuq(__a, __b); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return __builtin_altivec_vaddcuq(__a, __b); |
| } |
| |
| /* vec_vaddecuq */ |
| |
| static __inline__ vector signed __int128 __ATTRS_o_ai |
| vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, |
| vector signed __int128 __c) { |
| return __builtin_altivec_vaddecuq(__a, __b, __c); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, |
| vector unsigned __int128 __c) { |
| return __builtin_altivec_vaddecuq(__a, __b, __c); |
| } |
| #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) |
| |
| /* vec_and */ |
| |
| #define __builtin_altivec_vand vec_and |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_and(vector signed char __a, vector signed char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_and(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a & __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_and(vector signed char __a, vector bool char __b) { |
| return __a & (vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_and(vector unsigned char __a, vector unsigned char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_and(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a & __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_and(vector unsigned char __a, vector bool char __b) { |
| return __a & (vector unsigned char)__b; |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, |
| vector bool char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, |
| vector short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, |
| vector bool short __b) { |
| return __a & (vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_and(vector unsigned short __a, vector unsigned short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_and(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a & __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_and(vector unsigned short __a, vector bool short __b) { |
| return __a & (vector unsigned short)__b; |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_and(vector bool short __a, vector bool short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, |
| vector int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, |
| vector bool int __b) { |
| return __a & (vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_and(vector unsigned int __a, vector unsigned int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_and(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a & __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_and(vector unsigned int __a, vector bool int __b) { |
| return __a & (vector unsigned int)__b; |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, |
| vector bool int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, |
| vector bool int __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, |
| vector double __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & (vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector double __ATTRS_o_ai |
| vec_and(vector double __a, vector bool long long __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & (vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, |
| vector double __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & (vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_and(vector signed long long __a, vector signed long long __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_and(vector bool long long __a, vector signed long long __b) { |
| return (vector signed long long)__a & __b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_and(vector signed long long __a, vector bool long long __b) { |
| return __a & (vector signed long long)__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_and(vector unsigned long long __a, vector unsigned long long __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_and(vector bool long long __a, vector unsigned long long __b) { |
| return (vector unsigned long long)__a & __b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_and(vector unsigned long long __a, vector bool long long __b) { |
| return __a & (vector unsigned long long)__b; |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_and(vector bool long long __a, vector bool long long __b) { |
| return __a & __b; |
| } |
| #endif |
| |
| /* vec_vand */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vand(vector signed char __a, vector signed char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vand(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a & __b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vand(vector signed char __a, vector bool char __b) { |
| return __a & (vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vand(vector unsigned char __a, vector unsigned char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vand(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a & __b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vand(vector unsigned char __a, vector bool char __b) { |
| return __a & (vector unsigned char)__b; |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, |
| vector bool char __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, |
| vector short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a & __b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, |
| vector bool short __b) { |
| return __a & (vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vand(vector unsigned short __a, vector unsigned short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vand(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a & __b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vand(vector unsigned short __a, vector bool short __b) { |
| return __a & (vector unsigned short)__b; |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_vand(vector bool short __a, vector bool short __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, |
| vector int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a & __b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, |
| vector bool int __b) { |
| return __a & (vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vand(vector unsigned int __a, vector unsigned int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vand(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a & __b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vand(vector unsigned int __a, vector bool int __b) { |
| return __a & (vector unsigned int)__b; |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, |
| vector bool int __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, |
| vector bool int __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & (vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vand(vector signed long long __a, vector signed long long __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vand(vector bool long long __a, vector signed long long __b) { |
| return (vector signed long long)__a & __b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vand(vector signed long long __a, vector bool long long __b) { |
| return __a & (vector signed long long)__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vand(vector unsigned long long __a, vector unsigned long long __b) { |
| return __a & __b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vand(vector bool long long __a, vector unsigned long long __b) { |
| return (vector unsigned long long)__a & __b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vand(vector unsigned long long __a, vector bool long long __b) { |
| return __a & (vector unsigned long long)__b; |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_vand(vector bool long long __a, vector bool long long __b) { |
| return __a & __b; |
| } |
| #endif |
| |
| /* vec_andc */ |
| |
| #define __builtin_altivec_vandc vec_andc |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_andc(vector signed char __a, vector signed char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_andc(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a & ~__b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_andc(vector signed char __a, vector bool char __b) { |
| return __a & ~(vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_andc(vector unsigned char __a, vector unsigned char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_andc(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_andc(vector unsigned char __a, vector bool char __b) { |
| return __a & ~(vector unsigned char)__b; |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, |
| vector bool char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, |
| vector short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, |
| vector bool short __b) { |
| return __a & ~(vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_andc(vector unsigned short __a, vector unsigned short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_andc(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_andc(vector unsigned short __a, vector bool short __b) { |
| return __a & ~(vector unsigned short)__b; |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_andc(vector bool short __a, vector bool short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, |
| vector int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, |
| vector bool int __b) { |
| return __a & ~(vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_andc(vector unsigned int __a, vector unsigned int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_andc(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_andc(vector unsigned int __a, vector bool int __b) { |
| return __a & ~(vector unsigned int)__b; |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, |
| vector bool int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, |
| vector bool int __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, |
| vector double __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector double __ATTRS_o_ai |
| vec_andc(vector double __a, vector bool long long __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, |
| vector double __b) { |
| vector unsigned long long __res = |
| (vector unsigned long long)__a & ~(vector unsigned long long)__b; |
| return (vector double)__res; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_andc(vector signed long long __a, vector signed long long __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_andc(vector bool long long __a, vector signed long long __b) { |
| return (vector signed long long)__a & ~__b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_andc(vector signed long long __a, vector bool long long __b) { |
| return __a & ~(vector signed long long)__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_andc(vector unsigned long long __a, vector unsigned long long __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_andc(vector bool long long __a, vector unsigned long long __b) { |
| return (vector unsigned long long)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_andc(vector unsigned long long __a, vector bool long long __b) { |
| return __a & ~(vector unsigned long long)__b; |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_andc(vector bool long long __a, vector bool long long __b) { |
| return __a & ~__b; |
| } |
| #endif |
| |
| /* vec_vandc */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vandc(vector signed char __a, vector signed char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vandc(vector bool char __a, vector signed char __b) { |
| return (vector signed char)__a & ~__b; |
| } |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_vandc(vector signed char __a, vector bool char __b) { |
| return __a & ~(vector signed char)__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vandc(vector unsigned char __a, vector unsigned char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vandc(vector bool char __a, vector unsigned char __b) { |
| return (vector unsigned char)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_vandc(vector unsigned char __a, vector bool char __b) { |
| return __a & ~(vector unsigned char)__b; |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_vandc(vector bool char __a, vector bool char __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, |
| vector short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, |
| vector short __b) { |
| return (vector short)__a & ~__b; |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, |
| vector bool short __b) { |
| return __a & ~(vector short)__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vandc(vector unsigned short __a, vector unsigned short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vandc(vector bool short __a, vector unsigned short __b) { |
| return (vector unsigned short)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_vandc(vector unsigned short __a, vector bool short __b) { |
| return __a & ~(vector unsigned short)__b; |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_vandc(vector bool short __a, vector bool short __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, |
| vector int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, |
| vector int __b) { |
| return (vector int)__a & ~__b; |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, |
| vector bool int __b) { |
| return __a & ~(vector int)__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vandc(vector unsigned int __a, vector unsigned int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vandc(vector bool int __a, vector unsigned int __b) { |
| return (vector unsigned int)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_vandc(vector unsigned int __a, vector bool int __b) { |
| return __a & ~(vector unsigned int)__b; |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, |
| vector bool int __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, |
| vector float __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, |
| vector bool int __b) { |
| vector unsigned int __res = |
| (vector unsigned int)__a & ~(vector unsigned int)__b; |
| return (vector float)__res; |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vandc(vector signed long long __a, vector signed long long __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vandc(vector bool long long __a, vector signed long long __b) { |
| return (vector signed long long)__a & ~__b; |
| } |
| |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_vandc(vector signed long long __a, vector bool long long __b) { |
| return __a & ~(vector signed long long)__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { |
| return __a & ~__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vandc(vector bool long long __a, vector unsigned long long __b) { |
| return (vector unsigned long long)__a & ~__b; |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_vandc(vector unsigned long long __a, vector bool long long __b) { |
| return __a & ~(vector unsigned long long)__b; |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_vandc(vector bool long long __a, vector bool long long __b) { |
| return __a & ~__b; |
| } |
| #endif |
| |
| /* vec_avg */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_avg(vector signed char __a, vector signed char __b) { |
| return __builtin_altivec_vavgsb(__a, __b); |
| } |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_avg(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vavgub(__a, __b); |
| } |
| |
| static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, |
| vector short __b) { |
| return __builtin_altivec_vavgsh(__a, __b); |
| } |
| |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_avg(vector unsigned short __a, vector unsigned short __b) { |
| return __builtin_altivec_vavguh(__a, __b); |
| } |
| |
| static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, |
| vector int __b) { |
| return __builtin_altivec_vavgsw(__a, __b); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_avg(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vavguw(__a, __b); |
| } |
| |
| /* vec_vavgsb */ |
| |
| static __inline__ vector signed char __attribute__((__always_inline__)) |
| vec_vavgsb(vector signed char __a, vector signed char __b) { |
| return __builtin_altivec_vavgsb(__a, __b); |
| } |
| |
| /* vec_vavgub */ |
| |
| static __inline__ vector unsigned char __attribute__((__always_inline__)) |
| vec_vavgub(vector unsigned char __a, vector unsigned char __b) { |
| return __builtin_altivec_vavgub(__a, __b); |
| } |
| |
| /* vec_vavgsh */ |
| |
| static __inline__ vector short __attribute__((__always_inline__)) |
| vec_vavgsh(vector short __a, vector short __b) { |
| return __builtin_altivec_vavgsh(__a, __b); |
| } |
| |
| /* vec_vavguh */ |
| |
| static __inline__ vector unsigned short __attribute__((__always_inline__)) |
| vec_vavguh(vector unsigned short __a, vector unsigned short __b) { |
| return __builtin_altivec_vavguh(__a, __b); |
| } |
| |
| /* vec_vavgsw */ |
| |
| static __inline__ vector int __attribute__((__always_inline__)) |
| vec_vavgsw(vector int __a, vector int __b) { |
| return __builtin_altivec_vavgsw(__a, __b); |
| } |
| |
| /* vec_vavguw */ |
| |
| static __inline__ vector unsigned int __attribute__((__always_inline__)) |
| vec_vavguw(vector unsigned int __a, vector unsigned int __b) { |
| return __builtin_altivec_vavguw(__a, __b); |
| } |
| |
| /* vec_ceil */ |
| |
| static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { |
| #ifdef __VSX__ |
| return __builtin_vsx_xvrspip(__a); |
| #else |
| return __builtin_altivec_vrfip(__a); |
| #endif |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { |
| return __builtin_vsx_xvrdpip(__a); |
| } |
| #endif |
| |
| /* vec_roundp */ |
| static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { |
| return vec_ceil(__a); |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { |
| return vec_ceil(__a); |
| } |
| #endif |
| |
| /* vec_vrfip */ |
| |
| static __inline__ vector float __attribute__((__always_inline__)) |
| vec_vrfip(vector float __a) { |
| return __builtin_altivec_vrfip(__a); |
| } |
| |
| /* vec_cmpb */ |
| |
| static __inline__ vector int __attribute__((__always_inline__)) |
| vec_cmpb(vector float __a, vector float __b) { |
| return __builtin_altivec_vcmpbfp(__a, __b); |
| } |
| |
| /* vec_vcmpbfp */ |
| |
| static __inline__ vector int __attribute__((__always_inline__)) |
| vec_vcmpbfp(vector float __a, vector float __b) { |
| return __builtin_altivec_vcmpbfp(__a, __b); |
| } |
| |
| /* vec_cmpeq */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpeq(vector signed char __a, vector signed char __b) { |
| return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { |
| return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpeq(vector bool char __a, vector bool char __b) { |
| return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, |
| vector short __b) { |
| return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { |
| return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpeq(vector bool short __a, vector bool short __b) { |
| return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, |
| vector int __b) { |
| return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { |
| return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, |
| vector bool int __b) { |
| return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, |
| (vector int)__b); |
| } |
| |
| #ifdef __POWER8_VECTOR__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector signed long long __a, vector signed long long __b) { |
| return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { |
| return (vector bool long long)__builtin_altivec_vcmpequd( |
| (vector long long)__a, (vector long long)__b); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector bool long long __a, vector bool long long __b) { |
| return (vector bool long long)__builtin_altivec_vcmpequd( |
| (vector long long)__a, (vector long long)__b); |
| } |
| #elif defined(__VSX__) |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector signed long long __a, vector signed long long __b) { |
| vector bool int __wordcmp = |
| vec_cmpeq((vector signed int)__a, (vector signed int)__b); |
| #ifdef __LITTLE_ENDIAN__ |
| __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); |
| return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, |
| 1, 3, 3); |
| #else |
| __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); |
| return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, |
| 0, 2, 2); |
| #endif |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { |
| return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector bool long long __a, vector bool long long __b) { |
| return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); |
| } |
| #endif |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, |
| vector float __b) { |
| #ifdef __VSX__ |
| return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); |
| #else |
| return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); |
| #endif |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpeq(vector double __a, vector double __b) { |
| return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); |
| } |
| #endif |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { |
| return (vector bool __int128)__builtin_altivec_vcmpequq( |
| (vector bool __int128)__a, (vector bool __int128)__b); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return (vector bool __int128)__builtin_altivec_vcmpequq( |
| (vector bool __int128)__a, (vector bool __int128)__b); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) { |
| return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b); |
| } |
| #endif |
| |
| #ifdef __POWER9_VECTOR__ |
| /* vec_cmpne */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector bool char __a, vector bool char __b) { |
| return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector signed char __a, vector signed char __b) { |
| return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector unsigned char __a, vector unsigned char __b) { |
| return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector bool short __a, vector bool short __b) { |
| return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector signed short __a, vector signed short __b) { |
| return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector unsigned short __a, vector unsigned short __b) { |
| return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector bool int __a, vector bool int __b) { |
| return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector signed int __a, vector signed int __b) { |
| return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector unsigned int __a, vector unsigned int __b) { |
| return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector float __a, vector float __b) { |
| return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, |
| (vector int)__b); |
| } |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return (vector bool __int128) ~(__builtin_altivec_vcmpequq( |
| (vector bool __int128)__a, (vector bool __int128)__b)); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { |
| return (vector bool __int128) ~(__builtin_altivec_vcmpequq( |
| (vector bool __int128)__a, (vector bool __int128)__b)); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) { |
| return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b)); |
| } |
| #endif |
| |
| /* vec_cmpnez */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpnez(vector signed char __a, vector signed char __b) { |
| return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { |
| return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, |
| (vector char)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpnez(vector signed short __a, vector signed short __b) { |
| return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { |
| return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, |
| (vector short)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpnez(vector signed int __a, vector signed int __b) { |
| return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { |
| return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, |
| (vector int)__b); |
| } |
| |
| static __inline__ signed int __ATTRS_o_ai |
| vec_cntlz_lsbb(vector signed char __a) { |
| #ifdef __LITTLE_ENDIAN__ |
| return __builtin_altivec_vctzlsbb(__a); |
| #else |
| return __builtin_altivec_vclzlsbb(__a); |
| #endif |
| } |
| |
| static __inline__ signed int __ATTRS_o_ai |
| vec_cntlz_lsbb(vector unsigned char __a) { |
| #ifdef __LITTLE_ENDIAN__ |
| return __builtin_altivec_vctzlsbb(__a); |
| #else |
| return __builtin_altivec_vclzlsbb(__a); |
| #endif |
| } |
| |
| static __inline__ signed int __ATTRS_o_ai |
| vec_cnttz_lsbb(vector signed char __a) { |
| #ifdef __LITTLE_ENDIAN__ |
| return __builtin_altivec_vclzlsbb(__a); |
| #else |
| return __builtin_altivec_vctzlsbb(__a); |
| #endif |
| } |
| |
| static __inline__ signed int __ATTRS_o_ai |
| vec_cnttz_lsbb(vector unsigned char __a) { |
| #ifdef __LITTLE_ENDIAN__ |
| return __builtin_altivec_vclzlsbb(__a); |
| #else |
| return __builtin_altivec_vctzlsbb(__a); |
| #endif |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_parity_lsbb(vector unsigned int __a) { |
| return __builtin_altivec_vprtybw(__a); |
| } |
| |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_parity_lsbb(vector signed int __a) { |
| return __builtin_altivec_vprtybw(__a); |
| } |
| |
| #ifdef __SIZEOF_INT128__ |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_parity_lsbb(vector unsigned __int128 __a) { |
| return __builtin_altivec_vprtybq(__a); |
| } |
| |
| static __inline__ vector unsigned __int128 __ATTRS_o_ai |
| vec_parity_lsbb(vector signed __int128 __a) { |
| return __builtin_altivec_vprtybq(__a); |
| } |
| #endif |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_parity_lsbb(vector unsigned long long __a) { |
| return __builtin_altivec_vprtybd(__a); |
| } |
| |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_parity_lsbb(vector signed long long __a) { |
| return __builtin_altivec_vprtybd(__a); |
| } |
| |
| #else |
| /* vec_cmpne */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector bool char __a, vector bool char __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector signed char __a, vector signed char __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpne(vector unsigned char __a, vector unsigned char __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector bool short __a, vector bool short __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector signed short __a, vector signed short __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpne(vector unsigned short __a, vector unsigned short __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector bool int __a, vector bool int __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector signed int __a, vector signed int __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector unsigned int __a, vector unsigned int __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpne(vector float __a, vector float __b) { |
| return ~(vec_cmpeq(__a, __b)); |
| } |
| #endif |
| |
| #ifdef __POWER8_VECTOR__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector bool long long __a, vector bool long long __b) { |
| return (vector bool long long) |
| ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector signed long long __a, vector signed long long __b) { |
| return (vector bool long long) |
| ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { |
| return (vector bool long long) |
| ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| } |
| #elif defined(__VSX__) |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector bool long long __a, vector bool long long __b) { |
| return (vector bool long long)~( |
| vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector signed long long __a, vector signed long long __b) { |
| return (vector bool long long)~( |
| vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { |
| return (vector bool long long)~( |
| vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); |
| } |
| #endif |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpne(vector double __a, vector double __b) { |
| return (vector bool long long) |
| ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); |
| } |
| #endif |
| |
| /* vec_cmpgt */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpgt(vector signed char __a, vector signed char __b) { |
| return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { |
| return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, |
| vector short __b) { |
| return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { |
| return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, |
| vector int __b) { |
| return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { |
| return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); |
| } |
| |
| #ifdef __POWER8_VECTOR__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpgt(vector signed long long __a, vector signed long long __b) { |
| return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { |
| return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); |
| } |
| #elif defined(__VSX__) |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpgt(vector signed long long __a, vector signed long long __b) { |
| vector signed int __sgtw = (vector signed int)vec_cmpgt( |
| (vector signed int)__a, (vector signed int)__b); |
| vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( |
| (vector unsigned int)__a, (vector unsigned int)__b); |
| vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( |
| (vector signed int)__a, (vector signed int)__b); |
| #ifdef __LITTLE_ENDIAN__ |
| __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; |
| __sgtw |= (vector signed int)__ugtw; |
| return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, |
| 3); |
| #else |
| __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; |
| __sgtw |= (vector signed int)__ugtw; |
| return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, |
| 2); |
| #endif |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { |
| vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( |
| (vector unsigned int)__a, (vector unsigned int)__b); |
| vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( |
| (vector signed int)__a, (vector signed int)__b); |
| #ifdef __LITTLE_ENDIAN__ |
| __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; |
| __ugtw |= __eqw; |
| return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, |
| 3); |
| #else |
| __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; |
| __ugtw |= __eqw; |
| return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, |
| 2); |
| #endif |
| } |
| #endif |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, |
| vector float __b) { |
| #ifdef __VSX__ |
| return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); |
| #else |
| return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); |
| #endif |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpgt(vector double __a, vector double __b) { |
| return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); |
| } |
| #endif |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { |
| return (vector bool __int128)__builtin_altivec_vcmpgtsq( |
| (vector bool __int128)__a, (vector bool __int128)__b); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return (vector bool __int128)__builtin_altivec_vcmpgtuq( |
| (vector bool __int128)__a, (vector bool __int128)__b); |
| } |
| #endif |
| |
| /* vec_cmpge */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpge(vector signed char __a, vector signed char __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmpge(vector unsigned char __a, vector unsigned char __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpge(vector signed short __a, vector signed short __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmpge(vector unsigned short __a, vector unsigned short __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpge(vector signed int __a, vector signed int __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmpge(vector unsigned int __a, vector unsigned int __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, |
| vector float __b) { |
| #ifdef __VSX__ |
| return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); |
| #else |
| return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); |
| #endif |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpge(vector double __a, vector double __b) { |
| return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpge(vector signed long long __a, vector signed long long __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| #endif |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return ~(vec_cmpgt(__b, __a)); |
| } |
| #endif |
| |
| /* vec_vcmpgefp */ |
| |
| static __inline__ vector bool int __attribute__((__always_inline__)) |
| vec_vcmpgefp(vector float __a, vector float __b) { |
| return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); |
| } |
| |
| /* vec_vcmpgtsb */ |
| |
| static __inline__ vector bool char __attribute__((__always_inline__)) |
| vec_vcmpgtsb(vector signed char __a, vector signed char __b) { |
| return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); |
| } |
| |
| /* vec_vcmpgtub */ |
| |
| static __inline__ vector bool char __attribute__((__always_inline__)) |
| vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { |
| return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); |
| } |
| |
| /* vec_vcmpgtsh */ |
| |
| static __inline__ vector bool short __attribute__((__always_inline__)) |
| vec_vcmpgtsh(vector short __a, vector short __b) { |
| return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); |
| } |
| |
| /* vec_vcmpgtuh */ |
| |
| static __inline__ vector bool short __attribute__((__always_inline__)) |
| vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { |
| return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); |
| } |
| |
| /* vec_vcmpgtsw */ |
| |
| static __inline__ vector bool int __attribute__((__always_inline__)) |
| vec_vcmpgtsw(vector int __a, vector int __b) { |
| return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); |
| } |
| |
| /* vec_vcmpgtuw */ |
| |
| static __inline__ vector bool int __attribute__((__always_inline__)) |
| vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { |
| return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); |
| } |
| |
| /* vec_vcmpgtfp */ |
| |
| static __inline__ vector bool int __attribute__((__always_inline__)) |
| vec_vcmpgtfp(vector float __a, vector float __b) { |
| return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); |
| } |
| |
| /* vec_cmple */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmple(vector signed char __a, vector signed char __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmple(vector unsigned char __a, vector unsigned char __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmple(vector signed short __a, vector signed short __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmple(vector unsigned short __a, vector unsigned short __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmple(vector signed int __a, vector signed int __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmple(vector unsigned int __a, vector unsigned int __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, |
| vector float __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmple(vector double __a, vector double __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmple(vector signed long long __a, vector signed long long __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { |
| return vec_cmpge(__b, __a); |
| } |
| #endif |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { |
| return vec_cmpge(__b, __a); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return vec_cmpge(__b, __a); |
| } |
| #endif |
| |
| /* vec_cmplt */ |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmplt(vector signed char __a, vector signed char __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool char __ATTRS_o_ai |
| vec_cmplt(vector unsigned char __a, vector unsigned char __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, |
| vector short __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool short __ATTRS_o_ai |
| vec_cmplt(vector unsigned short __a, vector unsigned short __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, |
| vector int __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai |
| vec_cmplt(vector unsigned int __a, vector unsigned int __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, |
| vector float __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmplt(vector double __a, vector double __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| #endif |
| |
| #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool __int128 __ATTRS_o_ai |
| vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| #endif |
| |
| #ifdef __VSX__ |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmplt(vector signed long long __a, vector signed long long __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| |
| static __inline__ vector bool long long __ATTRS_o_ai |
| vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { |
| return vec_cmpgt(__b, __a); |
| } |
| #endif |
| |
| #ifdef __POWER8_VECTOR__ |
| /* vec_popcnt */ |
| |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_popcnt(vector signed char __a) { |
| return __builtin_altivec_vpopcntb(__a); |
| } |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_popcnt(vector unsigned char __a) { |
| return __builtin_altivec_vpopcntb(__a); |
| } |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_popcnt(vector signed short __a) { |
| return __builtin_altivec_vpopcnth(__a); |
| } |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_popcnt(vector unsigned short __a) { |
| return __builtin_altivec_vpopcnth(__a); |
| } |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_popcnt(vector signed int __a) { |
| return __builtin_altivec_vpopcntw(__a); |
| } |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_popcnt(vector unsigned int __a) { |
| return __builtin_altivec_vpopcntw(__a); |
| } |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_popcnt(vector signed long long __a) { |
| return __builtin_altivec_vpopcntd(__a); |
| } |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_popcnt(vector unsigned long long __a) { |
| return __builtin_altivec_vpopcntd(__a); |
| } |
| |
| #define vec_vclz vec_cntlz |
| /* vec_cntlz */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_cntlz(vector signed char __a) { |
| return __builtin_altivec_vclzb(__a); |
| } |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_cntlz(vector unsigned char __a) { |
| return __builtin_altivec_vclzb(__a); |
| } |
| static __inline__ vector signed short __ATTRS_o_ai |
| vec_cntlz(vector signed short __a) { |
| return __builtin_altivec_vclzh(__a); |
| } |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_cntlz(vector unsigned short __a) { |
| return __builtin_altivec_vclzh(__a); |
| } |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_cntlz(vector signed int __a) { |
| return __builtin_altivec_vclzw(__a); |
| } |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_cntlz(vector unsigned int __a) { |
| return __builtin_altivec_vclzw(__a); |
| } |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_cntlz(vector signed long long __a) { |
| return __builtin_altivec_vclzd(__a); |
| } |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_cntlz(vector unsigned long long __a) { |
| return __builtin_altivec_vclzd(__a); |
| } |
| #endif |
| |
| #ifdef __POWER9_VECTOR__ |
| |
| /* vec_cnttz */ |
| |
| static __inline__ vector signed char __ATTRS_o_ai |
| vec_cnttz(vector signed char __a) { |
| return __builtin_altivec_vctzb(__a); |
| } |
| static __inline__ vector unsigned char __ATTRS_o_ai |
| vec_cnttz(vector unsigned char __a) { |
| return __builtin_altivec_vctzb(__a); |
| } |
| static __inline__ vector signed short __ATTRS_o_ai |
| vec_cnttz(vector signed short __a) { |
| return __builtin_altivec_vctzh(__a); |
| } |
| static __inline__ vector unsigned short __ATTRS_o_ai |
| vec_cnttz(vector unsigned short __a) { |
| return __builtin_altivec_vctzh(__a); |
| } |
| static __inline__ vector signed int __ATTRS_o_ai |
| vec_cnttz(vector signed int __a) { |
| return __builtin_altivec_vctzw(__a); |
| } |
| static __inline__ vector unsigned int __ATTRS_o_ai |
| vec_cnttz(vector unsigned int __a) { |
| return __builtin_altivec_vctzw(__a); |
| } |
| static __inline__ vector signed long long __ATTRS_o_ai |
| vec_cnttz(vector signed long long __a) { |
| return __builtin_altivec_vctzd(__a); |
| } |
| static __inline__ vector unsigned long long __ATTRS_o_ai |
| vec_cnttz(vector unsigned long long __a) { |
| return __builtin_altivec_vctzd(__a); |
| } |
| |
| /* vec_first_match_index */ |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector signed char __a, vector signed char __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 3; |
| } |
| return __res[0] >> 3; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 3; |
| } |
| return __res[0] >> 3; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector signed short __a, vector signed short __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 4; |
| } |
| return __res[0] >> 4; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 4; |
| } |
| return __res[0] >> 4; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector signed int __a, vector signed int __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 5; |
| } |
| return __res[0] >> 5; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #else |
| vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 5; |
| } |
| return __res[0] >> 5; |
| } |
| |
| /* vec_first_match_or_eos_index */ |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { |
| /* Compare the result of the comparison of two vectors with either and OR the |
| result. Either the elements are equal or one will equal the comparison |
| result if either is zero. |
| */ |
| vector bool char __tmp1 = vec_cmpeq(__a, __b); |
| vector bool char __tmp2 = __tmp1 | |
| vec_cmpeq((vector signed char)__tmp1, __a) | |
| vec_cmpeq((vector signed char)__tmp1, __b); |
| |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)__tmp2); |
| #else |
| vec_cntlz((vector unsigned long long)__tmp2); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 3; |
| } |
| return __res[0] >> 3; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_or_eos_index(vector unsigned char __a, |
| vector unsigned char __b) { |
| vector bool char __tmp1 = vec_cmpeq(__a, __b); |
| vector bool char __tmp2 = __tmp1 | |
| vec_cmpeq((vector unsigned char)__tmp1, __a) | |
| vec_cmpeq((vector unsigned char)__tmp1, __b); |
| |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)__tmp2); |
| #else |
| vec_cntlz((vector unsigned long long)__tmp2); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 3; |
| } |
| return __res[0] >> 3; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { |
| vector bool short __tmp1 = vec_cmpeq(__a, __b); |
| vector bool short __tmp2 = __tmp1 | |
| vec_cmpeq((vector signed short)__tmp1, __a) | |
| vec_cmpeq((vector signed short)__tmp1, __b); |
| |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| vec_cnttz((vector unsigned long long)__tmp2); |
| #else |
| vec_cntlz((vector unsigned long long)__tmp2); |
| #endif |
| if (__res[0] == 64) { |
| return (__res[1] + 64) >> 4; |
| } |
| return __res[0] >> 4; |
| } |
| |
| static __inline__ unsigned __ATTRS_o_ai |
| vec_first_match_or_eos_index(vector unsigned short __a, |
| vector unsigned short __b) { |
| vector bool short __tmp1 = vec_cmpeq(__a, __b); |
| vector bool short __tmp2 = __tmp1 | |
| vec_cmpeq((vector unsigned short)__tmp1, __a) | |
| vec_cmpeq((vector unsigned short)__tmp1, __b); |
| |
| vector unsigned long long __res = |
| #ifdef __LITTLE_ENDIAN__ |
| |