Require BMI and ABM instruction sets for AVX2 build

AVX2 support on a processor should always imply BMI and ABM support.
The lzcnt and tzcnt instructions have more suitable semantics in the
corner case that source word is 0, and allow us to even handle that
scenario without a branch. Apparently Visual Studio will already
include this support when building with AVX2 enabled, so only the
automake files need to be tweaked.
This commit is contained in:
Pauli Oikkonen 2018-11-13 18:22:56 +02:00
parent a5a10a33c3
commit c5cd03497e
2 changed files with 4 additions and 2 deletions

View file

@ -49,9 +49,11 @@ AX_CHECK_COMPILE_FLAG([-maltivec],[flag_altivec="true"])
AX_CHECK_COMPILE_FLAG([-mavx2], [flag_avx2="true"])
AX_CHECK_COMPILE_FLAG([-msse4.1], [flag_sse4_1="true"])
AX_CHECK_COMPILE_FLAG([-msse2], [flag_sse2="true"])
AX_CHECK_COMPILE_FLAG([-mbmi], [flag_bmi="true"])
AX_CHECK_COMPILE_FLAG([-mabm], [flag_abm="true"])
AM_CONDITIONAL([HAVE_ALTIVEC], [test x"$flag_altivec" = x"true"])
AM_CONDITIONAL([HAVE_AVX2], [test x"$flag_avx2" = x"true"])
AM_CONDITIONAL([HAVE_AVX2], [test x"$flag_avx2" = x"true" -a x"$flag_bmi" = x"true" -a x"$flag_abm" = x"true"])
AM_CONDITIONAL([HAVE_SSE4_1], [test x"$flag_sse4_1" = x"true"])
AM_CONDITIONAL([HAVE_SSE2], [test x"$flag_sse2" = x"true"])

View file

@ -207,7 +207,7 @@ endif #HAVE_PPC
if HAVE_X86
if HAVE_AVX2
libavx2_la_CFLAGS = -mavx2
libavx2_la_CFLAGS = -mavx2 -mbmi -mabm
endif
if HAVE_SSE4_1
libsse41_la_CFLAGS = -msse4.1