Index: include/clang/Basic/BuiltinsPPC.def =================================================================== --- include/clang/Basic/BuiltinsPPC.def +++ include/clang/Basic/BuiltinsPPC.def @@ -280,12 +280,21 @@ BUILTIN(__builtin_vsx_xvcmpeqdp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpeqsp, "V4UiV4fV4f", "") +BUILTIN(__builtin_vsx_xvcmpeqdp_p, "iiV2dV2d", "") +BUILTIN(__builtin_vsx_xvcmpeqsp_p, "iiV4fV4f", "") + BUILTIN(__builtin_vsx_xvcmpgedp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpgesp, "V4UiV4fV4f", "") +BUILTIN(__builtin_vsx_xvcmpgedp_p, "iiV2dV2d", "") +BUILTIN(__builtin_vsx_xvcmpgesp_p, "iiV4fV4f", "") + BUILTIN(__builtin_vsx_xvcmpgtdp, "V2ULLiV2dV2d", "") BUILTIN(__builtin_vsx_xvcmpgtsp, "V4UiV4fV4f", "") +BUILTIN(__builtin_vsx_xvcmpgtdp_p, "iiV2dV2d", "") +BUILTIN(__builtin_vsx_xvcmpgtsp_p, "iiV4fV4f", "") + BUILTIN(__builtin_vsx_xvrdpim, "V2dV2d", "") BUILTIN(__builtin_vsx_xvrspim, "V4fV4f", "") Index: lib/Headers/altivec.h =================================================================== --- lib/Headers/altivec.h +++ lib/Headers/altivec.h @@ -278,6 +278,38 @@ } #endif // __VSX__ +/* vec_adde */ + +#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) +static 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 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 + +/* vec_addec */ + +#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) +static 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 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 + /* vec_vaddubm */ #define __builtin_altivec_vaddubm vec_vaddubm @@ -395,6 +427,11 @@ return __builtin_altivec_vaddcuw(__a, __b); } +static vector signed int __ATTRS_o_ai vec_addc(vector signed int __a, + vector signed int __b) { + return __builtin_altivec_vaddcuw(__a, __b); +} + #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) static vector signed __int128 __ATTRS_o_ai vec_addc(vector signed __int128 __a, vector signed __int128 __b) { @@ -1512,48 +1549,6 @@ } #endif -/* vec_cmpge */ - -static 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 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); -} -#endif - -#ifdef __POWER8_VECTOR__ -/* Forwrad declarations as the functions are used here */ -static vector bool long long __ATTRS_o_ai -vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b); -static vector bool long long __ATTRS_o_ai -vec_cmpgt(vector signed long long __a, vector signed long long __b); - -static 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 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 - -/* vec_vcmpgefp */ - -static vector bool int __attribute__((__always_inline__)) -vec_vcmpgefp(vector float __a, vector float __b) { - return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); -} /* vec_cmpgt */ @@ -1613,6 +1608,74 @@ return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); } #endif + +/* vec_cmpge */ + +static vector bool char __ATTRS_o_ai +vec_cmpge (vector signed char __a, vector signed char __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static vector bool char __ATTRS_o_ai +vec_cmpge (vector unsigned char __a, vector unsigned char __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static vector bool short __ATTRS_o_ai +vec_cmpge (vector signed short __a, vector signed short __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static vector bool short __ATTRS_o_ai +vec_cmpge (vector unsigned short __a, vector unsigned short __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static vector bool int __ATTRS_o_ai +vec_cmpge (vector signed int __a, vector signed int __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static vector bool int __ATTRS_o_ai +vec_cmpge (vector unsigned int __a, vector unsigned int __b) { + return ~(vec_cmpgt(__b, __a)); +} + +static 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 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); +} +#endif + +#ifdef __POWER8_VECTOR__ +static 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 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 + +/* vec_vcmpgefp */ + +static 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 vector bool char __attribute__((__always_inline__)) @@ -1664,6 +1727,36 @@ /* vec_cmple */ +static vector bool char __ATTRS_o_ai +vec_cmple (vector signed char __a, vector signed char __b) { + return vec_cmpge(__b, __a); +} + +static vector bool char __ATTRS_o_ai +vec_cmple (vector unsigned char __a, vector unsigned char __b) { + return vec_cmpge(__b, __a); +} + +static vector bool short __ATTRS_o_ai +vec_cmple (vector signed short __a, vector signed short __b) { + return vec_cmpge(__b, __a); +} + +static vector bool short __ATTRS_o_ai +vec_cmple (vector unsigned short __a, vector unsigned short __b) { + return vec_cmpge(__b, __a); +} + +static vector bool int __ATTRS_o_ai +vec_cmple (vector signed int __a, vector signed int __b) { + return vec_cmpge(__b, __a); +} + +static vector bool int __ATTRS_o_ai +vec_cmple (vector unsigned int __a, vector unsigned int __b) { + return vec_cmpge(__b, __a); +} + static vector bool int __ATTRS_o_ai vec_cmple(vector float __a, vector float __b) { return vec_cmpge(__b, __a); @@ -1837,6 +1930,16 @@ return __builtin_altivec_vctuxs(__a, __b); } +/* vec_double */ + +static vector double __ATTRS_o_ai vec_double (vector signed long long __a) { + return (vector double)__a; +} + +static vector double __ATTRS_o_ai vec_double (vector unsigned long long __a) { + return (vector double)__a; +} + /* vec_div */ /* Integer vector divides (vectors are scalarized, elements divided @@ -1942,34 +2045,16 @@ (vector unsigned int)__b); } -static vector signed char __ATTRS_o_ai vec_eqv(vector bool char __a, - vector signed char __b) { - return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector signed char __ATTRS_o_ai vec_eqv(vector signed char __a, - vector bool char __b) { - return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - static vector unsigned char __ATTRS_o_ai vec_eqv(vector unsigned char __a, vector unsigned char __b) { return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } -static vector unsigned char __ATTRS_o_ai vec_eqv(vector bool char __a, - vector unsigned char __b) { - return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector unsigned char __ATTRS_o_ai vec_eqv(vector unsigned char __a, - vector bool char __b) { - return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); +static vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, + vector bool char __b) { + return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, + (vector unsigned int)__b); } static vector signed short __ATTRS_o_ai vec_eqv(vector signed short __a, @@ -1978,70 +2063,33 @@ (vector unsigned int)__b); } -static vector signed short __ATTRS_o_ai vec_eqv(vector bool short __a, - vector signed short __b) { - return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector signed short __ATTRS_o_ai vec_eqv(vector signed short __a, - vector bool short __b) { - return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - static vector unsigned short __ATTRS_o_ai vec_eqv(vector unsigned short __a, vector unsigned short __b) { return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } -static vector unsigned short __ATTRS_o_ai vec_eqv(vector bool short __a, - vector unsigned short __b) { - return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector unsigned short __ATTRS_o_ai vec_eqv(vector unsigned short __a, - vector bool short __b) { - return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector signed int __ATTRS_o_ai vec_eqv(vector signed int __a, - vector signed int __b) { - return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector signed int __ATTRS_o_ai vec_eqv(vector bool int __a, - vector signed int __b) { - return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, +static vector bool short __ATTRS_o_ai vec_eqv(vector bool short __a, + vector bool short __b) { + return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } static vector signed int __ATTRS_o_ai vec_eqv(vector signed int __a, - vector bool int __b) { + vector signed int __b) { return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } static vector unsigned int __ATTRS_o_ai vec_eqv(vector unsigned int __a, vector unsigned int __b) { - return __builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector unsigned int __ATTRS_o_ai vec_eqv(vector bool int __a, - vector unsigned int __b) { - return __builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); + return __builtin_vsx_xxleqv(__a, __b); } -static vector unsigned int __ATTRS_o_ai vec_eqv(vector unsigned int __a, - vector bool int __b) { - return __builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); +static vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, + vector bool int __b) { + return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, + (vector unsigned int)__b); } static vector signed long long __ATTRS_o_ai @@ -2050,33 +2098,15 @@ __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } -static vector signed long long __ATTRS_o_ai -vec_eqv(vector bool long long __a, vector signed long long __b) { - return (vector signed long long) - __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); -} - -static vector signed long long __ATTRS_o_ai -vec_eqv(vector signed long long __a, vector bool long long __b) { - return (vector signed long long) - __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); -} - static vector unsigned long long __ATTRS_o_ai vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { return (vector unsigned long long) __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } -static vector unsigned long long __ATTRS_o_ai -vec_eqv(vector bool long long __a, vector unsigned long long __b) { - return (vector unsigned long long) - __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); -} - -static vector unsigned long long __ATTRS_o_ai -vec_eqv(vector unsigned long long __a, vector bool long long __b) { - return (vector unsigned long long) +static vector bool long long __ATTRS_o_ai +vec_eqv(vector bool long long __a, vector bool long long __b) { + return (vector bool long long) __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } @@ -2085,35 +2115,11 @@ (vector unsigned int)__b); } -static vector float __ATTRS_o_ai vec_eqv(vector bool int __a, - vector float __b) { - return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector float __ATTRS_o_ai vec_eqv(vector float __a, - vector bool int __b) { - return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - static vector double __ATTRS_o_ai vec_eqv(vector double __a, vector double __b) { return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b); } - -static vector double __ATTRS_o_ai vec_eqv(vector bool long long __a, - vector double __b) { - return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} - -static vector double __ATTRS_o_ai vec_eqv(vector double __a, - vector bool long long __b) { - return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, - (vector unsigned int)__b); -} #endif /* vec_expte */ @@ -2815,6 +2821,38 @@ #endif /* vec_madd */ +static vector signed short __ATTRS_o_ai +vec_mladd(vector signed short, vector signed short, vector signed short); +static vector signed short __ATTRS_o_ai +vec_mladd(vector signed short, vector unsigned short, vector unsigned short); +static vector signed short __ATTRS_o_ai +vec_mladd(vector unsigned short, vector signed short, vector signed short); +static vector unsigned short __ATTRS_o_ai +vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); + +static vector signed short __ATTRS_o_ai +vec_madd(vector signed short __a, vector signed short __b, + vector signed short __c) { + return vec_mladd(__a, __b, __c); +} + +static vector signed short __ATTRS_o_ai +vec_madd(vector signed short __a, vector unsigned short __b, + vector unsigned short __c) { + return vec_mladd(__a, __b, __c); +} + +static vector signed short __ATTRS_o_ai +vec_madd(vector unsigned short __a, vector signed short __b, + vector signed short __c) { + return vec_mladd(__a, __b, __c); +} + +static vector unsigned short __ATTRS_o_ai +vec_madd(vector unsigned short __a, vector unsigned short __b, + vector unsigned short __c) { + return vec_mladd(__a, __b, __c); +} static vector float __ATTRS_o_ai vec_madd(vector float __a, vector float __b, vector float __c) { @@ -3256,6 +3294,16 @@ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17)); } + +static vector bool long long __ATTRS_o_ai +vec_mergeh(vector bool long long __a, vector bool long long __b) { + return vec_perm(__a, __b, + (vector unsigned char)(0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x10, 0x11, 0x12, 0x13, + 0x14, 0x15, 0x16, 0x17)); +} + static vector double __ATTRS_o_ai vec_mergeh(vector double __a, vector double __b) { return vec_perm(__a, __b, @@ -3519,6 +3567,14 @@ 0x18, 0X19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F)); } +static vector bool long long __ATTRS_o_ai +vec_mergel(vector bool long long __a, vector bool long long __b) { + return vec_perm(__a, __b, + (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F, + 0x18, 0X19, 0x1A, 0x1B, + 0x1C, 0x1D, 0x1E, 0x1F)); +} static vector double __ATTRS_o_ai vec_mergel(vector double __a, vector double __b) { return vec_perm(__a, __b, @@ -4439,6 +4495,11 @@ return ~(__a & __b); } +static vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, + vector bool char __b) { + return ~(__a & __b); +} + static vector signed short __ATTRS_o_ai vec_nand(vector signed short __a, vector signed short __b) { return ~(__a & __b); @@ -4465,8 +4526,8 @@ } -static vector unsigned short __ATTRS_o_ai vec_nand(vector bool short __a, - vector unsigned short __b) { +static vector bool short __ATTRS_o_ai vec_nand(vector bool short __a, + vector bool short __b) { return ~(__a & __b); } @@ -4501,6 +4562,11 @@ return ~(__a & __b); } +static vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, + vector bool int __b) { + return ~(__a & __b); +} + static vector signed long long __ATTRS_o_ai vec_nand(vector signed long long __a, vector signed long long __b) { return ~(__a & __b); @@ -4531,6 +4597,11 @@ return ~(__a & __b); } +static vector bool long long __ATTRS_o_ai +vec_nand(vector bool long long __a, vector bool long long __b) { + return ~(__a & __b); +} + #endif /* vec_nmadd */ @@ -4909,6 +4980,11 @@ return __a | ~__b; } +static vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, + vector bool char __b) { + return __a | ~__b; +} + static vector signed short __ATTRS_o_ai vec_orc(vector signed short __a, vector signed short __b) { return __a | ~__b; @@ -4939,6 +5015,11 @@ return __a | ~__b; } +static vector bool short __ATTRS_o_ai vec_orc(vector bool short __a, + vector bool short __b) { + return __a | ~__b; +} + static vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, vector signed int __b) { return __a | ~__b; @@ -4969,6 +5050,11 @@ return __a | ~__b; } +static vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, + vector bool int __b) { + return __a | ~__b; +} + static vector signed long long __ATTRS_o_ai vec_orc(vector signed long long __a, vector signed long long __b) { return __a | ~__b; @@ -4998,6 +5084,11 @@ vec_orc(vector bool long long __a, vector unsigned long long __b) { return __a | ~__b; } + +static vector bool long long __ATTRS_o_ai +vec_orc(vector bool long long __a, vector bool long long __b) { + return __a | ~__b; +} #endif /* vec_vor */ @@ -9191,17 +9282,47 @@ } #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) -static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) { +#ifdef __VSX__ +static vector signed long long __ATTRS_o_ai +vec_sub(vector signed long long __a, vector signed long long __b) { return __a - __b; } -#ifdef __VSX__ +static vector signed long long __ATTRS_o_ai +vec_sub(vector bool long long __a, vector signed long long __b) { + return (vector signed long long)__a - __b; +} + +static vector signed long long __ATTRS_o_ai +vec_sub(vector signed long long __a, vector bool long long __b) { + return __a - (vector signed long long)__b; +} + +static vector unsigned long long __ATTRS_o_ai +vec_sub(vector unsigned long long __a, vector unsigned long long __b) { + return __a - __b; +} + +static vector unsigned long long __ATTRS_o_ai +vec_sub(vector bool long long __a, vector unsigned long long __b) { + return (vector unsigned long long)__a - __b; +} + +static vector unsigned long long __ATTRS_o_ai +vec_sub(vector unsigned long long __a, vector bool long long __b) { + return __a - (vector unsigned long long)__b; +} + static vector double __ATTRS_o_ai vec_sub(vector double __a, vector double __b) { return __a - __b; } #endif +static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) { + return __a - __b; +} + /* vec_vsububm */ #define __builtin_altivec_vsububm vec_vsububm @@ -10390,7 +10511,12 @@ return __a[__b]; } -static short __ATTRS_o_ai vec_extract(vector short __a, int __b) { +static unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, + int __b) { + return __a[__b]; +} + +static signed short __ATTRS_o_ai vec_extract(vector signed short __a, int __b) { return __a[__b]; } @@ -10399,7 +10525,12 @@ return __a[__b]; } -static int __ATTRS_o_ai vec_extract(vector int __a, int __b) { +static unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, + int __b) { + return __a[__b]; +} + +static signed int __ATTRS_o_ai vec_extract(vector signed int __a, int __b) { return __a[__b]; } @@ -10407,10 +10538,33 @@ return __a[__b]; } +static unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, int __b) { + return __a[__b]; +} + +static signed long long __ATTRS_o_ai vec_extract(vector signed long long __a, + int __b) { + return __a[__b]; +} + +static unsigned long long __ATTRS_o_ai +vec_extract(vector unsigned long long __a, int __b) { + return __a[__b]; +} + +static unsigned long long __ATTRS_o_ai vec_extract(vector bool long long __a, + int __b) { + return __a[__b]; +} + static float __ATTRS_o_ai vec_extract(vector float __a, int __b) { return __a[__b]; } +static double __ATTRS_o_ai vec_extract(vector double __a, int __b) { + return __a[__b]; +} + /* vec_insert */ static vector signed char __ATTRS_o_ai vec_insert(signed char __a, @@ -10427,8 +10581,16 @@ return __b; } -static vector short __ATTRS_o_ai vec_insert(short __a, vector short __b, - int __c) { +static vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, + vector bool char __b, + int __c) { + __b[__c] = __a; + return __b; +} + +static vector signed short __ATTRS_o_ai vec_insert(signed short __a, + vector signed short __b, + int __c) { __b[__c] = __a; return __b; } @@ -10440,7 +10602,16 @@ return __b; } -static vector int __ATTRS_o_ai vec_insert(int __a, vector int __b, int __c) { +static vector bool short __ATTRS_o_ai vec_insert(unsigned short __a, + vector bool short __b, + int __c) { + __b[__c] = __a; + return __b; +} + +static vector signed int __ATTRS_o_ai vec_insert(signed int __a, + vector signed int __b, + int __c) { __b[__c] = __a; return __b; } @@ -10452,6 +10623,37 @@ return __b; } +static vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, + vector bool int __b, + int __c) { + __b[__c] = __a; + return __b; +} + +static vector signed long long __ATTRS_o_ai +vec_insert(signed long long __a, vector signed long long __b, int __c) { + __b[__c] = __a; + return __b; +} + +static vector unsigned long long __ATTRS_o_ai +vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { + __b[__c] = __a; + return __b; +} + +static vector bool long long __ATTRS_o_ai +vec_insert(unsigned long long __a, vector bool long long __b, int __c) { + __b[__c] = __a; + return __b; +} +static vector double __ATTRS_o_ai vec_insert(double __a, vector double __b, + int __c) { + __b[__c] = __a; + return __b; +} + + static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b, int __c) { __b[__c] = __a; @@ -11376,6 +11578,33 @@ return (vector unsigned int)(__a); } +#ifdef __VSX__ +static vector signed long long __ATTRS_o_ai vec_splats(signed long long __a) { + return (vector signed long long)(__a); +} + +static vector unsigned long long __ATTRS_o_ai +vec_splats(unsigned long long __a) { + return (vector unsigned long long)(__a); +} + +#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) +static vector signed __int128 __ATTRS_o_ai vec_splats(signed __int128 __a) { + return (vector signed __int128)(__a); +} + +static vector unsigned __int128 __ATTRS_o_ai +vec_splats(unsigned __int128 __a) { + return (vector unsigned __int128)(__a); +} + +#endif + +static vector double __ATTRS_o_ai vec_splats(double __a) { + return (vector double)(__a); +} +#endif + static vector float __ATTRS_o_ai vec_splats(float __a) { return (vector float)(__a); } @@ -11546,8 +11775,18 @@ #endif static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); +#endif +} + +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_eq(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); } +#endif /* vec_all_ge */ @@ -11698,8 +11937,18 @@ #endif static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_vcmpgesp_p(__CR6_LT, __a, __b); +#else return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); +#endif +} + +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_ge(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); } +#endif /* vec_all_gt */ @@ -11850,9 +12099,19 @@ #endif static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); +#endif } +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_gt(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); +} +#endif + /* vec_all_in */ static int __attribute__((__always_inline__)) @@ -12010,8 +12269,18 @@ #endif static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); +#else return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); +#endif +} + +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_le(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); } +#endif /* vec_all_lt */ @@ -12163,14 +12432,34 @@ #endif static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); +#endif +} + +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_lt(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); } +#endif /* vec_all_nan */ -static int __attribute__((__always_inline__)) vec_all_nan(vector float __a) { +static int __ATTRS_o_ai vec_all_nan(vector float __a) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); +#endif +} + +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_nan(vector double __a) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); } +#endif /* vec_all_ne */ @@ -12337,23 +12626,55 @@ #endif static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); +#endif } +#ifdef __VSX__ +static int __ATTRS_o_ai vec_all_ne(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); +} +#endif + /* vec_all_nge */ -static int __attribute__((__always_inline__)) +static int __ATTRS_o_ai vec_all_nge(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); +#else return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); +#endif } +#ifdef __VSX__ +static int __ATTRS_o_ai +vec_all_nge(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); +} +#endif + /* vec_all_ngt */ -static int __attribute__((__always_inline__)) +static int __ATTRS_o_ai vec_all_ngt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); +#endif } +#ifdef __VSX__ +static int __ATTRS_o_ai +vec_all_ngt(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); +} +#endif + /* vec_all_nle */ static int __attribute__((__always_inline__)) @@ -12539,8 +12860,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_eq(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); +} +#endif + static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); +#endif } /* vec_any_ge */ @@ -12699,8 +13030,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_ge(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); +} +#endif + static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); +#else return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); +#endif } /* vec_any_gt */ @@ -12859,8 +13200,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_gt(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); +} +#endif + static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); +#endif } /* vec_any_le */ @@ -13019,8 +13370,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_le(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); +} +#endif + static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); +#else return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); +#endif } /* vec_any_lt */ @@ -13179,8 +13540,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_lt(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); +} +#endif + static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); +#else return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); +#endif } /* vec_any_nan */ @@ -13353,8 +13724,18 @@ } #endif +#ifdef __VSX__ +static int __ATTRS_o_ai vec_any_ne(vector double __a, vector double __b) { + return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); +} +#endif + static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) { +#ifdef __VSX__ + return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); +#else return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); +#endif } /* vec_any_nge */ @@ -13416,6 +13797,12 @@ removed with -mno-crypto). This is under development. */ #ifdef __CRYPTO__ +#define vec_sbox_be __builtin_altivec_crypto_vsbox +#define vec_cipher_be __builtin_altivec_crypto_vcipher +#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast +#define vec_ncipher_be __builtin_altivec_crypto_vncipher +#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast + static vector unsigned long long __attribute__((__always_inline__)) __builtin_crypto_vsbox(vector unsigned long long __a) { return __builtin_altivec_crypto_vsbox(__a); @@ -13447,6 +13834,11 @@ #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw + +#define vec_shasigma_be(X, Y, Z) \ + _Generic((X), vector unsigned int: __builtin_crypto_vshasigmaw, \ + vector unsigned long long: __builtin_crypto_vshasigmad) \ +((X), (Y), (Z)) #endif #ifdef __POWER8_VECTOR__ @@ -13494,8 +13886,9 @@ return __builtin_altivec_crypto_vpmsumw(__a, __b); } -static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpmsumb( - vector unsigned long long __a, vector unsigned long long __b) { +static vector unsigned long long __ATTRS_o_ai +__builtin_crypto_vpmsumb(vector unsigned long long __a, + vector unsigned long long __b) { return __builtin_altivec_crypto_vpmsumd(__a, __b); } @@ -13504,6 +13897,9 @@ return __builtin_altivec_vgbbd((vector unsigned char) __a); } +#define vec_pmsum_be __builtin_crypto_vpmsumb +#define vec_gb __builtin_altivec_vgbbd + static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a) { return __builtin_altivec_vgbbd(__a); @@ -13521,6 +13917,12 @@ { return __builtin_altivec_vbpermq(__a, __b); } + +static vector unsigned long long __attribute__((__always_inline__)) +vec_bperm (vector unsigned __int128 __a, vector unsigned char __b) { + return __builtin_altivec_vbpermq((vector unsigned char) __a, + (vector unsigned char) __b); +} #endif #undef __ATTRS_o_ai