|
From: <sv...@va...> - 2011-01-17 11:15:57
|
Author: sewardj
Date: 2011-01-17 11:15:48 +0000 (Mon, 17 Jan 2011)
New Revision: 11499
Log:
Add build system goop for testing SSE4.2 instructions.
Modified:
trunk/configure.in
trunk/tests/x86_amd64_features.c
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2011-01-17 10:40:53 UTC (rev 11498)
+++ trunk/configure.in 2011-01-17 11:15:48 UTC (rev 11499)
@@ -1410,10 +1410,9 @@
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 @@
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 @@
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.
#
Modified: trunk/tests/x86_amd64_features.c
===================================================================
--- trunk/tests/x86_amd64_features.c 2011-01-17 10:40:53 UTC (rev 11498)
+++ trunk/tests/x86_amd64_features.c 2011-01-17 11:15:48 UTC (rev 11499)
@@ -92,6 +92,9 @@
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.
|