Commit ade7779c authored by Niels Möller's avatar Niels Möller

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.
parent b7c95363
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)
......
......@@ -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
......
......@@ -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
......
......@@ -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.
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment