From: Julian Seward Date: Wed, 16 Oct 2013 08:53:07 +0000 (+0000) Subject: Connect up the xacq_xrel test to the build system. Also, make the X-Git-Tag: svn/VALGRIND_3_9_0~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52b882283e4e07b3b484492d207e2a76499b5b7b;p=thirdparty%2Fvalgrind.git Connect up the xacq_xrel test to the build system. Also, make the TSX configure test check for that the assembler can deal with xacquire and xrelease prefixes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13649 --- diff --git a/configure.ac b/configure.ac index 1970ace7bd..a4d33d2c68 100644 --- a/configure.ac +++ b/configure.ac @@ -2120,7 +2120,8 @@ AC_MSG_RESULT([no]) AM_CONDITIONAL(BUILD_AVX2_TESTS, test x$ac_have_as_avx2 = xyes) -# does the x86/amd64 assembler understand TSX instructions? +# does the x86/amd64 assembler understand TSX instructions and +# the XACQUIRE/XRELEASE prefixes? # Note, this doesn't generate a C-level symbol. It generates a # automake-level symbol (BUILD_TSX_TESTS), used in test Makefile.am's AC_MSG_CHECKING([if x86/amd64 assembler speaks TSX]) @@ -2129,7 +2130,10 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ do { __asm__ __volatile__( " xbegin Lfoo \n\t" - "Lfoo: xend \n\t"); + "Lfoo: xend \n\t" + " xacquire lock incq 0(%rsp) \n\t" + " xrelease lock incq 0(%rsp) \n" + ); } while (0) ]])], [ ac_have_as_tsx=yes diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am index c7d63d46d2..99a8d33d20 100644 --- a/none/tests/amd64/Makefile.am +++ b/none/tests/amd64/Makefile.am @@ -80,6 +80,7 @@ EXTRA_DIST = \ slahf-amd64.stderr.exp slahf-amd64.stdout.exp \ slahf-amd64.vgtest \ tm1.vgtest tm1.stderr.exp tm1.stdout.exp \ + xacq_xrel.stderr.exp xacq_xrel.stdout.exp xacq_xrel.vgtest \ xadd.stderr.exp xadd.stdout.exp xadd.vgtest check_PROGRAMS = \ @@ -119,7 +120,7 @@ if BUILD_AVX2_TESTS check_PROGRAMS += avx2-1 endif if BUILD_TSX_TESTS - check_PROGRAMS += tm1 + check_PROGRAMS += tm1 xacq_xrel endif if BUILD_BMI_TESTS check_PROGRAMS += bmi diff --git a/none/tests/amd64/xacq_xrel.c b/none/tests/amd64/xacq_xrel.c index 628d7292a2..c3abe010ca 100644 --- a/none/tests/amd64/xacq_xrel.c +++ b/none/tests/amd64/xacq_xrel.c @@ -164,9 +164,11 @@ void do_cmpxchg8b ( void ) __asm__ __volatile__( "xorq %%rax, %%rax" "\n\t" "xorq %%rdx, %%rdx" "\n\t" + "movabsq $0x1122334455667788, %%rcx" "\n\t" + "movabsq $0xffeeddccbbaa9988, %%rdx" "\n\t" "xacquire lock cmpxchg8b (%0)" "\n\t" "xrelease lock cmpxchg8b (%0)" "\n\t" - : : "r"(&n) : "cc", "memory", "rax", "rdx" + : : "r"(&n) : "cc", "memory", "rax", "rdx", "rcx", "rdx" ); printf("result for '%-3s' is %016llx\n", "cmpxchg8b", n); } diff --git a/none/tests/amd64/xacq_xrel.stderr.exp b/none/tests/amd64/xacq_xrel.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/amd64/xacq_xrel.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/amd64/xacq_xrel.stdout.exp b/none/tests/amd64/xacq_xrel.stdout.exp new file mode 100644 index 0000000000..f4ecb4327e --- /dev/null +++ b/none/tests/amd64/xacq_xrel.stdout.exp @@ -0,0 +1,21 @@ +result for 'add' is a385b7d8caf2a7b9 +result for 'adc' is a385b7d8caf2a7bd +result for 'and' is 0000000001010000 +result for 'or ' is 775d75555f7fddff +result for 'sbb' is 0724f2d2dfb804eb +result for 'sub' is 0724f2d2dfb804f1 +result for 'xor' is 5555555555555555 +result for 'dec' is 555555555555554d +result for 'inc' is 555555555555555d +result for 'neg' is 5555555555555555 +result for 'not' is 5555555555555555 +result for 'btc' is 57d555555f554d55 +result for 'btr' is 5555555555554515 +result for 'bts' is 57d555555f555d55 +result for 'cmpxchg' is 271831415927d459 +result for 'cmpxchg8b' is 5566778800000000 +result for 'xadd' is d1c2dbecb622f897 +result for 'xchg' is 5555555555555555 +result for 'xchg-no-lock' is 5555555555555555 +result for 'mov-reg' is 591831d459d45959 +result for 'mov-imm' is 42fffff00dab89bd diff --git a/none/tests/amd64/xacq_xrel.vgtest b/none/tests/amd64/xacq_xrel.vgtest new file mode 100644 index 0000000000..a7c111fab6 --- /dev/null +++ b/none/tests/amd64/xacq_xrel.vgtest @@ -0,0 +1,2 @@ +prog: xacq_xrel +prereq: test -x xacq_xrel && ../../../tests/x86_amd64_features amd64-avx