From: Julian Seward Date: Mon, 17 Jan 2011 11:15:48 +0000 (+0000) Subject: Add build system goop for testing SSE4.2 instructions. X-Git-Tag: svn/VALGRIND_3_7_0~704 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=395293f5de2325dd5f3a83cb026bee936f21831d;p=thirdparty%2Fvalgrind.git Add build system goop for testing SSE4.2 instructions. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11499 --- diff --git a/configure.in b/configure.in index cfe9b8a32e..780e4e3fea 100644 --- a/configure.in +++ b/configure.in @@ -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. # diff --git a/tests/x86_amd64_features.c b/tests/x86_amd64_features.c index faad7ae8e1..6597b0f4e2 100644 --- a/tests/x86_amd64_features.c +++ b/tests/x86_amd64_features.c @@ -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.