mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Optimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86.
Eliminate the separate 'len' variable from the loops, and also use the 4 byte instruction. This shaves off a few more cycles. Even though this routine that uses the special SSE 4.2 instructions is much faster than a generic routine, it's still a hot spot, so let's make it as fast as possible. Change the configure test to not test _mm_crc32_u64. That variant is only available in the 64-bit x86-64 architecture, not in 32-bit x86. Modify pg_comp_crc32c_sse42 so that it only uses _mm_crc32_u64 on x86-64. With these changes, the SSE accelerated CRC-32C implementation can also be used on 32-bit x86 systems. This also fixes the 32-bit MSVC build.
This commit is contained in:
12
configure
vendored
12
configure
vendored
@ -14172,8 +14172,8 @@ fi
|
||||
# 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_SSE42 is set to -msse4.2 if that's required.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u64 with CFLAGS=" >&5
|
||||
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u64 with CFLAGS=... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=" >&5
|
||||
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... " >&6; }
|
||||
if ${pgac_cv_sse42_crc32_intrinsics_+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
@ -14189,7 +14189,7 @@ main ()
|
||||
{
|
||||
unsigned int crc = 0;
|
||||
crc = _mm_crc32_u8(crc, 0);
|
||||
crc = (unsigned int) _mm_crc32_u64(crc, 0);
|
||||
crc = _mm_crc32_u32(crc, 0);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@ -14212,8 +14212,8 @@ if test x"$pgac_cv_sse42_crc32_intrinsics_" = x"yes"; then
|
||||
fi
|
||||
|
||||
if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u64 with CFLAGS=-msse4.2" >&5
|
||||
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u64 with CFLAGS=-msse4.2... " >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2" >&5
|
||||
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=-msse4.2... " >&6; }
|
||||
if ${pgac_cv_sse42_crc32_intrinsics__msse4_2+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
@ -14229,7 +14229,7 @@ main ()
|
||||
{
|
||||
unsigned int crc = 0;
|
||||
crc = _mm_crc32_u8(crc, 0);
|
||||
crc = (unsigned int) _mm_crc32_u64(crc, 0);
|
||||
crc = _mm_crc32_u32(crc, 0);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user