diff options
author | Warner Losh <[email protected]> | 2020-10-13 22:01:40 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-13 21:01:40 -0700 |
commit | 6ba2e72b7899771f588dc4557624c186be2c2176 (patch) | |
tree | cf39e5b04c5ca1cbb353297a4b00babb51ad9a3a /module | |
parent | 92286311f824dc0538e1eb2c8561ad3eb349c90f (diff) |
aarch64: Use proper guards for NEON instructions
The zstd code assumes that if you are on aarch64, you have NEON
instructions. This is not necessarily true. In a boot loader, where
you might not have the VFP properly initialized, these instructions
may not be available. It's also an error to include arm_neon.h when
the NEON insturctions aren't enabled. Change the guards for using the
NEON instructions from __aarch64__ to __ARM_NEON which is the standard
symbol for knowing if they are available.
__ARM_NEON is the proper symbol, defined in ARM C Language Extensions
Release 2.1 (https://developer.arm.com/documentation/ihi0053/d/). Some
sources suggest __ARM_NEON__, but that's the obsolete spelling from
prior versions of the standard.
Updated based on zstd pull request https://github.com/facebook/zstd/pull/2356
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Warner Losh <[email protected]>
Closes #11055
Diffstat (limited to 'module')
-rw-r--r-- | module/zstd/lib/zstd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/module/zstd/lib/zstd.c b/module/zstd/lib/zstd.c index 949b8e47e..acdd4d9da 100644 --- a/module/zstd/lib/zstd.c +++ b/module/zstd/lib/zstd.c @@ -3074,7 +3074,7 @@ size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cS /*-************************************* * Dependencies ***************************************/ -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) #include <arm_neon.h> #endif /**** skipping file: compiler.h ****/ @@ -6525,7 +6525,7 @@ static const U32 OF_defaultNormLog = OF_DEFAULTNORMLOG; * Shared functions to include for inlining *********************************************/ static void ZSTD_copy8(void* dst, const void* src) { -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src)); #else memcpy(dst, src, 8); @@ -6534,7 +6534,7 @@ static void ZSTD_copy8(void* dst, const void* src) { #define COPY8(d,s) { ZSTD_copy8(d,s); d+=8; s+=8; } static void ZSTD_copy16(void* dst, const void* src) { -#ifdef __aarch64__ +#if !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) vst1q_u8((uint8_t*)dst, vld1q_u8((const uint8_t*)src)); #else memcpy(dst, src, 16); |