diff options
author | Michał Górny <mgorny@moritz.systems> | 2022-04-19 01:38:54 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-19 01:38:54 +0000 |
commit | 5995d03db778b017fa8692172af7714e7592f494 (patch) | |
tree | 4b38033d0130f157bbe58b0ba04b50ade7b8dcdf | |
parent | f0a041be50a45ab4c53dcd4d2c9c9e93be513462 (diff) | |
parent | 20ca2dc226a7780a7e73d9a32307aff6f07d4901 (diff) | |
download | scudo-5995d03db778b017fa8692172af7714e7592f494.tar.gz |
[compiler-rt] [scudo] Use -mcrc32 on x86 when available am: 47318d28f4 am: a060512444 am: 195a29847a am: 20ca2dc226
Original change: https://android-review.googlesource.com/c/platform/external/scudo/+/2063221
Change-Id: If9e411b4255dc4c5ff02e2094ad5e75c50d20428
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | standalone/checksum.h | 5 | ||||
-rw-r--r-- | standalone/chunk.h | 4 | ||||
-rw-r--r-- | standalone/crc32_hw.cpp | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/standalone/checksum.h b/standalone/checksum.h index a63b1b4f064..df3299543ae 100644 --- a/standalone/checksum.h +++ b/standalone/checksum.h @@ -12,12 +12,13 @@ #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__) || defined(__SSE4_2__) +// NB: clang has <crc32intrin.h> but GCC does not #include <smmintrin.h> #define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64) #endif diff --git a/standalone/chunk.h b/standalone/chunk.h index 69b8e1b12a9..0581420dfc9 100644 --- a/standalone/chunk.h +++ b/standalone/chunk.h @@ -25,7 +25,7 @@ inline u16 computeChecksum(u32 Seed, uptr Value, uptr *Array, uptr ArraySize) { // as opposed to only for crc32_hw.cpp. This means that other hardware // specific instructions were likely emitted at other places, and as a result // there is no reason to not use it here. -#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) +#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) u32 Crc = static_cast<u32>(CRC32_INTRINSIC(Seed, Value)); for (uptr I = 0; I < ArraySize; I++) Crc = static_cast<u32>(CRC32_INTRINSIC(Crc, Array[I])); @@ -42,7 +42,7 @@ inline u16 computeChecksum(u32 Seed, uptr Value, uptr *Array, uptr ArraySize) { Checksum = computeBSDChecksum(Checksum, Array[I]); return Checksum; } -#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) +#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) } namespace Chunk { diff --git a/standalone/crc32_hw.cpp b/standalone/crc32_hw.cpp index 62841ba5101..d13c615498f 100644 --- a/standalone/crc32_hw.cpp +++ b/standalone/crc32_hw.cpp @@ -10,10 +10,10 @@ namespace scudo { -#if defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) +#if defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) u32 computeHardwareCRC32(u32 Crc, uptr Data) { return static_cast<u32>(CRC32_INTRINSIC(Crc, Data)); } -#endif // defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) +#endif // defined(__CRC32__) || defined(__SSE4_2__) || defined(__ARM_FEATURE_CRC32) } // namespace scudo |