From: Carl Love Date: Wed, 9 Oct 2013 17:56:34 +0000 (+0000) Subject: Power PC, add the two privileged Transactional Memory instructions. X-Git-Tag: svn/VALGRIND_3_9_0~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8044c5ce56571b1e43c60e507c8f1e699df8974a;p=thirdparty%2Fvalgrind.git Power PC, add the two privileged Transactional Memory instructions. The initial Transactional Memory instruction patch did not include the two privileged (OS) instructions treclaim and trechkpt. VEX commit 2784 added the support for these two instructions. This patch adds a touch test to make sure all of the POWER Transactional memory instrutions are recognized by Valgrind. All of the the Transactional Memory instructions, with the exception of tbegin, are treated as NOPs in the first implementation. The tbegin instruction causes the transaction to fail thus no additional Transactional Memory instructions on the successful transaction path would be executed in a real program. This test just makes sure each instruction is actually recognized by Valgrind. The patch if for Bugzilla 325751. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13630 --- diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am index dfd2d3fa82..4f581b6f0c 100644 --- a/none/tests/ppc32/Makefile.am +++ b/none/tests/ppc32/Makefile.am @@ -42,7 +42,8 @@ EXTRA_DIST = \ jm_fp_isa_2_07.stderr.exp jm_fp_isa_2_07.stdout.exp jm_fp_isa_2_07.vgtest \ jm_int_isa_2_07.stderr.exp jm_int_isa_2_07.stdout.exp jm_int_isa_2_07.vgtest \ test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest \ - test_tm.stderr.exp test_tm.stdout.exp test_tm.vgtest + test_tm.stderr.exp test_tm.stdout.exp test_tm.vgtest \ + test_touch_tm.stderr.exp test_touch_tm.stdout.exp test_touch_tm.vgtest check_PROGRAMS = \ @@ -57,7 +58,8 @@ check_PROGRAMS = \ test_dfp1 test_dfp2 test_dfp3 test_dfp4 test_dfp5 \ test_isa_2_07_part1 \ test_isa_2_07_part2 \ - test_tm + test_tm \ + test_touch_tm AM_CFLAGS += @FLAG_M32@ AM_CXXFLAGS += @FLAG_M32@ @@ -131,3 +133,5 @@ test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $( test_tm_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \ @FLAG_M32@ $(BUILD_FLAGS_ISA_2_07) +test_touch_tm_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \ + @FLAG_M32@ $(BUILD_FLAGS_ISA_2_07) diff --git a/none/tests/ppc32/test_touch_tm.stderr.exp b/none/tests/ppc32/test_touch_tm.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/ppc32/test_touch_tm.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/ppc32/test_touch_tm.stdout.exp b/none/tests/ppc32/test_touch_tm.stdout.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/none/tests/ppc32/test_touch_tm.vgtest b/none/tests/ppc32/test_touch_tm.vgtest new file mode 100644 index 0000000000..4806ccfae5 --- /dev/null +++ b/none/tests/ppc32/test_touch_tm.vgtest @@ -0,0 +1,2 @@ +prereq: ../../../tests/check_isa-2_07_cap +prog: test_touch_tm diff --git a/none/tests/ppc64/Makefile.am b/none/tests/ppc64/Makefile.am index 4607cdd164..93c6fe1322 100644 --- a/none/tests/ppc64/Makefile.am +++ b/none/tests/ppc64/Makefile.am @@ -30,7 +30,8 @@ EXTRA_DIST = \ jm_fp_isa_2_07.stderr.exp jm_fp_isa_2_07.stdout.exp jm_fp_isa_2_07.vgtest \ jm_int_isa_2_07.stderr.exp jm_int_isa_2_07.stdout.exp jm_int_isa_2_07.vgtest \ test_isa_2_07_part2.stderr.exp test_isa_2_07_part2.stdout.exp test_isa_2_07_part2.vgtest \ - test_tm.stderr.exp test_tm.stdout.exp test_tm.vgtest + test_tm.stderr.exp test_tm.stdout.exp test_tm.vgtest \ + test_touch_tm.stderr.exp test_touch_tm.stdout.exp test_touch_tm.vgtest check_PROGRAMS = \ allexec \ @@ -38,7 +39,7 @@ check_PROGRAMS = \ power6_mf_gpr test_isa_2_06_part1 test_isa_2_06_part2 \ test_isa_2_06_part3 test_dfp1 test_dfp2 test_dfp3 test_dfp4 \ test_dfp5 test_isa_2_07_part1 test_isa_2_07_part2 \ - test_tm + test_tm test_touch_tm AM_CFLAGS += @FLAG_M64@ AM_CXXFLAGS += @FLAG_M64@ @@ -110,3 +111,5 @@ test_isa_2_07_part2_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $( test_tm_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \ @FLAG_M64@ $(BUILD_FLAGS_ISA_2_07) +test_touch_tm_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -lm -g -mregnames $(ISA_2_07_FLAG) \ + @FLAG_M64@ $(BUILD_FLAGS_ISA_2_07) diff --git a/none/tests/ppc64/test_touch_tm.c b/none/tests/ppc64/test_touch_tm.c new file mode 100644 index 0000000000..9e40083a55 --- /dev/null +++ b/none/tests/ppc64/test_touch_tm.c @@ -0,0 +1,23 @@ +#include + +int main (void) { +#ifdef HAS_ISA_2_07 + /* Just get the compiler to generate each of the TM instructions + * so we can verify that valgrind recognizes them. + * For now, only the tbegin instruction does anything in valgrind. + * The rest are just treated as NOPS. + */ + __builtin_tabort (0); + __builtin_tabortdc (0,0,0); + __builtin_tabortdci (0,0,0); + __builtin_tabortwc (0,0,0); + __builtin_tabortwci (0,0,0); + __builtin_tbegin (0); + __builtin_tend (0); + // __builtin_tcheck (0); tcheck not recognized by compiler + __builtin_trechkpt (); // not recognized by early HW + __builtin_treclaim (0); // not recognized by early HW + __builtin_tsr (0); +#endif + return 0; +} diff --git a/none/tests/ppc64/test_touch_tm.stderr.exp b/none/tests/ppc64/test_touch_tm.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/ppc64/test_touch_tm.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/ppc64/test_touch_tm.stdout.exp b/none/tests/ppc64/test_touch_tm.stdout.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/none/tests/ppc64/test_touch_tm.vgtest b/none/tests/ppc64/test_touch_tm.vgtest new file mode 100644 index 0000000000..4806ccfae5 --- /dev/null +++ b/none/tests/ppc64/test_touch_tm.vgtest @@ -0,0 +1,2 @@ +prereq: ../../../tests/check_isa-2_07_cap +prog: test_touch_tm