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 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.ac b/configure.ac
index 1970ace..a4d33d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2120,7 +2120,8 @@
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 @@
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 c7d63d4..99a8d33 100644
--- a/none/tests/amd64/Makefile.am
+++ b/none/tests/amd64/Makefile.am
@@ -80,6 +80,7 @@
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 @@
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 628d729..c3abe01 100644
--- a/none/tests/amd64/xacq_xrel.c
+++ b/none/tests/amd64/xacq_xrel.c
@@ -164,9 +164,11 @@
__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 0000000..139597f
--- /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 0000000..f4ecb43
--- /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 0000000..a7c111f
--- /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