Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP WIP WIP 5x64 field representation #967

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ task:
- env: {WIDEMUL: int128, RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ECDH: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: {WIDEMUL: int128, ASM: x86_64}
- env: {WIDEMUL: int128, ASM: x86_64_gen}
- env: {WIDEMUL: int128, ASM: x86_64_maax}
- env: {WIDEMUL: int128, ASM: x86_64_mxaa}
- env: { RECOVERY: yes, EXPERIMENTAL: yes, SCHNORRSIG: yes}
- env: { STATICPRECOMPUTATION: no}
- env: {BUILD: distcheck, WITH_VALGRIND: no, CTIMETEST: no, BENCH: no}
Expand Down Expand Up @@ -226,6 +229,11 @@ task:
EXPERIMENTAL: yes
SCHNORRSIG: yes
CTIMETEST: no
matrix:
- env:
ASM: no
- env:
ASM: aarch64
<< : *MERGE_BASE
test_script:
- ./ci/cirrus.sh
Expand Down
18 changes: 14 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ noinst_HEADERS += src/ecmult_gen.h
noinst_HEADERS += src/ecmult_gen_impl.h
noinst_HEADERS += src/field_10x26.h
noinst_HEADERS += src/field_10x26_impl.h
noinst_HEADERS += src/field_5x52.h
noinst_HEADERS += src/field_5x52_impl.h
noinst_HEADERS += src/field_5x52_int128_impl.h
noinst_HEADERS += src/field_5x52_asm_impl.h
noinst_HEADERS += src/field_5x64.h
noinst_HEADERS += src/field_5x64_impl.h
noinst_HEADERS += src/modinv32.h
noinst_HEADERS += src/modinv32_impl.h
noinst_HEADERS += src/modinv64.h
Expand Down Expand Up @@ -69,6 +67,18 @@ if USE_EXTERNAL_ASM
if USE_ASM_ARM
libsecp256k1_common_la_SOURCES = src/asm/field_10x26_arm.s
endif
if USE_ASM_AARCH64
libsecp256k1_common_la_SOURCES = src/asm/field_5x64_aarch64.s
endif
if USE_ASM_X86_64_GEN
libsecp256k1_common_la_SOURCES = src/asm/field_5x64_x86_64_gen.s
endif
if USE_ASM_X86_64_MXAA
libsecp256k1_common_la_SOURCES = src/asm/field_5x64_x86_64_mxaa.s
endif
if USE_ASM_X86_64_MAAX
libsecp256k1_common_la_SOURCES = src/asm/field_5x64_x86_64_maax.s
endif
endif

libsecp256k1_la_SOURCES = src/secp256k1.c
Expand Down
23 changes: 18 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ AC_ARG_ENABLE(external_default_callbacks,
# Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default).
AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto])

AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto],
AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|x86_64_gen|arm|aarch64|no|auto],
[assembly optimizations to use (experimental: arm) [default=auto]])],[req_asm=$withval], [req_asm=auto])

AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
Expand Down Expand Up @@ -236,13 +236,13 @@ if test x"$req_asm" = x"auto"; then
else
set_asm=$req_asm
case $set_asm in
x86_64)
x86_64|x86_64_gen|x86_64_mxaa|x86_64_maax)
SECP_64BIT_ASM_CHECK
if test x"$has_64bit_asm" != x"yes"; then
AC_MSG_ERROR([x86_64 assembly optimization requested but not available])
fi
;;
arm)
arm|aarch64)
;;
no)
;;
Expand All @@ -254,12 +254,17 @@ fi

# Select assembly optimization
use_external_asm=no
use_asm_x86_64=no

case $set_asm in
x86_64)
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations])
use_asm_x86_64=yes
;;
arm)
x86_64_gen|x86_64_mxaa|x86_64_maax)
use_asm_x86_64=yes
use_external_asm=yes
;;
arm|aarch64)
use_external_asm=yes
;;
no)
Expand All @@ -269,6 +274,10 @@ no)
;;
esac

if test x"$use_asm_x86_64" = x"yes"; then
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol in x86_64 inline assembly is used])
fi

if test x"$use_external_asm" = x"yes"; then
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
fi
Expand Down Expand Up @@ -503,6 +512,10 @@ AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"
AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
AM_CONDITIONAL([USE_ASM_AARCH64], [test x"$set_asm" = x"aarch64"])
AM_CONDITIONAL([USE_ASM_X86_64_GEN], [test x"$set_asm" = x"x86_64_gen"])
AM_CONDITIONAL([USE_ASM_X86_64_MXAA], [test x"$set_asm" = x"x86_64_mxaa"])
AM_CONDITIONAL([USE_ASM_X86_64_MAAX], [test x"$set_asm" = x"x86_64_maax"])

# Make sure nothing new is exported so that we don't break the cache.
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
Expand Down
Loading