Check whether the assembler supports XOP

This commit is contained in:
pooler 2012-03-07 10:46:04 +01:00
parent b10dc6b37d
commit 18bd6c0740
2 changed files with 16 additions and 4 deletions

View file

@ -47,11 +47,19 @@ if test x$have_x86 = xtrue
then
AC_MSG_CHECKING(whether we can compile AVX code)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[asm ("vmovdqa %ymm0, %ymm1");])],
AC_DEFINE(USE_AVX, 1, [Define to 1 if AVX assembly is available.])
AC_DEFINE(USE_AVX, 1, [Define to 1 if AVX assembly is available.])
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether we can compile XOP code)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[asm ("vprotd \$7, %xmm0, %xmm1");])],
AC_DEFINE(USE_XOP, 1, [Define to 1 if XOP assembly is available.])
AC_MSG_RESULT(yes)
,
AC_MSG_RESULT(no)
AC_MSG_WARN([The assembler does not support the AVX instruction set.])
AC_MSG_WARN([The assembler does not support the XOP instruction set.])
)
,
AC_MSG_RESULT(no)
AC_MSG_WARN([The assembler does not support the AVX instruction set.])
)
fi

View file

@ -1855,7 +1855,7 @@ scrypt_core_2way_loop2:
salsa8_core_3way_avx_doubleround
salsa8_core_3way_avx_doubleround
.endm
#endif
#endif /* USE_AVX */
.text
.p2align 6
@ -1920,11 +1920,13 @@ _scrypt_core_3way:
andl $0x00000006, %eax
cmpl $0x00000006, %eax
jne scrypt_core_3way_xmm
#if defined(USE_XOP)
# Check for XOP support
movl $0x80000001, %eax
cpuid
andl $0x00000800, %ecx
jnz scrypt_core_3way_xop
#endif
scrypt_core_3way_avx:
scrypt_shuffle %rdi, 0, %rsp, 0
@ -2238,6 +2240,7 @@ scrypt_core_3way_avx_loop2:
scrypt_core_3way_cleanup
ret
#if defined(USE_XOP)
.macro salsa8_core_3way_xop_doubleround
vpaddd %xmm0, %xmm1, %xmm4
vpaddd %xmm8, %xmm9, %xmm6
@ -2658,7 +2661,8 @@ scrypt_core_3way_xop_loop2:
scrypt_core_3way_cleanup
ret
#endif
#endif /* USE_XOP */
#endif /* USE_AVX */
.macro salsa8_core_3way_xmm_doubleround
movdqa %xmm1, %xmm4