diff options
| author | Adam Stylinski <kungfujesus06@gmail.com> | 2026-03-07 12:43:02 -0500 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2026-03-20 18:17:43 +0100 |
| commit | 9b3bae8a619848f0ea9f4e731bd88ffefa4511e2 (patch) | |
| tree | 9e2c10ac98d119751792e2ce8ee56c06435f7914 /arch | |
| parent | d5095992a09e6e1a184d4841f5b8cde117b1d6a7 (diff) | |
| download | Project-Tick-9b3bae8a619848f0ea9f4e731bd88ffefa4511e2.tar.gz Project-Tick-9b3bae8a619848f0ea9f4e731bd88ffefa4511e2.zip | |
Add an altivec variant of "count_lengths" in inftrees
This accounts for a small bump in performance
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/power/power_intrins.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/power/power_intrins.h b/arch/power/power_intrins.h index 965387c9e9..3efcfb9722 100644 --- a/arch/power/power_intrins.h +++ b/arch/power/power_intrins.h @@ -26,11 +26,36 @@ #define __builtin_crypto_vpmsumd __builtin_crypto_vpmsumb #endif +#ifdef __VSX__ static inline __vector unsigned long long __attribute__((overloadable)) vec_ld(int __a, const __vector unsigned long long* __b) { return (__vector unsigned long long)__builtin_altivec_lvx(__a, __b); } +#endif #endif +/* There's no version of this that operates over unsigned and if casted, it does + * sign extension. Let's write an endian independent version and hope the compiler + * eliminates creating another zero idiom for the zero value if one exists locally */ +static inline vector unsigned short vec_unpackl(vector unsigned char a) { + vector unsigned char zero = vec_splat_u8(0); + +#if BYTE_ORDER == BIG_ENDIAN + return (vector unsigned short)vec_mergel(zero, a); +#else + return (vector unsigned short)vec_mergel(a, zero); +#endif +} + +static inline vector unsigned short vec_unpackh(vector unsigned char a) { + vector unsigned char zero = vec_splat_u8(0); + +#if BYTE_ORDER == BIG_ENDIAN + return (vector unsigned short)vec_mergeh(zero, a); +#else + return (vector unsigned short)vec_mergeh(a, zero); +#endif +} + #endif |
