]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Forgot to add the new files in memcheck/tests/ppc32 and memcheck/tests/ppc32.
authorCarl Love <cel@us.ibm.com>
Sat, 18 Apr 2015 00:01:58 +0000 (00:01 +0000)
committerCarl Love <cel@us.ibm.com>
Sat, 18 Apr 2015 00:01:58 +0000 (00:01 +0000)
They should have been part of the previous commit 15106.

--------------------------------------------------------------------

Add support for the lbarx, lharx, stbcx and sthcs instructions.

The instructions are part of the ISA 2.06 but were not implemented
in all versions of hardware.  The four instructions are all supported
in ISA 2.07.  The instructions were put under the ISA 2.07 category
of supported instructions in this patch.

The VEX commit for this fix is r3137.

The bugzilla for this issue is 346324.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15107

memcheck/tests/ppc32/power_ISA2_07.c [new file with mode: 0644]
memcheck/tests/ppc32/power_ISA2_07.stderr.exp [new file with mode: 0644]
memcheck/tests/ppc32/power_ISA2_07.stdout.exp [new file with mode: 0644]
memcheck/tests/ppc32/power_ISA2_07.stdout.exp-LE [new file with mode: 0644]
memcheck/tests/ppc32/power_ISA2_07.vgtest [new file with mode: 0644]
memcheck/tests/ppc64/power_ISA2_07.c [new file with mode: 0644]
memcheck/tests/ppc64/power_ISA2_07.stderr.exp [new file with mode: 0644]
memcheck/tests/ppc64/power_ISA2_07.stdout.exp [new file with mode: 0644]
memcheck/tests/ppc64/power_ISA2_07.stdout.exp-LE [new file with mode: 0644]
memcheck/tests/ppc64/power_ISA2_07.vgtest [new file with mode: 0644]

