]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Reorganization of ARM assembly.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 18 Apr 2013 12:07:20 +0000 (14:07 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 18 Apr 2013 12:17:49 +0000 (14:17 +0200)
Renamed directory armv7 to arm. New subdirectory arm/neon, for files
using neon instructions. configure.ac hacked to make use of neon
configurable.

22 files changed:
ChangeLog
Makefile.in
aclocal.m4
arm/README [moved from armv7/README with 100% similarity]
arm/aes-decrypt-internal.asm [moved from armv7/aes-decrypt-internal.asm with 98% similarity]
arm/aes-encrypt-internal.asm [moved from armv7/aes-encrypt-internal.asm with 98% similarity]
arm/aes.m4 [moved from armv7/aes.m4 with 100% similarity]
arm/ecc-192-modp.asm [moved from armv7/ecc-192-modp.asm with 100% similarity]
arm/ecc-224-modp.asm [moved from armv7/ecc-224-modp.asm with 100% similarity]
arm/ecc-256-redc.asm [moved from armv7/ecc-256-redc.asm with 100% similarity]
arm/ecc-384-modp.asm [moved from armv7/ecc-384-modp.asm with 100% similarity]
arm/ecc-521-modp.asm [moved from armv7/ecc-521-modp.asm with 100% similarity]
arm/machine.m4 [moved from armv7/machine.m4 with 100% similarity]
arm/memxor.asm [moved from armv7/memxor.asm with 100% similarity]
arm/neon/salsa20-core-internal.asm [moved from armv7/salsa20-core-internal.asm with 100% similarity]
arm/neon/sha3-permute.asm [moved from armv7/sha3-permute.asm with 100% similarity]
arm/neon/sha512-compress.asm [moved from armv7/sha512-compress.asm with 100% similarity]
arm/neon/umac-nh-n.asm [moved from armv7/umac-nh-n.asm with 100% similarity]
arm/neon/umac-nh.asm [moved from armv7/umac-nh.asm with 100% similarity]
arm/sha1-compress.asm [moved from armv7/sha1-compress.asm with 100% similarity]
arm/sha256-compress.asm [moved from armv7/sha256-compress.asm with 100% similarity]
configure.ac

index 278fe27d5fb45b80de481233bf3aaf8a3c7076aa..fea262838157393f2c7dacaaba03f130fd0ad741 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
index 13e74c62f9a9c671a5f6f614a0dc89b6bf42722a..60abae96e861b3ae3eb0a3063601c651c2b6be56 100644 (file)
@@ -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
index ae6b204aee52f475bc7f3e85ca3f930772eca14d..0d24fc2e549eb6cf6c0cee2b7a6c682a3ece50a9 100644 (file)
@@ -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
similarity index 100%
rename from armv7/README
rename to arm/README
similarity index 98%
rename from armv7/aes-decrypt-internal.asm
rename to arm/aes-decrypt-internal.asm
index 9ceb7a6278d6049e91e6086b7926c1bcd80ac0d3..1cd92fb28634a0b521a650db16ba08eda9d94627 100644 (file)
@@ -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
similarity index 98%
rename from armv7/aes-encrypt-internal.asm
rename to arm/aes-encrypt-internal.asm
index 6bd1e98965128b56640658d7cc8ef179ff16a0f6..b3309351b5b624105ff37fdb6eb6071d48302b8c 100644 (file)
@@ -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.
similarity index 100%
rename from armv7/aes.m4
rename to arm/aes.m4
similarity index 100%
rename from armv7/ecc-192-modp.asm
rename to arm/ecc-192-modp.asm
similarity index 100%
rename from armv7/ecc-224-modp.asm
rename to arm/ecc-224-modp.asm
similarity index 100%
rename from armv7/ecc-256-redc.asm
rename to arm/ecc-256-redc.asm
similarity index 100%
rename from armv7/ecc-384-modp.asm
rename to arm/ecc-384-modp.asm
similarity index 100%
rename from armv7/ecc-521-modp.asm
rename to arm/ecc-521-modp.asm
similarity index 100%
rename from armv7/machine.m4
rename to arm/machine.m4
similarity index 100%
rename from armv7/memxor.asm
rename to arm/memxor.asm
similarity index 100%
rename from armv7/umac-nh-n.asm
rename to arm/neon/umac-nh-n.asm
similarity index 100%
rename from armv7/umac-nh.asm
rename to arm/neon/umac-nh.asm
index 7a0ca8266c7edf461e4a40bc3d80095c9010c09b..e13e554d3e1647c1813493f6eb484cc231dae6cd 100644 (file)
@@ -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