]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: additional test case for fix in VEX r2648
authorPetar Jovanovic <mips32r2@gmail.com>
Sun, 20 Jan 2013 18:27:39 +0000 (18:27 +0000)
committerPetar Jovanovic <mips32r2@gmail.com>
Sun, 20 Jan 2013 18:27:39 +0000 (18:27 +0000)
Test program that triggers different corner cases related to position of
branch instruction and max size of a translation block (60 instructions).
Fix for these issues has been submitted in r2648.

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

none/tests/mips32/Makefile.am
none/tests/mips32/block_size.c [new file with mode: 0644]
none/tests/mips32/block_size.stderr.exp [new file with mode: 0644]
none/tests/mips32/block_size.stdout.exp [new file with mode: 0644]
none/tests/mips32/block_size.vgtest [new file with mode: 0644]

index 4be7eee265e29a05202b0303152a3eeb3ea54976..5d23ab6fa3fc69e817e4a5942a8c7705acec206e 100644 (file)
@@ -4,6 +4,7 @@ include $(top_srcdir)/Makefile.tool-tests.am
 dist_noinst_SCRIPTS = filter_stderr
 
 EXTRA_DIST = \
+       block_size.stdout.exp block_size.stderr.exp block_size.vgtest \
        branches.stdout.exp branches.stderr.exp branches.vgtest \
        FPUarithmetic.stdout.exp FPUarithmetic.stdout.exp-mips32 \
        FPUarithmetic.stderr.exp FPUarithmetic.vgtest \
@@ -22,6 +23,7 @@ EXTRA_DIST = \
 
 check_PROGRAMS = \
        allexec \
+       block_size \
        branches \
        FPUarithmetic \
        LoadStore \
diff --git a/none/tests/mips32/block_size.c b/none/tests/mips32/block_size.c
new file mode 100644 (file)
index 0000000..4b82196
--- /dev/null
@@ -0,0 +1,71 @@
+#include <stdio.h>
+
+__attribute__((noinline)) int test_block_size1 ()
+{
+   int result = 1;
+   __asm__ __volatile__(
+         ".set noreorder"      "\n\t"
+         ".set nomacro"        "\n\t"
+         "b begin1"            "\n\t"
+         "nop"                 "\n\t"
+         "begin1:"             "\n\t"
+         ".rept 56"            "\n\t"
+         ".word 0"             "\n\t"
+         ".endr"               "\n\t"
+         "li $4, 0"            "\n\t"
+         "j end1"              "\n\t"
+         "nop"                 "\n\t"
+         "b label1"            "\n\t"
+         "nop"                 "\n\t"
+         "label1:"             "\n\t"
+         "li $4, 1"            "\n\t"
+         "end1:"               "\n\t"
+         "move %0, $4"         "\n\t"
+         ".set reorder"        "\n\t"
+         ".set macro"          "\n\t"
+         : /*out*/ "=r" (result)
+         : /*in*/
+         : /*trash*/ "$4");
+   return result;
+}
+
+__attribute__((noinline)) int test_block_size2 ()
+{
+   int result = 1;
+   __asm__ __volatile__(
+         ".set noreorder"      "\n\t"
+         ".set nomacro"        "\n\t"
+         "b begin2"            "\n\t"
+         "nop"                 "\n\t"
+         "begin2:"             "\n\t"
+         ".rept 58"            "\n\t"
+         ".word 0"             "\n\t"
+         ".endr"               "\n\t"
+         "li $4, 1"            "\n\t"
+         "j end2"              "\n\t"
+         "li $4, 0"            "\n\t"
+         "end2:"               "\n\t"
+         "move %0, $4"         "\n\t"
+         ".set reorder"        "\n\t"
+         ".set macro"          "\n\t"
+         : /*out*/ "=r" (result)
+         : /*in*/
+         : /*trash*/ "$4");
+   return result;
+}
+
+int main ()
+{
+   /*******************TEST1*******************/
+   if (test_block_size1() == 0)
+      printf("test1 - PASS\n");
+   else
+      printf("test1 - FAIL\n");
+
+   /*******************TEST2*******************/
+   if (test_block_size2() == 0)
+      printf("test2 - PASS\n");
+   else
+      printf("test2 - FAIL\n");
+   return 0;
+}
diff --git a/none/tests/mips32/block_size.stderr.exp b/none/tests/mips32/block_size.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/none/tests/mips32/block_size.stdout.exp b/none/tests/mips32/block_size.stdout.exp
new file mode 100644 (file)
index 0000000..3a48f4e
--- /dev/null
@@ -0,0 +1,2 @@
+test1 - PASS
+test2 - PASS
diff --git a/none/tests/mips32/block_size.vgtest b/none/tests/mips32/block_size.vgtest
new file mode 100644 (file)
index 0000000..d8eefe5
--- /dev/null
@@ -0,0 +1,2 @@
+prog: block_size
+vgopts: -q