]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
A a test for the 'mcrfs' insn.
authorJulian Seward <jseward@acm.org>
Wed, 4 Oct 2006 18:01:05 +0000 (18:01 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 4 Oct 2006 18:01:05 +0000 (18:01 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6173

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

index ba028f32e272e3950ac0a8f751edfc65fecc9c84..05755a483fe1744d12bcb13164d287337b21ca22 100644 (file)
@@ -8,6 +8,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
        jm-fp.stderr.exp jm-fp.stdout.exp jm-fp.vgtest \
        jm-vmx.stderr.exp   jm-vmx.stdout.exp   jm-vmx.vgtest \
        mftocrf.stderr.exp mftocrf.stdout.exp mftocrf.vgtest \
+       mcrfs.stderr.exp mcrfs.stdout.exp mcrfs.vgtest \
        round.stderr.exp round.stdout.exp round.vgtest \
        test_fx.stderr.exp test_fx.stdout.exp test_fx.vgtest \
        test_gx.stderr.exp test_gx.stdout.exp test_gx.vgtest \
@@ -16,8 +17,8 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
        xlc_dbl_u32.stderr.exp xlc_dbl_u32.stdout.exp xlc_dbl_u32.vgtest
 
 check_PROGRAMS = \
-       ldstrev lsw jm-insns mftocrf round test_fx test_gx testVMX \
-       twi xlc_dbl_u32
+       ldstrev lsw jm-insns mftocrf mcrfs round test_fx test_gx \
+       testVMX twi xlc_dbl_u32
 
 AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
                @FLAG_M32@
diff --git a/none/tests/ppc32/mcrfs.c b/none/tests/ppc32/mcrfs.c
new file mode 100644 (file)
index 0000000..984ea57
--- /dev/null
@@ -0,0 +1,52 @@
+
+#include <stdio.h>
+
+typedef unsigned int UInt;
+
+void set_fpscr ( UInt x )
+{
+   UInt d[2];
+   d[0] = 0;
+   d[1] = x;
+   __asm__ __volatile__(
+      "lfd %%f0,0(%0)\n\t"
+      "mtfsf 255,%%f0"
+      : /*out*/
+      : /*in*/ "b"(&d[0])
+      : /*trash*/ "fr0", "cc", "memory"
+   );
+
+}
+
+int main ( void )
+{
+  int i;
+  UInt r;
+  for (i = 0; i < 16; i++) {
+    set_fpscr(i);
+    __asm__ __volatile__(
+       "li %0,0\n\t"
+       "mtcr %0\n\t"
+       "mcrfs 1,7\n\t"
+       "mfcr %0"
+       : /*out*/ "=b"(r)
+       : /*in*/ 
+       : /*trash*/ "cc" 
+    );
+    printf("0x%x -> 0x%08x\n", i, r);
+  }
+  for (i = 0; i < 16; i++) {
+    set_fpscr(i);
+    __asm__ __volatile__(
+       "li %0,-1\n\t"
+       "mtcr %0\n\t"
+       "mcrfs 1,7\n\t"
+       "mfcr %0"
+       : /*out*/ "=b"(r)
+       : /*in*/ 
+       : /*trash*/ "cc" 
+    );
+    printf("0x%x -> 0x%08x\n", i, r);
+  }
+  return 0;
+}
diff --git a/none/tests/ppc32/mcrfs.stderr.exp b/none/tests/ppc32/mcrfs.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/ppc32/mcrfs.stdout.exp b/none/tests/ppc32/mcrfs.stdout.exp
new file mode 100644 (file)
index 0000000..e144aaa
--- /dev/null
@@ -0,0 +1,32 @@
+0x0 -> 0x00000000
+0x1 -> 0x01000000
+0x2 -> 0x02000000
+0x3 -> 0x03000000
+0x4 -> 0x00000000
+0x5 -> 0x01000000
+0x6 -> 0x02000000
+0x7 -> 0x03000000
+0x8 -> 0x00000000
+0x9 -> 0x01000000
+0xa -> 0x02000000
+0xb -> 0x03000000
+0xc -> 0x00000000
+0xd -> 0x01000000
+0xe -> 0x02000000
+0xf -> 0x03000000
+0x0 -> 0xf0ffffff
+0x1 -> 0xf1ffffff
+0x2 -> 0xf2ffffff
+0x3 -> 0xf3ffffff
+0x4 -> 0xf0ffffff
+0x5 -> 0xf1ffffff
+0x6 -> 0xf2ffffff
+0x7 -> 0xf3ffffff
+0x8 -> 0xf0ffffff
+0x9 -> 0xf1ffffff
+0xa -> 0xf2ffffff
+0xb -> 0xf3ffffff
+0xc -> 0xf0ffffff
+0xd -> 0xf1ffffff
+0xe -> 0xf2ffffff
+0xf -> 0xf3ffffff
diff --git a/none/tests/ppc32/mcrfs.vgtest b/none/tests/ppc32/mcrfs.vgtest
new file mode 100644 (file)
index 0000000..faa6d68
--- /dev/null
@@ -0,0 +1 @@
+prog: mcrfs