Workaround for old gcc versions missing _mm256_broadcastsi128_si256()

Some old gcc versions define vbroadcasti128 as
_mm_broadcastsi128_si256() not _mm256_broadcastsi128_si256().

Detect this, and use _mm_broadcastsi128_si256() in that case.
This commit is contained in:
Frank Denis 2016-04-03 10:41:28 +02:00
parent 66045e6821
commit abdc839367

View File

@ -379,7 +379,17 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
]], [[ __m256i x = _mm256_abs_epi8(_mm256_setzero_si256()); ]])], ]], [[ __m256i x = _mm256_abs_epi8(_mm256_setzero_si256()); ]])],
[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_AVX="-mavx2"])], AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX="-mavx2"])
AC_MSG_CHECKING(if _mm256_broadcastsi128_si256 is correctly defined)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#pragma GCC target("avx2")
#include <immintrin.h>
]], [[ __m256i y = _mm256_broadcastsi128_si256(_mm_setzero_si128()); ]])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_DEFINE([_mm256_broadcastsi128_si256], [_mm_broadcastsi128_si256],
[Define to the local name of _mm256_broadcastsi128_si256])])
],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
CFLAGS="$oldcflags" CFLAGS="$oldcflags"