]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: memcmplen.h: Use 8-byte method on 64-bit unaligned archs
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 13 Jan 2025 06:44:58 +0000 (08:44 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 13 Jan 2025 06:44:58 +0000 (08:44 +0200)
Previously it was enabled only on x86-64 and ARM64 when also support
for unaligned access was detected or manually enabled at built time.

In the default build configuration, the 8-byte method is now enabled
also on 64-bit RISC-V and 64-bit PowerPC (both endiannesses). It was
reported that on big endian POWER9, encoding time may reduce 12-13 %.

This change only affects builds with GCC and Clang because the code
uses __builtin_ctzll or __builtin_clzll.

Thanks to Marcus Comstedt for testing on POWER9.

src/liblzma/common/memcmplen.h

index 86b5d6f37eb385646613a9fd5dbb88d75ea7197f..82e9085422954b254d6e44e58b87d21297a89406 100644 (file)
@@ -58,8 +58,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
 
 #if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
                && (((TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) \
-                               && (defined(__x86_64__) \
-                                       || defined(__aarch64__))) \
+                               && SIZE_MAX == UINT64_MAX) \
                        || (defined(__INTEL_COMPILER) && defined(__x86_64__)) \
                        || (defined(__INTEL_COMPILER) && defined(_M_X64)) \
                        || (defined(_MSC_VER) && (defined(_M_X64) \