@@ -355,7 +355,7 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
355
355
AX_CHECK_COMPILE_FLAG ( [ -Wimplicit-fallthrough] ,[ NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-implicit-fallthrough"] ,,[ [ $CXXFLAG_WERROR] ] )
356
356
fi
357
357
358
- enable_hwcrc32 =no
358
+ enable_sse42 =no
359
359
enable_sse41=no
360
360
enable_avx2=no
361
361
enable_shani=no
@@ -365,14 +365,16 @@ if test "x$use_asm" = "xyes"; then
365
365
dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will
366
366
dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime
367
367
dnl compatibility.
368
+
369
+ dnl x86
368
370
AX_CHECK_COMPILE_FLAG ( [ -msse4.2] ,[ [ SSE42_CXXFLAGS="-msse4.2"] ] ,,[ [ $CXXFLAG_WERROR] ] )
369
371
AX_CHECK_COMPILE_FLAG ( [ -msse4.1] ,[ [ SSE41_CXXFLAGS="-msse4.1"] ] ,,[ [ $CXXFLAG_WERROR] ] )
370
372
AX_CHECK_COMPILE_FLAG ( [ -mavx -mavx2] ,[ [ AVX2_CXXFLAGS="-mavx -mavx2"] ] ,,[ [ $CXXFLAG_WERROR] ] )
371
373
AX_CHECK_COMPILE_FLAG ( [ -msse4 -msha] ,[ [ SHANI_CXXFLAGS="-msse4 -msha"] ] ,,[ [ $CXXFLAG_WERROR] ] )
372
374
373
375
TEMP_CXXFLAGS="$CXXFLAGS"
374
376
CXXFLAGS="$CXXFLAGS $SSE42_CXXFLAGS"
375
- AC_MSG_CHECKING ( for assembler crc32 support )
377
+ AC_MSG_CHECKING ( for SSE4.2 intrinsics )
376
378
AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
377
379
#include <stdint.h>
378
380
#if defined(_MSC_VER)
@@ -387,7 +389,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
387
389
l = _mm_crc32_u64(l, 0);
388
390
return l;
389
391
] ] ) ] ,
390
- [ AC_MSG_RESULT ( yes ) ; enable_hwcrc32 =yes] ,
392
+ [ AC_MSG_RESULT ( yes ) ; enable_sse42 =yes] ,
391
393
[ AC_MSG_RESULT ( no ) ]
392
394
)
393
395
CXXFLAGS="$TEMP_CXXFLAGS"
@@ -439,6 +441,24 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
439
441
)
440
442
CXXFLAGS="$TEMP_CXXFLAGS"
441
443
444
+ # ARM
445
+ AX_CHECK_COMPILE_FLAG ( [ -march=armv8-a+crc+crypto] ,[ [ ARM_CRC_CXXFLAGS="-march=armv8-a+crc+crypto"] ] ,,[ [ $CXXFLAG_WERROR] ] )
446
+
447
+ TEMP_CXXFLAGS="$CXXFLAGS"
448
+ CXXFLAGS="$CXXFLAGS $ARM_CRC_CXXFLAGS"
449
+ AC_MSG_CHECKING ( for ARM CRC32 intrinsics )
450
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
451
+ #include <arm_acle.h>
452
+ #include <arm_neon.h>
453
+ ] ] ,[ [
454
+ __crc32cb(0, 0); __crc32ch(0, 0); __crc32cw(0, 0); __crc32cd(0, 0);
455
+ vmull_p64(0, 0);
456
+ ] ] ) ] ,
457
+ [ AC_MSG_RESULT ( yes ) ; enable_arm_crc=yes; ] ,
458
+ [ AC_MSG_RESULT ( no ) ]
459
+ )
460
+ CXXFLAGS="$TEMP_CXXFLAGS"
461
+
442
462
fi
443
463
444
464
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
@@ -956,6 +976,50 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
956
976
[ AC_MSG_RESULT ( no ) ; HAVE_O_CLOEXEC=0 ]
957
977
)
958
978
979
+ dnl crc32c platform checks
980
+ AC_MSG_CHECKING ( for __builtin_prefetch )
981
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [ ] ] , [ [
982
+ char data = 0;
983
+ const char* address = &data;
984
+ __builtin_prefetch(address, 0, 0);
985
+ ] ] ) ] ,
986
+ [ AC_MSG_RESULT ( yes ) ; HAVE_BUILTIN_PREFETCH=1 ] ,
987
+ [ AC_MSG_RESULT ( no ) ; HAVE_BUILTIN_PREFETCH=0 ]
988
+ )
989
+
990
+ AC_MSG_CHECKING ( for _mm_prefetch )
991
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [ #include <xmmintrin.h>] ] , [ [
992
+ char data = 0;
993
+ const char* address = &data;
994
+ _mm_prefetch(address, _MM_HINT_NTA);
995
+ ] ] ) ] ,
996
+ [ AC_MSG_RESULT ( yes ) ; HAVE_MM_PREFETCH=1 ] ,
997
+ [ AC_MSG_RESULT ( no ) ; HAVE_MM_PREFETCH=0 ]
998
+ )
999
+
1000
+ AC_MSG_CHECKING ( for strong getauxval support in the system headers )
1001
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
1002
+ #include <arm_acle.h>
1003
+ #include <arm_neon.h>
1004
+ #include <sys/auxv.h>
1005
+ ] ] , [ [
1006
+ getauxval(AT_HWCAP);
1007
+ ] ] ) ] ,
1008
+ [ AC_MSG_RESULT ( yes ) ; HAVE_STRONG_GETAUXVAL=1 ] ,
1009
+ [ AC_MSG_RESULT ( no ) ; HAVE_STRONG_GETAUXVAL=0 ]
1010
+ )
1011
+
1012
+ AC_MSG_CHECKING ( for weak getauxval support in the compiler )
1013
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [
1014
+ unsigned long getauxval(unsigned long type) __attribute__((weak));
1015
+ #define AT_HWCAP 16
1016
+ ] ] , [ [
1017
+ getauxval(AT_HWCAP);
1018
+ ] ] ) ] ,
1019
+ [ AC_MSG_RESULT ( yes ) ; HAVE_WEAK_GETAUXVAL=1 ] ,
1020
+ [ AC_MSG_RESULT ( no ) ; HAVE_WEAK_GETAUXVAL=0 ]
1021
+ )
1022
+
959
1023
dnl Check for reduced exports
960
1024
if test x$use_reduce_exports = xyes; then
961
1025
AX_CHECK_COMPILE_FLAG ( [ -fvisibility=hidden] ,[ RE_CXXFLAGS="-fvisibility=hidden"] ,
@@ -1511,10 +1575,11 @@ AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
1511
1575
AM_CONDITIONAL([ USE_LCOV] ,[ test x$use_lcov = xyes] )
1512
1576
AM_CONDITIONAL([ GLIBC_BACK_COMPAT] ,[ test x$use_glibc_compat = xyes] )
1513
1577
AM_CONDITIONAL([ HARDEN] ,[ test x$use_hardening = xyes] )
1514
- AM_CONDITIONAL([ ENABLE_HWCRC32 ] ,[ test x$enable_hwcrc32 = xyes] )
1578
+ AM_CONDITIONAL([ ENABLE_SSE42 ] ,[ test x$enable_sse42 = xyes] )
1515
1579
AM_CONDITIONAL([ ENABLE_SSE41] ,[ test x$enable_sse41 = xyes] )
1516
1580
AM_CONDITIONAL([ ENABLE_AVX2] ,[ test x$enable_avx2 = xyes] )
1517
1581
AM_CONDITIONAL([ ENABLE_SHANI] ,[ test x$enable_shani = xyes] )
1582
+ AM_CONDITIONAL([ ENABLE_ARM_CRC] ,[ test x$enable_arm_crc = xyes] )
1518
1583
AM_CONDITIONAL([ USE_ASM] ,[ test x$use_asm = xyes] )
1519
1584
AM_CONDITIONAL([ WORDS_BIGENDIAN] ,[ test x$ac_cv_c_bigendian = xyes] )
1520
1585
@@ -1563,6 +1628,7 @@ AC_SUBST(SSE42_CXXFLAGS)
1563
1628
AC_SUBST ( SSE41_CXXFLAGS )
1564
1629
AC_SUBST ( AVX2_CXXFLAGS )
1565
1630
AC_SUBST ( SHANI_CXXFLAGS )
1631
+ AC_SUBST ( ARM_CRC_CXXFLAGS )
1566
1632
AC_SUBST ( LIBTOOL_APP_LDFLAGS )
1567
1633
AC_SUBST ( USE_UPNP )
1568
1634
AC_SUBST ( USE_QRCODE )
@@ -1577,6 +1643,10 @@ AC_SUBST(QR_LIBS)
1577
1643
AC_SUBST ( HAVE_FDATASYNC )
1578
1644
AC_SUBST ( HAVE_FULLFSYNC )
1579
1645
AC_SUBST ( HAVE_O_CLOEXEC )
1646
+ AC_SUBST ( HAVE_BUILTIN_PREFETCH )
1647
+ AC_SUBST ( HAVE_MM_PREFETCH )
1648
+ AC_SUBST ( HAVE_STRONG_GETAUXVAL )
1649
+ AC_SUBST ( HAVE_WEAK_GETAUXVAL )
1580
1650
AC_CONFIG_FILES ( [ Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini] )
1581
1651
AC_CONFIG_FILES ( [ contrib/devtools/split-debug.sh] ,[ chmod +x contrib/devtools/split-debug.sh] )
1582
1652
AM_COND_IF([ HAVE_DOXYGEN] , [ AC_CONFIG_FILES ( [ doc/Doxyfile] ) ] )
0 commit comments