Added configure test that checks whether the assembler supports the SSE4a instruction lzcnt.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11357 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.in b/configure.in
index a47fede..424a404 100644
--- a/configure.in
+++ b/configure.in
@@ -1410,6 +1410,24 @@
AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
+AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
+
+AC_TRY_COMPILE([], [
+ do {
+ __asm__ __volatile__("lzcnt %rax,%rax");
+ } while (0)
+],
+[
+ ac_have_as_lzcnt=yes
+ AC_MSG_RESULT([yes])
+], [
+ ac_have_as_lzcnt=no
+ AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
+
+
# Check for TLS support in the compiler and linker
if test "x${cross_compiling}" = "xno"; then
# Native compilation: check whether running a program using TLS succeeds.
diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am
index 38e1ebb..bd1c8a7 100644
--- a/none/tests/amd64/Makefile.am
+++ b/none/tests/amd64/Makefile.am
@@ -60,7 +60,6 @@
bug127521-64 bug132813-amd64 bug132918 \
clc \
$(INSN_TESTS) \
- lzcnt64 \
rcl-amd64 \
redundantRexW \
smc1 \
@@ -69,6 +68,9 @@
if BUILD_SSSE3_TESTS
check_PROGRAMS += ssse3_misaligned
endif
+if BUILD_LZCNT_TESTS
+ check_PROGRAMS += lzcnt64
+endif
# DDD: these need to be made to work on Darwin like the x86/ ones were.
if ! VGCONF_OS_IS_DARWIN
diff --git a/none/tests/x86/Makefile.am b/none/tests/x86/Makefile.am
index c0f0c08..0fa2194 100644
--- a/none/tests/x86/Makefile.am
+++ b/none/tests/x86/Makefile.am
@@ -84,7 +84,6 @@
jcxz \
lahf \
looper \
- lzcnt32 \
movx \
pushpopseg \
sbbmisc \
@@ -95,6 +94,9 @@
if BUILD_SSSE3_TESTS
check_PROGRAMS += ssse3_misaligned
endif
+if BUILD_LZCNT_TESTS
+ check_PROGRAMS += lzcnt32
+endif
AM_CFLAGS += @FLAG_M32@ $(FLAG_MMMX) $(FLAG_MSSE)