]> granicus.if.org Git - zfs/commitdiff
Enable clang to use intrinsics for lz4
authorMatthew Macy <mmacy@mattmacy.io>
Tue, 1 Oct 2019 20:17:32 +0000 (13:17 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 1 Oct 2019 20:17:32 +0000 (13:17 -0700)
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

module/zfs/lz4.c

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