Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit32057a0

Browse files
committed
Update configure probes for CFLAGS needed for ARM CRC instructions.
On ARM platforms where the baseline CPU target lacks CRC instructions,we need to supply a -march flag to persuade the compiler to compilesuch instructions. It turns out that our existing choice of"-march=armv8-a+crc" has not worked for some time, because recent gccwill interpret that as selecting software floating point, and thenwill spit up if the platform requires hard-float ABI, as most donowadays. The end result was to silently fall back to software CRC,which isn't very desirable since in practice almost all currentlyproduced ARM chips do have hardware CRC.We can fix this by using "-march=armv8-a+crc+simd" to enable thecorrect ABI choice. (This has no impact on the code actuallygenerated, since neither of the files we compile with this flagdoes any floating-point stuff, let alone SIMD.) Keep the test for"-march=armv8-a+crc" since that's required for soft-float ABI,but try that second since most platforms we're likely to build onuse hard-float.Since this isn't working as-intended on the last several years'worth of gcc releases, back-patch to all supported branches.Discussion:https://postgr.es/m/4496616.iHFcN1HehY@portable-bastien
1 parentf230e27 commit32057a0

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed

‎configure

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18240,7 +18240,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1824018240
# Check for ARMv8 CRC Extension intrinsics to do CRC calculations.
1824118241
#
1824218242
# First check if __crc32c* intrinsics can be used with the default compiler
18243-
# flags. If not, check if adding -march=armv8-a+crc flag helps.
18243+
# flags. If not, check if adding "-march=armv8-a+crc+simd" flag helps.
18244+
# On systems using soft-float ABI, "-march=armv8-a+crc" is required instead.
1824418245
# CFLAGS_ARMV8_CRC32C is set if the extra flag is required.
1824518246
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=" >&5
1824618247
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... " >&6; }
@@ -18283,7 +18284,48 @@ if test x"$pgac_cv_armv8_crc32c_intrinsics_" = x"yes"; then
1828318284
fi
1828418285

1828518286
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
18286-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc" >&5
18287+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd" >&5
18288+
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd... " >&6; }
18289+
if ${pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd+:} false; then :
18290+
$as_echo_n "(cached) " >&6
18291+
else
18292+
pgac_save_CFLAGS=$CFLAGS
18293+
CFLAGS="$pgac_save_CFLAGS -march=armv8-a+crc+simd"
18294+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18295+
/* end confdefs.h. */
18296+
#include <arm_acle.h>
18297+
int
18298+
main ()
18299+
{
18300+
unsigned int crc = 0;
18301+
crc = __crc32cb(crc, 0);
18302+
crc = __crc32ch(crc, 0);
18303+
crc = __crc32cw(crc, 0);
18304+
crc = __crc32cd(crc, 0);
18305+
/* return computed value, to prevent the above being optimized away */
18306+
return crc == 0;
18307+
;
18308+
return 0;
18309+
}
18310+
_ACEOF
18311+
if ac_fn_c_try_link "$LINENO"; then :
18312+
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd=yes
18313+
else
18314+
pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd=no
18315+
fi
18316+
rm -f core conftest.err conftest.$ac_objext \
18317+
conftest$ac_exeext conftest.$ac_ext
18318+
CFLAGS="$pgac_save_CFLAGS"
18319+
fi
18320+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" >&5
18321+
$as_echo "$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" >&6; }
18322+
if test x"$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrcpsimd" = x"yes"; then
18323+
CFLAGS_ARMV8_CRC32C="-march=armv8-a+crc+simd"
18324+
pgac_armv8_crc32c_intrinsics=yes
18325+
fi
18326+
18327+
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
18328+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc" >&5
1828718329
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... " >&6; }
1828818330
if ${pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc+:} false; then :
1828918331
$as_echo_n "(cached) " >&6
@@ -18323,6 +18365,7 @@ if test x"$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" = x"yes"; then
1832318365
pgac_armv8_crc32c_intrinsics=yes
1832418366
fi
1832518367

18368+
fi
1832618369
fi
1832718370

1832818371

‎configure.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,11 +2104,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
21042104
# Check for ARMv8 CRC Extension intrinsics to do CRC calculations.
21052105
#
21062106
# First check if __crc32c* intrinsics can be used with the default compiler
2107-
# flags. If not, check if adding -march=armv8-a+crc flag helps.
2107+
# flags. If not, check if adding "-march=armv8-a+crc+simd" flag helps.
2108+
# On systems using soft-float ABI, "-march=armv8-a+crc" is required instead.
21082109
# CFLAGS_ARMV8_CRC32C is set if the extra flag is required.
21092110
PGAC_ARMV8_CRC32C_INTRINSICS([])
21102111
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
2111-
PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc])
2112+
PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc+simd])
2113+
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
2114+
PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc])
2115+
fi
21122116
fi
21132117
AC_SUBST(CFLAGS_ARMV8_CRC32C)
21142118

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp