mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Better AVX2 detection, try 2 (only using intrinsic functions) (#420)
* Better AVX2 detection, try 2 (only using intrinsic functions) * Slight change to AVX2 detection per jedisct1's feedback
This commit is contained in:
parent
6035c0779b
commit
a3b68738db
@ -398,7 +398,13 @@ AS_IF([test "x$EMSCRIPTEN" = "x" -a "$host_os" != "pnacl"], [
|
|||||||
#endif
|
#endif
|
||||||
#pragma GCC target("avx2")
|
#pragma GCC target("avx2")
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
]], [[ __m256i x = _mm256_abs_epi8(_mm256_setzero_si256()); ]])],
|
]], [[
|
||||||
|
// the code below is intentionally crafted to make sure the compiler
|
||||||
|
// can't optimize the AVX2 instructions away.
|
||||||
|
__m256 x = _mm256_set1_ps(3.14);
|
||||||
|
__m256 y = _mm256_permutevar8x32_ps(x, _mm256_set1_epi32(42));
|
||||||
|
return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ));
|
||||||
|
]])],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE([HAVE_AVX2INTRIN_H], [1], [AVX2 is available])
|
AC_DEFINE([HAVE_AVX2INTRIN_H], [1], [AVX2 is available])
|
||||||
AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX2="-mavx2"])
|
AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX2="-mavx2"])
|
||||||
|
Loading…
Reference in New Issue
Block a user