* New R5900 COP2 test case.
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 17 Apr 1998 19:04:41 +0000 (19:04 +0000)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 17 Apr 1998 19:04:41 +0000 (19:04 +0000)
sim/testsuite/sky/.Sanitize
sim/testsuite/sky/ChangeLog
sim/testsuite/sky/Makefile.in
sim/testsuite/sky/t-cop2.s
sim/testsuite/sky/t-cop2b.c [new file with mode: 0644]

index d51b6cd276a4795dd825cb1764ed5aed47b7760c..343a1ed3325bef83d851ae9bc4f0673821a470d8 100644 (file)
@@ -212,6 +212,7 @@ sce_test9_out_gif.dat
 sky.ld
 t-cop2.s
 t-cop2.vuexpect
+t-cop2b.c
 t-dma.c
 t-pke2.trc
 t-pke2.vif1expect
index f2db693d80f4c710f975c1713b2d8064f73d6a74..0bdf249461c33f2a01f4c84b30529fcaa9c577fa 100644 (file)
@@ -1,3 +1,9 @@
+Fri Apr 17 14:47:53 1998  Frank Ch. Eigler  <fche@cygnus.com>
+
+       * t-cop2b.c: New test for COP2 via inline asm.
+       * Makefile.in: Build t-cop2b.
+       * t-cop2.s: Update for new VCALLMSR instruction.
+
 Thu Apr 16 15:05:51 1998 Jillian Ye <jillian@cygnus.com>
 
        * t-pke2.trc t-pke2.vif1expect : Update the testcase
index 2710dc9b77e97b7a019c370835dfb96f44664e12..8adbf1898b0155d0c95bea9fa831f9e6ed6e5041 100644 (file)
@@ -109,7 +109,7 @@ TESTS = \
        tsv408_0.ok tsv408_1.ok \
        tsv416_0.ok tsv416_1.ok \
        tsv432_0.ok tsv432_1.ok \
-       t-cop2.vuok
+       t-cop2.vuok t-cop2b.ok
 
 #SCE_TESTS := $(patsubst %.dvpasm, %.ok, $(wildcard sce*.dvpasm))
 SCE_TESTS = \
@@ -139,13 +139,13 @@ sanity:
        @eval echo GCC_FOR_TARGET = $(GCC_FOR_TARGET)
        @eval echo DVPAS_FOR_TARGET = $(DVPAS_FOR_TARGET)
        @eval echo DVPOBJCP_FOR_TARGET = $(DVPOBJCP_FOR_TARGET)
-                
+
 #------------------------------------
 # Rules for building and running the SCE tests :
 #------------------------------------
 
 LDFLAGS=-T$(srcdir)/sky.ld
-CFLAGS += -I$(srcdir)
+CFLAGS += -g -I$(srcdir)
 ASFLAGS = -I$(srcdir)
 
 sce%.exe: sce%.o sce_main.o refresh.o
@@ -217,7 +217,7 @@ sce%.ok: sce%.exe
 .trc.c:
        $(C_GEN) $< $@
 .c.run:
-       $(GCC_FOR_TARGET) -T$(srcdir)/sky.ld -o $@ $<
+       $(GCC_FOR_TARGET) $(CFLAGS) $(LDFLAGS) -o $@ $<
 .uu.run:
        uudecode $< > $@
 .run.vif0out:
@@ -232,6 +232,8 @@ sce%.ok: sce%.exe
 .s.run:
        rm -f $@
        $(AS_FOR_TARGET) -mcpu=r5900 -o $@ $<
+.c.s:
+       $(GCC_FOR_TARGET) -S -o $@ $<
 
 
 #
index d00d710485632c36d24069645f8052c6dbe0ffdc..b6788f99cd1b1dbc4865ef9d9aec3f2c7da7a3e5 100644 (file)
@@ -265,7 +265,7 @@ mpg:
        vaddaz.xyz  ACC,vf2,vf3
        vaddaz.wxyz  ACC,vf2,vf3
        vcallms  stuff
