]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Connect up the xacq_xrel test to the build system. Also, make the
authorJulian Seward <jseward@acm.org>
Wed, 16 Oct 2013 08:53:07 +0000 (08:53 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 16 Oct 2013 08:53:07 +0000 (08:53 +0000)
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

configure.ac
none/tests/amd64/Makefile.am
none/tests/amd64/xacq_xrel.c
none/tests/amd64/xacq_xrel.stderr.exp [new file with mode: 0644]
none/tests/amd64/xacq_xrel.stdout.exp [new file with mode: 0644]
none/tests/amd64/xacq_xrel.vgtest [new file with mode: 0644]

index 1970ace7bd31228d6a9f7376583d26118e7894e7..a4d33d2c68c37c5fe513944d04330477c7a6d73f 100644 (file)
@@ -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
index c7d63d46d26b4fe1192dfb25172abaf61d5c98d2..99a8d33d201e5f04c6c00275ab8b58afda1e558b 100644 (file)
@@ -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
index 628d7292a277cf54b05d8d07c6d687863e31e51f..c3abe010ca1ba11ff0219b9b21c7153f0572e761 100644 (file)
@@ -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 (file)
index 0000000..139597f
--- /dev/null
@@ -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 (file)
index 0000000..f4ecb43
--- /dev/null
@@ -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 (file)
index 0000000..a7c111f
--- /dev/null
@@ -0,0 +1,2 @@
+prog: xacq_xrel
+prereq: test -x xacq_xrel && ../../../tests/x86_amd64_features amd64-avx