diff options
author | Niels Möller <nisse@lysator.liu.se> | 2013-04-18 14:07:20 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2013-04-18 14:17:49 +0200 |
commit | ade7779c98a5426c7d86c8a01bbd7ad65980c9b9 (patch) | |
tree | 0235c694ed12a49037d62e4b05ada53472c804ad | |
parent | b7c953630bf9a05eca5b744c89eb643049eeb700 (diff) | |
download | nettle-ade7779c98a5426c7d86c8a01bbd7ad65980c9b9.tar.gz |
Reorganization of ARM assembly.
Renamed directory armv7 to arm. New subdirectory arm/neon, for files
using neon instructions. configure.ac hacked to make use of neon
configurable.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | aclocal.m4 | 31 | ||||
-rw-r--r-- | arm/README (renamed from armv7/README) | 0 | ||||
-rw-r--r-- | arm/aes-decrypt-internal.asm (renamed from armv7/aes-decrypt-internal.asm) | 2 | ||||
-rw-r--r-- | arm/aes-encrypt-internal.asm (renamed from armv7/aes-encrypt-internal.asm) | 2 | ||||
-rw-r--r-- | arm/aes.m4 (renamed from armv7/aes.m4) | 0 | ||||
-rw-r--r-- | arm/ecc-192-modp.asm (renamed from armv7/ecc-192-modp.asm) | 0 | ||||
-rw-r--r-- | arm/ecc-224-modp.asm (renamed from armv7/ecc-224-modp.asm) | 0 | ||||
-rw-r--r-- | arm/ecc-256-redc.asm (renamed from armv7/ecc-256-redc.asm) | 0 | ||||
-rw-r--r-- | arm/ecc-384-modp.asm (renamed from armv7/ecc-384-modp.asm) | 0 | ||||
-rw-r--r-- | arm/ecc-521-modp.asm (renamed from armv7/ecc-521-modp.asm) | 0 | ||||
-rw-r--r-- | arm/machine.m4 (renamed from armv7/machine.m4) | 0 | ||||
-rw-r--r-- | arm/memxor.asm (renamed from armv7/memxor.asm) | 0 | ||||
-rw-r--r-- | arm/neon/salsa20-core-internal.asm (renamed from armv7/salsa20-core-internal.asm) | 0 | ||||
-rw-r--r-- | arm/neon/sha3-permute.asm (renamed from armv7/sha3-permute.asm) | 0 | ||||
-rw-r--r-- | arm/neon/sha512-compress.asm (renamed from armv7/sha512-compress.asm) | 0 | ||||
-rw-r--r-- | arm/neon/umac-nh-n.asm (renamed from armv7/umac-nh-n.asm) | 0 | ||||
-rw-r--r-- | arm/neon/umac-nh.asm (renamed from armv7/umac-nh.asm) | 0 | ||||
-rw-r--r-- | arm/sha1-compress.asm (renamed from armv7/sha1-compress.asm) | 0 | ||||
-rw-r--r-- | arm/sha256-compress.asm (renamed from armv7/sha256-compress.asm) | 0 | ||||
-rw-r--r-- | configure.ac | 47 |
22 files changed, 83 insertions, 19 deletions
@@ -1,5 +1,23 @@ 2013-04-18 Niels Möller <nisse@lysator.liu.se> + * arm/aes-encrypt-internal.asm: Updated include of aes.m4. + * arm/aes-decrypt-internal.asm: Likewise. + + * Makefile.in (distdir): Updated for ARM reorganization. + + * configure.ac (asm_path): Generalized, can now be a list of + directories. On ARM, check for neon instructions, and add arm/neon + if appropriate. New command line options + --enable-arm-neon/--disable-arm-neon, for overriding the default. + + arm/neon: New subdirectory, for assembly files making use of neon + instructions. + + arm: Renamed directory, from... + armv7: ...old name. + + * aclocal.m4 (NETTLE_CHECK_ARM_NEON): New macro. + * nettle.texinfo (Keyed hash functions): Document UMAC. * umac.h (UMAC32_DIGEST_SIZE, UMAC64_DIGEST_SIZE) diff --git a/Makefile.in b/Makefile.in index 13e74c62..60abae96 100644 --- a/Makefile.in +++ b/Makefile.in @@ -516,7 +516,7 @@ distdir: $(DISTFILES) else cp "$(srcdir)/$$f" "$(distdir)" ; \ fi ; \ done - set -e; for d in sparc32 sparc64 x86 x86_64 armv7 ; do \ + set -e; for d in sparc32 sparc64 x86 x86_64 arm arm/neon ; do \ mkdir "$(distdir)/$$d" ; \ cp $(srcdir)/$$d/*.asm $(srcdir)/$$d/*.m4 "$(distdir)/$$d" ; \ done @@ -608,6 +608,37 @@ fi AC_SUBST(EXEEXT_FOR_BUILD,$gmp_cv_prog_exeext_for_build) ]) +dnl NETTLE_CHECK_ARM_NEON +dnl --------------------- +dnl Check if ARM Neon instructinos should be used. +dnl Obeys enable_arn_neon, which should be set earlier. +AC_DEFUN([NETTLE_CHECK_ARM_NEON], +[if test "$enable_arm_neon" = auto ; then + if test "$cross_compiling" = yes ; then + dnl Check if compiler/assembler accepts it, + dnl without an explicit .fpu neon directive. + AC_CACHE_CHECK([if assembler accepts Neon instructions], + nettle_cv_asm_arm_neon, + [GMP_TRY_ASSEMBLE([ +.text +foo: + vmlal.u32 q1, d0, d1 +], + [nettle_cv_asm_arm_neon=yes], + [nettle_cv_asm_arm_neon=no])]) + enable_arm_neon="$nettle_cv_asm_arm_neon" + else + AC_MSG_CHECKING([if /proc/cpuinfo claims neon support]) + if grep '^Features.*:.* neon' /proc/cpuinfo >/dev/null ; then + enable_arm_neon=yes + else + enable_arm_neon=no + fi + AC_MSG_RESULT($enable_arm_neon) + fi +fi +]) + dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])] dnl dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the diff --git a/armv7/README b/arm/README index 9bacd97b..9bacd97b 100644 --- a/armv7/README +++ b/arm/README diff --git a/armv7/aes-decrypt-internal.asm b/arm/aes-decrypt-internal.asm index 9ceb7a62..1cd92fb2 100644 --- a/armv7/aes-decrypt-internal.asm +++ b/arm/aes-decrypt-internal.asm @@ -17,7 +17,7 @@ C along with the nettle library; see the file COPYING.LIB. If not, write to C the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, C MA 02111-1301, USA. -include_src(<armv7/aes.m4>) +include_src(<arm/aes.m4>) C Benchmarked at at 785, 914, 1051 cycles/block on cortex A9, C for 128, 192 and 256 bit key sizes. Unclear why it is slower diff --git a/armv7/aes-encrypt-internal.asm b/arm/aes-encrypt-internal.asm index 6bd1e989..b3309351 100644 --- a/armv7/aes-encrypt-internal.asm +++ b/arm/aes-encrypt-internal.asm @@ -17,7 +17,7 @@ C along with the nettle library; see the file COPYING.LIB. If not, write to C the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, C MA 02111-1301, USA. -include_src(<armv7/aes.m4>) +include_src(<arm/aes.m4>) C Benchmarked at at 693, 824, 950 cycles/block on cortex A9, C for 128, 192 and 256 bit key sizes. diff --git a/armv7/aes.m4 b/arm/aes.m4 index 00d3c9a3..00d3c9a3 100644 --- a/armv7/aes.m4 +++ b/arm/aes.m4 diff --git a/armv7/ecc-192-modp.asm b/arm/ecc-192-modp.asm index 1b226e30..1b226e30 100644 --- a/armv7/ecc-192-modp.asm +++ b/arm/ecc-192-modp.asm diff --git a/armv7/ecc-224-modp.asm b/arm/ecc-224-modp.asm index ef7a703a..ef7a703a 100644 --- a/armv7/ecc-224-modp.asm +++ b/arm/ecc-224-modp.asm diff --git a/armv7/ecc-256-redc.asm b/arm/ecc-256-redc.asm index cbf10a89..cbf10a89 100644 --- a/armv7/ecc-256-redc.asm +++ b/arm/ecc-256-redc.asm diff --git a/armv7/ecc-384-modp.asm b/arm/ecc-384-modp.asm index fb5a6e12..fb5a6e12 100644 --- a/armv7/ecc-384-modp.asm +++ b/arm/ecc-384-modp.asm diff --git a/armv7/ecc-521-modp.asm b/arm/ecc-521-modp.asm index fe305805..fe305805 100644 --- a/armv7/ecc-521-modp.asm +++ b/arm/ecc-521-modp.asm diff --git a/armv7/machine.m4 b/arm/machine.m4 index f982a66a..f982a66a 100644 --- a/armv7/machine.m4 +++ b/arm/machine.m4 diff --git a/armv7/memxor.asm b/arm/memxor.asm index 33f672c6..33f672c6 100644 --- a/armv7/memxor.asm +++ b/arm/memxor.asm diff --git a/armv7/salsa20-core-internal.asm b/arm/neon/salsa20-core-internal.asm index fe26e5c5..fe26e5c5 100644 --- a/armv7/salsa20-core-internal.asm +++ b/arm/neon/salsa20-core-internal.asm diff --git a/armv7/sha3-permute.asm b/arm/neon/sha3-permute.asm index beee09f7..beee09f7 100644 --- a/armv7/sha3-permute.asm +++ b/arm/neon/sha3-permute.asm diff --git a/armv7/sha512-compress.asm b/arm/neon/sha512-compress.asm index ac2b4382..ac2b4382 100644 --- a/armv7/sha512-compress.asm +++ b/arm/neon/sha512-compress.asm diff --git a/armv7/umac-nh-n.asm b/arm/neon/umac-nh-n.asm index 4ae876b5..4ae876b5 100644 --- a/armv7/umac-nh-n.asm +++ b/arm/neon/umac-nh-n.asm diff --git a/armv7/umac-nh.asm b/arm/neon/umac-nh.asm index 87cb86d0..87cb86d0 100644 --- a/armv7/umac-nh.asm +++ b/arm/neon/umac-nh.asm diff --git a/armv7/sha1-compress.asm b/arm/sha1-compress.asm index 69c30e42..69c30e42 100644 --- a/armv7/sha1-compress.asm +++ b/arm/sha1-compress.asm diff --git a/armv7/sha256-compress.asm b/arm/sha256-compress.asm index c2aaabd2..c2aaabd2 100644 --- a/armv7/sha256-compress.asm +++ b/arm/sha256-compress.asm diff --git a/configure.ac b/configure.ac index 7a0ca826..e13e554d 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,10 @@ AC_ARG_ENABLE(documentation, AC_HELP_STRING([--disable-documentation], [Omit building and installing the documentation. (default=auto)]),, [enable_documentation=auto]) +AC_ARG_ENABLE(arm-neon, + AC_HELP_STRING([--enable-arm-neon], [Enable ARM Neon assembly. (default=auto)]),, + [enable_arm_neon=auto]) + LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \ `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \ /usr/local/lib /sw/local/lib /sw/lib \ @@ -234,7 +238,12 @@ if test "x$enable_assembler" = xyes ; then fi ;; armv7l*) - asm_path=armv7 + NETTLE_CHECK_ARM_NEON + + asm_path=arm + if test "x$enable_arm_neon" = xyes ; then + asm_path="arm/neon $asm_path" + fi ;; *) enable_assembler=no @@ -266,27 +275,33 @@ asm_file_list="" if test "x$enable_assembler" = xyes ; then if test -n "$asm_path"; then - AC_MSG_NOTICE([Looking for assembler files in $asm_path/.]) + AC_MSG_NOTICE([Looking for assembler files in $asm_path.]) for tmp_f in $asm_replace_list ; do - if test -f "$srcdir/$asm_path/$tmp_f"; then - asm_file_list="$asm_file_list $tmp_f" - AC_CONFIG_LINKS($tmp_f:$asm_path/$tmp_f) - fi + for asm_dir in $asm_path ; do + if test -f "$srcdir/$asm_dir/$tmp_f"; then + asm_file_list="$asm_file_list $tmp_f" + AC_CONFIG_LINKS($tmp_f:$asm_dir/$tmp_f) + break + fi + done done dnl Workaround for AC_CONFIG_LINKS, which complains if we use the dnl same destination argument $tmp_f multiple times. for tmp_o in $asm_optional_list ; do - if test -f "$srcdir/$asm_path/$tmp_o"; then - asm_file_list="$asm_file_list $tmp_o" - AC_CONFIG_LINKS($tmp_o:$asm_path/$tmp_o) - while read tmp_func ; do - AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func) - eval HAVE_NATIVE_$tmp_func=yes - done <<EOF -[`sed -n 's/[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_path/$tmp_o"`] + for asm_dir in $asm_path ; do + if test -f "$srcdir/$asm_dir/$tmp_o"; then + asm_file_list="$asm_file_list $tmp_o" + AC_CONFIG_LINKS($tmp_o:$asm_dir/$tmp_o) + while read tmp_func ; do + AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_func) + eval HAVE_NATIVE_$tmp_func=yes + done <<EOF +[`sed -n 's/[^ ]*PROLOGUE(_*\(nettle_\)*\([^)]*\)).*$/\2/p' < "$srcdir/$asm_dir/$tmp_o"`] EOF - OPT_ASM_SOURCES="$OPT_ASM_SOURCES $tmp_o" - fi + OPT_ASM_SOURCES="$OPT_ASM_SOURCES $tmp_o" + break + fi + done done if test -z "$asm_file_list"; then enable_assembler=no |