summaryrefslogtreecommitdiff
path: root/gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h')
-rw-r--r--gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h b/gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h
index a63b1b4f064..f8eda81fd91 100644
--- a/gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h
+++ b/gnu/llvm/compiler-rt/lib/scudo/standalone/checksum.h
@@ -12,12 +12,17 @@
#include "internal_defs.h"
// Hardware CRC32 is supported at compilation via the following:
-// - for i386 & x86_64: -msse4.2
+// - for i386 & x86_64: -mcrc32 (earlier: -msse4.2)
// - for ARM & AArch64: -march=armv8-a+crc or -mcrc
// An additional check must be performed at runtime as well to make sure the
// emitted instructions are valid on the target host.
-#ifdef __SSE4_2__
+#if defined(__CRC32__)
+// NB: clang has <crc32intrin.h> but GCC does not
+#include <smmintrin.h>
+#define CRC32_INTRINSIC \
+ FIRST_32_SECOND_64(__builtin_ia32_crc32si, __builtin_ia32_crc32di)
+#elif defined(__SSE4_2__)
#include <smmintrin.h>
#define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
#endif