diff options
Diffstat (limited to 'clang/lib/Headers/altivec.h')
-rw-r--r-- | clang/lib/Headers/altivec.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h index fb808d7b0a4f..55195b0781fb 100644 --- a/clang/lib/Headers/altivec.h +++ b/clang/lib/Headers/altivec.h @@ -19,6 +19,10 @@ #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) @@ -8413,9 +8417,20 @@ static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { } #ifdef __VSX__ +#ifdef __XL_COMPAT_ALTIVEC__ +static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a); +static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { + double __fpscr = __builtin_readflm(); + __builtin_setrnd(0); + vector double __rounded = vec_rint(__a); + __builtin_setflm(__fpscr); + return __rounded; +} +#else static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { return __builtin_vsx_xvrdpi(__a); } +#endif /* vec_rint */ @@ -19026,6 +19041,51 @@ vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { #endif /* __SIZEOF_INT128__ */ #endif /* __POWER10_VECTOR__ */ +#ifdef __POWER8_VECTOR__ +#define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps)) +#define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps)) + +static __inline__ long __bcdadd_ofl(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b); +} + +static __inline__ long __bcdsub_ofl(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b); +} + +static __inline__ long __bcd_invalid(vector unsigned char __a) { + return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a); +} + +static __inline__ long __bcdcmpeq(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b); +} + +static __inline__ long __bcdcmplt(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b); +} + +static __inline__ long __bcdcmpgt(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b); +} + +static __inline__ long __bcdcmple(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b); +} + +static __inline__ long __bcdcmpge(vector unsigned char __a, + vector unsigned char __b) { + return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b); +} + +#endif // __POWER8_VECTOR__ + #undef __ATTRS_o_ai #endif /* __ALTIVEC_H */ |