Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: "Devulapalli, Raghuveer" <raghuveer.devulapalli@intel.com>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-07T21:00:51Z
Lists: pgsql-hackers
+ __attribute__((target("sse4.2")))
These need to be surrounded with
#if defined(__has_attribute) && __has_attribute (target)
so that we still attempt the check on compilers that don't support it
(e.g., MSVC).
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.
#
-# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
-# with the default compiler flags. If not, check if adding the -msse4.2
-# flag helps. CFLAGS_CRC is set to -msse4.2 if that's required.
+# Check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
+# with the __attribute__((target("sse4.2"))).
PGAC_SSE42_CRC32_INTRINSICS([])
-if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then
- PGAC_SSE42_CRC32_INTRINSICS([-msse4.2])
-fi
IIUC this means we will never set USE_SSE42_CRC32C_WITH_RUNTIME_CHECK. To
maintain the existing behavior, I think we need to still perform two
configure tests (one with __attribute__((target(...))) and another
without), and then we can choose whether to set USE_SSE42_CRC32C or
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK based on the results.
+ 'pg_crc32c_sse42_choose.c',
+ 'pg_crc32c_sse42.c',
Can we combine these?
--
nathan
Commits
-
Use __attribute__((target(...))) for SSE4.2 CRC-32C support.
- 4b03a27fafc9 18.0 landed
-
Move check for USE_AVX512_POPCNT_WITH_RUNTIME_CHECK.
- 4225276e2540 18.0 landed
-
Remove MSVC scripts
- 1301c80b2167 17.0 cited