From 58ba57346c5ea69965897af193b6641f5965c7d6 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Wed, 4 Jan 2023 09:02:12 -0800 Subject: Require 64-bit builds on x86 to use CRC32 hardware acceleration 32-bit builds with SSE 4.2 do exist, and these builds do not work without this patch. PiperOrigin-RevId: 499498979 Change-Id: I0ade09068804655652c07d0f1ef13554464a1558 --- absl/crc/internal/crc32_x86_arm_combined_simd.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'absl/crc') diff --git a/absl/crc/internal/crc32_x86_arm_combined_simd.h b/absl/crc/internal/crc32_x86_arm_combined_simd.h index f23cd75e..344042d8 100644 --- a/absl/crc/internal/crc32_x86_arm_combined_simd.h +++ b/absl/crc/internal/crc32_x86_arm_combined_simd.h @@ -25,8 +25,10 @@ // We define a translation layer for both x86 and ARM for the ease of use and // most performance gains. -// We need CRC (part of SSE 4.2) and PCLMULQDQ instructions. -#if defined(__SSE4_2__) && defined(__PCLMUL__) +// This implementation requires 64-bit CRC instructions (part of SSE 4.2) and +// PCLMULQDQ instructions. 32-bit builds with SSE 4.2 do exist, so the +// __x86_64__ condition is necessary. +#if defined(__x86_64__) && defined(__SSE4_2__) && defined(__PCLMUL__) #include #define ABSL_CRC_INTERNAL_HAVE_X86_SIMD -- cgit v1.2.3