]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add build system goop for testing SSE4.2 instructions.
authorJulian Seward <jseward@acm.org>
Mon, 17 Jan 2011 11:15:48 +0000 (11:15 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 17 Jan 2011 11:15:48 +0000 (11:15 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11499

configure.in
tests/x86_amd64_features.c

index cfe9b8a32e9c6543060078406655be2e7ac8e105..780e4e3fea5782593ed2b65411c3ac50a7a50058 100644 (file)
@@ -1410,10 +1410,9 @@ AC_MSG_RESULT([no])
 AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
 
 
-# Note: we're really checking the assembler-level support, not gcc's ;
-# C-level code might require the flag -mpclmul be passed to gcc (e.g. to
-# compile code which uses wmmintrin.h). Doesn't matter since tests also
-# use inline assembly directly
+# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
+# Note, this doesn't generate a C-level symbol.  It generates a
+# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
 AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
 AC_TRY_COMPILE(, [
   do {
@@ -1432,6 +1431,9 @@ AC_MSG_RESULT([no])
 AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
 
 
+# does the x86/amd64 assembler understand the LZCNT instruction?
+# Note, this doesn't generate a C-level symbol.  It generates a
+# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
 AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
 
 AC_TRY_COMPILE([], [
@@ -1449,6 +1451,29 @@ AC_TRY_COMPILE([], [
 
 AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
 
+
+# does the x86/amd64 assembler understand SSE 4.2 instructions?
+# Note, this doesn't generate a C-level symbol.  It generates a
+# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
+AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
+
+AC_TRY_COMPILE(, [
+  do { long long int x; 
+   __asm__ __volatile__(
+      "crc32q %%r15,%%r15" : : : "r15" ); }
+  while (0)
+],
+[
+ac_have_as_sse42=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_as_sse42=no
+AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
+
+
 # XXX JRS 2010 Oct 13: what is this for?  For sure, we don't need this
 # when building the tool executables.  I think we should get rid of it.
 #
index faad7ae8e186fa1a4e774812748efc425e3ec93e..6597b0f4e21e477ab10d3e446211bb4f3816e8b7 100644 (file)
@@ -92,6 +92,9 @@ static Bool go(char* cpu)
      level = 0x80000001;
      cmask = 1 << 5;
      require_amd = True;
+   } else if ( strcmp( cpu, "amd64-sse42" ) == 0 ) {
+     level = 1;
+     cmask = 1 << 20;
 #endif
    } else {
      return 2;          // Unrecognised feature.