diff options
Diffstat (limited to 'clang/lib/Headers/altivec.h')
-rw-r--r-- | clang/lib/Headers/altivec.h | 402 |
1 files changed, 402 insertions, 0 deletions
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index 7e231a2a428e..ac5f43836316 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -16761,6 +16761,408 @@ static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { return __builtin_altivec_vminsb(__a, -__a); } + +#ifdef __POWER10_VECTOR__ +/* vec_pdep */ + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { + return __builtin_altivec_vpdepd(__a, __b); +} + +/* vec_pext */ + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_pext(vector unsigned long long __a, vector unsigned long long __b) { + return __builtin_altivec_vpextd(__a, __b); +} + +/* vec_cfuge */ + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { + return __builtin_altivec_vcfuged(__a, __b); +} + +/* vec_gnb */ + +#define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) + +/* vec_ternarylogic */ +#ifdef __VSX__ +#define vec_ternarylogic(__a, __b, __c, __imm) \ + _Generic((__a), vector unsigned char \ + : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ + (vector unsigned long long)(__b), \ + (vector unsigned long long)(__c), (__imm)), \ + vector unsigned short \ + : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ + (vector unsigned long long)(__b), \ + (vector unsigned long long)(__c), (__imm)), \ + vector unsigned int \ + : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ + (vector unsigned long long)(__b), \ + (vector unsigned long long)(__c), (__imm)), \ + vector unsigned long long \ + : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ + (vector unsigned long long)(__b), \ + (vector unsigned long long)(__c), (__imm)), \ + vector unsigned __int128 \ + : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ + (vector unsigned long long)(__b), \ + (vector unsigned long long)(__c), (__imm))) +#endif /* __VSX__ */ + +/* vec_genpcvm */ + +#ifdef __VSX__ +#define vec_genpcvm(__a, __imm) \ + _Generic((__a), vector unsigned char \ + : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ + vector unsigned short \ + : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ + vector unsigned int \ + : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ + vector unsigned long long \ + : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) +#endif /* __VSX__ */ + +/* vec_clrl */ + +static __inline__ vector signed char __ATTRS_o_ai +vec_clrl(vector signed char __a, unsigned int __n) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vclrrb(__a, __n); +#else + return __builtin_altivec_vclrlb( __a, __n); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_clrl(vector unsigned char __a, unsigned int __n) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vclrrb((vector signed char)__a, __n); +#else + return __builtin_altivec_vclrlb((vector signed char)__a, __n); +#endif +} + +/* vec_clrr */ + +static __inline__ vector signed char __ATTRS_o_ai +vec_clrr(vector signed char __a, unsigned int __n) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vclrlb(__a, __n); +#else + return __builtin_altivec_vclrrb( __a, __n); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_clrr(vector unsigned char __a, unsigned int __n) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vclrlb((vector signed char)__a, __n); +#else + return __builtin_altivec_vclrrb((vector signed char)__a, __n); +#endif +} + +/* vec_cntlzm */ + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { + return __builtin_altivec_vclzdm(__a, __b); +} + +/* vec_cnttzm */ + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { + return __builtin_altivec_vctzdm(__a, __b); +} + +/* vec_sldbi */ + +#define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) + +/* vec_srdbi */ + +#define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) + +/* vec_insertl */ + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbrx(__b, __c, __a); +#else + return __builtin_altivec_vinsblx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshrx(__b, __c, __a); +#else + return __builtin_altivec_vinshlx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswrx(__b, __c, __a); +#else + return __builtin_altivec_vinswlx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_insertl(unsigned long long __a, vector unsigned long long __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsdrx(__b, __c, __a); +#else + return __builtin_altivec_vinsdlx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_insertl(vector unsigned char __a, vector unsigned char __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbvrx(__b, __c, __a); +#else + return __builtin_altivec_vinsbvlx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_insertl(vector unsigned short __a, vector unsigned short __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshvrx(__b, __c, __a); +#else + return __builtin_altivec_vinshvlx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_insertl(vector unsigned int __a, vector unsigned int __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswvrx(__b, __c, __a); +#else + return __builtin_altivec_vinswvlx(__b, __c, __a); +#endif +} + +/* vec_inserth */ + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsblx(__b, __c, __a); +#else + return __builtin_altivec_vinsbrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshlx(__b, __c, __a); +#else + return __builtin_altivec_vinshrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswlx(__b, __c, __a); +#else + return __builtin_altivec_vinswrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_inserth(unsigned long long __a, vector unsigned long long __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsdlx(__b, __c, __a); +#else + return __builtin_altivec_vinsdrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_inserth(vector unsigned char __a, vector unsigned char __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinsbvlx(__b, __c, __a); +#else + return __builtin_altivec_vinsbvrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_inserth(vector unsigned short __a, vector unsigned short __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinshvlx(__b, __c, __a); +#else + return __builtin_altivec_vinshvrx(__b, __c, __a); +#endif +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_inserth(vector unsigned int __a, vector unsigned int __b, + unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + return __builtin_altivec_vinswvlx(__b, __c, __a); +#else + return __builtin_altivec_vinswvrx(__b, __c, __a); +#endif +} + +#ifdef __VSX__ + +/* vec_permx */ + +#define vec_permx(__a, __b, __c, __d) \ + __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) + +/* vec_blendv */ + +static __inline__ vector signed char __ATTRS_o_ai +vec_blendv(vector signed char __a, vector signed char __b, + vector unsigned char __c) { + return __builtin_vsx_xxblendvb(__a, __b, __c); +} + +static __inline__ vector unsigned char __ATTRS_o_ai +vec_blendv(vector unsigned char __a, vector unsigned char __b, + vector unsigned char __c) { + return __builtin_vsx_xxblendvb(__a, __b, __c); +} + +static __inline__ vector signed short __ATTRS_o_ai +vec_blendv(vector signed short __a, vector signed short __b, + vector unsigned short __c) { + return __builtin_vsx_xxblendvh(__a, __b, __c); +} + +static __inline__ vector unsigned short __ATTRS_o_ai +vec_blendv(vector unsigned short __a, vector unsigned short __b, + vector unsigned short __c) { + return __builtin_vsx_xxblendvh(__a, __b, __c); +} + +static __inline__ vector signed int __ATTRS_o_ai +vec_blendv(vector signed int __a, vector signed int __b, + vector unsigned int __c) { + return __builtin_vsx_xxblendvw(__a, __b, __c); +} + +static __inline__ vector unsigned int __ATTRS_o_ai +vec_blendv(vector unsigned int __a, vector unsigned int __b, + vector unsigned int __c) { + return __builtin_vsx_xxblendvw(__a, __b, __c); +} + +static __inline__ vector signed long long __ATTRS_o_ai +vec_blendv(vector signed long long __a, vector signed long long __b, + vector unsigned long long __c) { + return __builtin_vsx_xxblendvd(__a, __b, __c); +} + +static __inline__ vector unsigned long long __ATTRS_o_ai +vec_blendv(vector unsigned long long __a, vector unsigned long long __b, + vector unsigned long long __c) { + return __builtin_vsx_xxblendvd(__a, __b, __c); +} + +static __inline__ vector float __ATTRS_o_ai +vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { + return __builtin_vsx_xxblendvw(__a, __b, __c); +} + +static __inline__ vector double __ATTRS_o_ai +vec_blendv(vector double __a, vector double __b, + vector unsigned long long __c) { + return __builtin_vsx_xxblendvd(__a, __b, __c); +} + +/* vec_splati */ + +#define vec_splati(__a) \ + _Generic((__a), signed int \ + : ((vector signed int)__a), unsigned int \ + : ((vector unsigned int)__a), float \ + : ((vector float)__a)) + +/* vec_spatid */ + +static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { + return ((vector double)((double)__a)); +} + +/* vec_splati_ins */ + +static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( + vector signed int __a, const unsigned int __b, const signed int __c) { +#ifdef __LITTLE_ENDIAN__ + __a[1 - __b] = __c; + __a[3 - __b] = __c; +#else + __a[__b] = __c; + __a[2 + __b] = __c; +#endif + return __a; +} + +static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( + vector unsigned int __a, const unsigned int __b, const unsigned int __c) { +#ifdef __LITTLE_ENDIAN__ + __a[1 - __b] = __c; + __a[3 - __b] = __c; +#else + __a[__b] = __c; + __a[2 + __b] = __c; +#endif + return __a; +} + +static __inline__ vector float __ATTRS_o_ai +vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { +#ifdef __LITTLE_ENDIAN__ + __a[1 - __b] = __c; + __a[3 - __b] = __c; +#else + __a[__b] = __c; + __a[2 + __b] = __c; +#endif + return __a; +} + +/* vec_test_lsbb_all_ones */ + +static __inline__ int __ATTRS_o_ai +vec_test_lsbb_all_ones(vector unsigned char __a) { + return __builtin_vsx_xvtlsbb(__a, 1); +} + +/* vec_test_lsbb_all_zeros */ + +static __inline__ int __ATTRS_o_ai +vec_test_lsbb_all_zeros(vector unsigned char __a) { + return __builtin_vsx_xvtlsbb(__a, 0); +} +#endif /* __VSX__ */ +#endif /* __POWER10_VECTOR__ */ + #undef __ATTRS_o_ai #endif /* __ALTIVEC_H */ |