-       vcallmsr vi19
+       vcallmsr vi27
        vclip vf4
        vdiv Q,vf4z,vf8w
        vdiv Q,vf4y,vf8x
diff --git a/sim/testsuite/sky/t-cop2b.c b/sim/testsuite/sky/t-cop2b.c
new file mode 100644 (file)
index 0000000..7d3d6f4
--- /dev/null
@@ -0,0 +1,136 @@
+/* Copyright (C) 1998 Cygnus Solutions */
+/* COP2 function test, with non-expert inline assembly */
+
+
+
+/* globals */
+
+int num_ok = 0;
+int num_errors = 0;
+float data_array[128] __attribute__((aligned(16)));
+
+
+
+/* macros */
+
+#define TEST(x) do_test(x, #x, __LINE__)
+
+
+
+/* prototypes */
+
+
+void enable_cop2();
+void test00();
+void do_test(int ok, const char* test, int line);
+
+
+
+/* Utility functions */
+
+void
+enable_cop2()
+{
+  asm volatile (".set noat");
+  asm volatile ("mfc0 $1,$12; dli $2,0x40000000; or $1,$2,$2; mtc0 $1,$12"
+               : /* no outputs */
+               : /* no inputs */
+               : "$1", "$2" /* clobbered */);
+  asm volatile (".set at");  
+}
+
+
+void
+do_test(int ok, const char* test, int line)
+{
+  static int test_num = 0;
+
+  printf("[%d @ %d] (%s): ", ++test_num, line, test);
+  if(ok)
+    {
+      num_ok ++;
+      printf("ok\n");
+    }
+  else
+    {
+      num_errors ++;
+      printf("ko\n");
+    }
+}
+
+
+
+/* Tests */
+
+
+/* test00: test LQC2/SQC2 data non-corruption */
+void test00()
+{
+  volatile float* data = & data_array[0];
+  volatile float* data2 = & data_array[4];
+
+  /* stuff some initial values */
+  data[0] = -10.0;
+  data[1] = +10.0;
+  data[2] = -20.0;
+  data[3] = +20.0;
+
+  /* save values */
+  asm volatile ("lqc2 vf01,%0"
+               : /* no output */
+               : "m" (data[0]) /* input */
+               : "memory" /* clobbered */);
+
+  /* test no clobbering */
+  TEST(data[0] == -10.0f);
+  TEST(data[1] == +10.0f);
+  TEST(data[2] == -20.0f);
+  TEST(data[3] == +20.0f);
+
+  /* overwrite with VU constants */
+  asm volatile ("sqc2 vf00,%0"
+               : /* no outputs */
+               : "m" (data[0]) /* input */
+               : "memory" /* clobbered */);
+
+  /* test proper values */
+  TEST(data[0] == 0.0f);
+  TEST(data[1] == 0.5f);
+  TEST(data[2] == -1.0f);
+  TEST(data[3] == +1.0f);
+
+  /* read back original array values */
+  asm volatile ("sqc2 vf01,%0"
+               : /* no outputs */
+               : "m" (data2[0]) /* input */
+               : "memory" /* clobbered */);
+
+  /* printf("%f,%f,%f,%f\n", data2[0], data2[1], data2[2], data2[3]); */
+
+  /* test proper values */
+  TEST(data2[0] == -10.0f);
+  TEST(data2[1] == +10.0f);
+  TEST(data2[2] == -20.0f);
+  TEST(data2[3] == +20.0f);
+} 
+
+
+
+/* Mainline */
+
+
+int main()
+{
+  enable_cop2();
+
+  /* tests */
+  test00();
+
+
+  /* summarize */
+  printf("%d ok, %d bad\n", num_ok, num_errors);
+  if(num_errors > 0)
+    exit(47);
+  else
+    exit(0);
+}
This page took 0.033459 seconds and 4 git commands to generate.