Enable clang to use intrinsics for lz4

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #9385
This commit is contained in:
Matthew Macy 2019-10-01 13:17:32 -07:00 committed by Brian Behlendorf
parent bd76e6817c
commit 7111c86ca3
1 changed files with 3 additions and 3 deletions

View File

@ -383,7 +383,7 @@ static inline int
LZ4_NbCommonBytes(register U64 val) LZ4_NbCommonBytes(register U64 val)
{ {
#if defined(LZ4_BIG_ENDIAN) #if defined(LZ4_BIG_ENDIAN)
#if defined(__GNUC__) && (GCC_VERSION >= 304) && \ #if ((defined(__GNUC__) && (GCC_VERSION >= 304)) || defined(__clang__)) && \
!defined(LZ4_FORCE_SW_BITCOUNT) !defined(LZ4_FORCE_SW_BITCOUNT)
return (__builtin_clzll(val) >> 3); return (__builtin_clzll(val) >> 3);
#else #else
@ -404,7 +404,7 @@ LZ4_NbCommonBytes(register U64 val)
return (r); return (r);
#endif #endif
#else #else
#if defined(__GNUC__) && (GCC_VERSION >= 304) && \ #if ((defined(__GNUC__) && (GCC_VERSION >= 304)) || defined(__clang__)) && \
!defined(LZ4_FORCE_SW_BITCOUNT) !defined(LZ4_FORCE_SW_BITCOUNT)
return (__builtin_ctzll(val) >> 3); return (__builtin_ctzll(val) >> 3);
#else #else
@ -426,7 +426,7 @@ static inline int
LZ4_NbCommonBytes(register U32 val) LZ4_NbCommonBytes(register U32 val)
{ {
#if defined(LZ4_BIG_ENDIAN) #if defined(LZ4_BIG_ENDIAN)
#if defined(__GNUC__) && (GCC_VERSION >= 304) && \ #if ((defined(__GNUC__) && (GCC_VERSION >= 304)) || defined(__clang__)) && \
!defined(LZ4_FORCE_SW_BITCOUNT) !defined(LZ4_FORCE_SW_BITCOUNT)
return (__builtin_clz(val) >> 3); return (__builtin_clz(val) >> 3);
#else #else