Unfortunately, some assemblers still don't know about AVX opcodes
This commit is contained in:
parent
3f3969ffae
commit
18906a078c
27
configure.ac
27
configure.ac
@ -399,7 +399,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
|
||||
HAVE_AMD64_ASM_V=0
|
||||
AS_IF([test "$enable_asm" != "no"],[
|
||||
AC_MSG_CHECKING(whether we should use x86_64 asm code)
|
||||
AC_MSG_CHECKING(whether we can use x86_64 asm code)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
]], [[
|
||||
#if defined(__amd64) || defined(__amd64__) || defined(__x86_64__)
|
||||
@ -413,13 +413,36 @@ AS_IF([test "$enable_asm" != "no"],[
|
||||
__asm__("pxor %xmm12,%xmm6");
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_AMD64_ASM], [1], [x86_64 asm code should be used])
|
||||
AC_DEFINE([HAVE_AMD64_ASM], [1], [x86_64 asm code can be used])
|
||||
HAVE_AMD64_ASM_V=1],
|
||||
[AC_MSG_RESULT(no)])
|
||||
])
|
||||
AM_CONDITIONAL([HAVE_AMD64_ASM], [test $HAVE_AMD64_ASM_V = 1])
|
||||
AC_SUBST(HAVE_AMD64_ASM_V)
|
||||
|
||||
HAVE_AVX_ASM_V=0
|
||||
AS_IF([test "$enable_asm" != "no"],[
|
||||
AC_MSG_CHECKING(whether we can assemble AVX opcodes)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
]], [[
|
||||
#if defined(__amd64) || defined(__amd64__) || defined(__x86_64__)
|
||||
# if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32) || defined(_WIN64)
|
||||
# error Windows x86_64 calling conventions are not supported yet
|
||||
# endif
|
||||
/* neat */
|
||||
#else
|
||||
# error !x86_64
|
||||
#endif
|
||||
__asm__("vpunpcklqdq %xmm0,%xmm13,%xmm0");
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_AVX_ASM], [1], [AVX opcodes are supported])
|
||||
HAVE_AVX_ASM_V=1],
|
||||
[AC_MSG_RESULT(no)])
|
||||
])
|
||||
AM_CONDITIONAL([HAVE_AVX_ASM], [test $HAVE_AVX_ASM_V = 1])
|
||||
AC_SUBST(HAVE_AVX_ASM_V)
|
||||
|
||||
AC_MSG_CHECKING(for 128-bit arithmetic)
|
||||
HAVE_TI_MODE_V=0
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
|
@ -204,10 +204,8 @@ EXTRA_DIST = \
|
||||
crypto_scalarmult/curve25519/sandy2x/ladder.S \
|
||||
crypto_scalarmult/curve25519/sandy2x/ladder_base.S
|
||||
|
||||
if HAVE_AMD64_ASM
|
||||
if HAVE_AVX_ASM
|
||||
libsodium_la_SOURCES += \
|
||||
crypto_stream/salsa20/amd64_xmm6/api.h \
|
||||
crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S \
|
||||
crypto_scalarmult/curve25519/sandy2x/consts_namespace.h \
|
||||
crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c \
|
||||
crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h \
|
||||
@ -221,6 +219,12 @@ libsodium_la_SOURCES += \
|
||||
crypto_scalarmult/curve25519/sandy2x/ladder_base_namespace.h \
|
||||
crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h \
|
||||
crypto_scalarmult/curve25519/sandy2x/sandy2x.S
|
||||
endif
|
||||
|
||||
if HAVE_AMD64_ASM
|
||||
libsodium_la_SOURCES += \
|
||||
crypto_stream/salsa20/amd64_xmm6/api.h \
|
||||
crypto_stream/salsa20/amd64_xmm6/stream_salsa20_amd64_xmm6.S
|
||||
else
|
||||
libsodium_la_SOURCES += \
|
||||
crypto_stream/salsa20/ref/api.h \
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
|
||||
#include "utils.h"
|
||||
#include "curve25519_sandy2x.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "fe51.h"
|
||||
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
|
||||
#define fe51_square(x, y) fe51_nsquare(x, y, 1)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "fe.h"
|
||||
#include "crypto_uint64.h"
|
||||
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
|
||||
static crypto_uint64 load_3(const unsigned char *in)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
|
||||
#define IN_SANDY2X
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "scalarmult_curve25519.h"
|
||||
#include "runtime.h"
|
||||
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
# include "sandy2x/curve25519_sandy2x.h"
|
||||
#endif
|
||||
#ifdef HAVE_TI_MODE
|
||||
@ -49,7 +49,7 @@ _crypto_scalarmult_curve25519_pick_best_implementation(void)
|
||||
#else
|
||||
implementation = &crypto_scalarmult_curve25519_ref10_implementation;
|
||||
#endif
|
||||
#ifdef HAVE_AMD64_ASM
|
||||
#ifdef HAVE_AVX_ASM
|
||||
if (sodium_runtime_has_avx()) {
|
||||
implementation = &crypto_scalarmult_curve25519_sandy2x_implementation;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user