build: Don't call assembly an optimization

because we don't know whether it's an optimization.
This commit is contained in:
Tim Ruffing 2023-11-23 22:51:48 +01:00
parent 2f0762fa8f
commit f07cead0ca
2 changed files with 12 additions and 12 deletions

View File

@ -107,7 +107,7 @@ if(SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
endif() endif()
mark_as_advanced(FORCE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY) mark_as_advanced(FORCE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
set(SECP256K1_ASM "AUTO" CACHE STRING "Assembly optimizations to use: \"AUTO\", \"OFF\", \"x86_64\" or \"arm32\" (experimental). [default=AUTO]") set(SECP256K1_ASM "AUTO" CACHE STRING "Assembly to use: \"AUTO\", \"OFF\", \"x86_64\" or \"arm32\" (experimental). [default=AUTO]")
set_property(CACHE SECP256K1_ASM PROPERTY STRINGS "AUTO" "OFF" "x86_64" "arm32") set_property(CACHE SECP256K1_ASM PROPERTY STRINGS "AUTO" "OFF" "x86_64" "arm32")
check_string_option_value(SECP256K1_ASM) check_string_option_value(SECP256K1_ASM)
if(SECP256K1_ASM STREQUAL "arm32") if(SECP256K1_ASM STREQUAL "arm32")
@ -117,7 +117,7 @@ if(SECP256K1_ASM STREQUAL "arm32")
if(HAVE_ARM32_ASM) if(HAVE_ARM32_ASM)
add_compile_definitions(USE_EXTERNAL_ASM=1) add_compile_definitions(USE_EXTERNAL_ASM=1)
else() else()
message(FATAL_ERROR "ARM32 assembly optimization requested but not available.") message(FATAL_ERROR "ARM32 assembly requested but not available.")
endif() endif()
elseif(SECP256K1_ASM) elseif(SECP256K1_ASM)
include(CheckX86_64Assembly) include(CheckX86_64Assembly)
@ -128,14 +128,14 @@ elseif(SECP256K1_ASM)
elseif(SECP256K1_ASM STREQUAL "AUTO") elseif(SECP256K1_ASM STREQUAL "AUTO")
set(SECP256K1_ASM "OFF") set(SECP256K1_ASM "OFF")
else() else()
message(FATAL_ERROR "x86_64 assembly optimization requested but not available.") message(FATAL_ERROR "x86_64 assembly requested but not available.")
endif() endif()
endif() endif()
option(SECP256K1_EXPERIMENTAL "Allow experimental configuration options." OFF) option(SECP256K1_EXPERIMENTAL "Allow experimental configuration options." OFF)
if(NOT SECP256K1_EXPERIMENTAL) if(NOT SECP256K1_EXPERIMENTAL)
if(SECP256K1_ASM STREQUAL "arm32") if(SECP256K1_ASM STREQUAL "arm32")
message(FATAL_ERROR "ARM32 assembly optimization is experimental. Use -DSECP256K1_EXPERIMENTAL=ON to allow.") message(FATAL_ERROR "ARM32 assembly is experimental. Use -DSECP256K1_EXPERIMENTAL=ON to allow.")
endif() endif()
endif() endif()
@ -280,7 +280,7 @@ message("Parameters:")
message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}") message(" ecmult window size .................. ${SECP256K1_ECMULT_WINDOW_SIZE}")
message(" ecmult gen precision bits ........... ${SECP256K1_ECMULT_GEN_PREC_BITS}") message(" ecmult gen precision bits ........... ${SECP256K1_ECMULT_GEN_PREC_BITS}")
message("Optional features:") message("Optional features:")
message(" assembly optimization ............... ${SECP256K1_ASM}") message(" assembly ............................ ${SECP256K1_ASM}")
message(" external callbacks .................. ${SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS}") message(" external callbacks .................. ${SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS}")
if(SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY) if(SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
message(" wide multiplication (test-only) ..... ${SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY}") message(" wide multiplication (test-only) ..... ${SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY}")

View File

@ -201,7 +201,7 @@ AC_ARG_ENABLE(external_default_callbacks,
AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto]) AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto])
AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm32|no|auto], AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm32|no|auto],
[assembly optimizations to use (experimental: arm32) [default=auto]])],[req_asm=$withval], [req_asm=auto]) [assembly to use (experimental: arm32) [default=auto]])],[req_asm=$withval], [req_asm=auto])
AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto], AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
[window size for ecmult precomputation for verification, specified as integer in range [2..24].] [window size for ecmult precomputation for verification, specified as integer in range [2..24].]
@ -279,24 +279,24 @@ else
x86_64) x86_64)
SECP_X86_64_ASM_CHECK SECP_X86_64_ASM_CHECK
if test x"$has_x86_64_asm" != x"yes"; then if test x"$has_x86_64_asm" != x"yes"; then
AC_MSG_ERROR([x86_64 assembly optimization requested but not available]) AC_MSG_ERROR([x86_64 assembly requested but not available])
fi fi
;; ;;
arm32) arm32)
SECP_ARM32_ASM_CHECK SECP_ARM32_ASM_CHECK
if test x"$has_arm32_asm" != x"yes"; then if test x"$has_arm32_asm" != x"yes"; then
AC_MSG_ERROR([ARM32 assembly optimization requested but not available]) AC_MSG_ERROR([ARM32 assembly requested but not available])
fi fi
;; ;;
no) no)
;; ;;
*) *)
AC_MSG_ERROR([invalid assembly optimization selection]) AC_MSG_ERROR([invalid assembly selection])
;; ;;
esac esac
fi fi
# Select assembly optimization # Select assembly
enable_external_asm=no enable_external_asm=no
case $set_asm in case $set_asm in
@ -309,7 +309,7 @@ arm32)
no) no)
;; ;;
*) *)
AC_MSG_ERROR([invalid assembly optimizations]) AC_MSG_ERROR([invalid assembly selection])
;; ;;
esac esac
@ -425,7 +425,7 @@ if test x"$enable_experimental" = x"yes"; then
AC_MSG_NOTICE([******]) AC_MSG_NOTICE([******])
else else
if test x"$set_asm" = x"arm32"; then if test x"$set_asm" = x"arm32"; then
AC_MSG_ERROR([ARM32 assembly optimization is experimental. Use --enable-experimental to allow.]) AC_MSG_ERROR([ARM32 assembly is experimental. Use --enable-experimental to allow.])
fi fi
fi fi