diff --git a/memcheck/tests/ppc32/power_ISA2_07.c b/memcheck/tests/ppc32/power_ISA2_07.c
new file mode 100644 (file)
index 0000000..b21f274
--- /dev/null
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <config.h>
+
+double foo = -1.0;
+double FRT1;
+double FRT2;
+
+#ifdef HAS_ISA_2_07
+
+/* b0 may be non-zero in lwarx/ldarx Power6 instrs */
+void test_reservation()
+{
+
+   unsigned RT;
+   unsigned base;
+   unsigned offset;
+   unsigned arrB[] = { 0x00112233U, 0x44556677U, 0x8899aabbU, 0xccddeeffU };
+   int arrH[] __attribute__ ((aligned (2))) = { 0xdeadbeef, 0xbad0beef, 0xbeefdead, 0xbeef0bad };
+
+   /* The lbarx and lharx instructions were "phased in" in ISA 2.06.  That 
+    * means it they may show up in some implementations but not others. They
+    * are in all ISA 2.08 implementations.
+    */
+   base = (unsigned) &arrB;
+   offset = ((unsigned ) &arrB[1]) - base;
+   __asm__ volatile ("ori 20, %0, 0"::"r" (base));
+   __asm__ volatile ("ori 21, %0, 0"::"r" (offset));
+   __asm__ volatile ("lbarx %0, 20, 21, 1":"=r" (RT));
+   printf("lbarx => 0x%x\n", RT);
+
+   base = (unsigned) &arrH;
+   offset = ((unsigned) &arrH[1]) - base;
+   __asm__ volatile ("ori 20, %0, 0"::"r" (base));
+   __asm__ volatile ("ori 21, %0, 0"::"r" (offset));
+   __asm__ volatile ("lharx %0, 20, 21, 1":"=r" (RT));
+   printf("lharx => 0x%x\n", RT);
+
+}
+#endif
+
+int main(void)
+{
+#ifdef HAS_ISA_2_07
+   (void) test_reservation();
+#endif
+
+   return 0;
+}
diff --git a/memcheck/tests/ppc32/power_ISA2_07.stderr.exp b/memcheck/tests/ppc32/power_ISA2_07.stderr.exp
new file mode 100644 (file)
index 0000000..c22dd7f
--- /dev/null
@@ -0,0 +1,10 @@
+
+
+HEAP SUMMARY:
+    in use at exit: 0 bytes in 0 blocks
+  total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/memcheck/tests/ppc32/power_ISA2_07.stdout.exp b/memcheck/tests/ppc32/power_ISA2_07.stdout.exp
new file mode 100644 (file)
index 0000000..f67db25
--- /dev/null
@@ -0,0 +1,2 @@
+lbarx => 0x44
+lharx => 0xbad0
diff --git a/memcheck/tests/ppc32/power_ISA2_07.stdout.exp-LE b/memcheck/tests/ppc32/power_ISA2_07.stdout.exp-LE
new file mode 100644 (file)
index 0000000..80dd84b
--- /dev/null
@@ -0,0 +1,2 @@
+lbarx => 0x77
+lharx => 0xbeef
diff --git a/memcheck/tests/ppc32/power_ISA2_07.vgtest b/memcheck/tests/ppc32/power_ISA2_07.vgtest
new file mode 100644 (file)
index 0000000..9a43785
--- /dev/null
@@ -0,0 +1,3 @@
+prereq: ../../../tests/check_isa-2_07_cap
+prog: power_ISA2_07
+vgopts: 
diff --git a/memcheck/tests/ppc64/power_ISA2_07.c b/memcheck/tests/ppc64/power_ISA2_07.c
new file mode 100644 (file)
index 0000000..d262290
--- /dev/null
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <config.h>
+
+double foo = -1.0;
+double FRT1;
+double FRT2;
+
+#ifdef HAS_ISA_2_07
+
+/* b0 may be non-zero in lwarx/ldarx Power6 instrs */
+void test_reservation()
+{
+
+   unsigned long RT;
+   unsigned long base;
+   unsigned long offset;
+   unsigned arrB[] = { 0x00112233U, 0x44556677U, 0x8899aabbU, 0xccddeeffU };
+   int arrH[] __attribute__ ((aligned (2))) = { 0xdeadbeef, 0xbad0beef, 0xbeefdead, 0xbeef0bad };
+
+   /* The lbarx and lharx instructions were "phased in" in ISA 2.06.  That
+    * means it they may show up in some implementations but not others. They
+    * are in all ISA 2.08 implementations.
+    */
+   base = (unsigned long) &arrB;
+   offset = ((unsigned long) &arrB[1]) - base;
+   __asm__ volatile ("ori 20, %0, 0"::"r" (base));
+   __asm__ volatile ("ori 21, %0, 0"::"r" (offset));
+   __asm__ volatile ("lbarx %0, 20, 21, 1":"=r" (RT));
+   printf("lbarx => 0x%lx\n", RT);
+
+   base = (unsigned long) &arrH;
+   offset = ((unsigned long) &arrH[1]) - base;
+   __asm__ volatile ("ori 20, %0, 0"::"r" (base));
+   __asm__ volatile ("ori 21, %0, 0"::"r" (offset));
+   __asm__ volatile ("lharx %0, 20, 21, 1":"=r" (RT));
+   printf("lharx => 0x%lx\n", RT);
+}
+#endif
+
+int main(void)
+{
+#ifdef HAS_ISA_2_07
+   (void) test_reservation();
+#endif
+
+   return 0;
+}
diff --git a/memcheck/tests/ppc64/power_ISA2_07.stderr.exp b/memcheck/tests/ppc64/power_ISA2_07.stderr.exp
new file mode 100644 (file)
index 0000000..c22dd7f
--- /dev/null
@@ -0,0 +1,10 @@
+
+
+HEAP SUMMARY:
+    in use at exit: 0 bytes in 0 blocks
+  total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
diff --git a/memcheck/tests/ppc64/power_ISA2_07.stdout.exp b/memcheck/tests/ppc64/power_ISA2_07.stdout.exp
new file mode 100644 (file)
index 0000000..f67db25
--- /dev/null
@@ -0,0 +1,2 @@
+lbarx => 0x44
+lharx => 0xbad0
diff --git a/memcheck/tests/ppc64/power_ISA2_07.stdout.exp-LE b/memcheck/tests/ppc64/power_ISA2_07.stdout.exp-LE
new file mode 100644 (file)
index 0000000..80dd84b
--- /dev/null
@@ -0,0 +1,2 @@
+lbarx => 0x77
+lharx => 0xbeef
diff --git a/memcheck/tests/ppc64/power_ISA2_07.vgtest b/memcheck/tests/ppc64/power_ISA2_07.vgtest
new file mode 100644 (file)
index 0000000..63ba88f
--- /dev/null
@@ -0,0 +1,3 @@
+prereq: ../../../tests/check_isa-2_07_cap
+prog: power_ISA2_07
+vgopts: