Add tests for float and pixel opcodes
authorDavid Schleef <ds@schleef.org>
Tue, 28 Apr 2009 02:09:31 +0000 (19:09 -0700)
committerDavid Schleef <ds@schleef.org>
Tue, 28 Apr 2009 02:09:31 +0000 (19:09 -0700)
orc-float/README
orc-pixel/README
testsuite/Makefile.am
testsuite/compile_opcodes_float.c [new file with mode: 0644]
testsuite/compile_opcodes_pixel.c [new file with mode: 0644]
testsuite/exec_opcodes_float.c [new file with mode: 0644]
testsuite/exec_opcodes_pixel.c [new file with mode: 0644]

index 359257c..2ed02ae 100644 (file)
@@ -14,63 +14,4 @@ notoriously difficult to get bit-exact floating point code in C.
 
 
 
-diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
-index d4220db..a754193 100644
---- a/testsuite/Makefile.am
-+++ b/testsuite/Makefile.am
-@@ -4,5 +4,6 @@ TESTS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile t
- orcbin_PROGRAMS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile test_accsadubl test-schro
- AM_CFLAGS = $(ORC_CFLAGS)
--LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-0.3.la
-+LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-0.3.la \
-+      $(top_builddir)/orc-float/liborc-float-0.3.la
-diff --git a/testsuite/test_compile.c b/testsuite/test_compile.c
-index f95aeb5..a3f58e2 100644
---- a/testsuite/test_compile.c
-+++ b/testsuite/test_compile.c
-@@ -6,6 +6,7 @@
- #include <orc/orc.h>
- #include <orc-test/orctest.h>
-+#include <orc-float/orcfloat.h>
- int error = FALSE;
-@@ -22,8 +23,9 @@ main (int argc, char *argv[])
-   orc_init();
-   orc_test_init();
-+  orc_float_init();
--  opcode_set = orc_opcode_set_get ("sys");
-+  opcode_set = orc_opcode_set_get ("float");
-   for(i=0;i<opcode_set->n_opcodes;i++){
-     printf("/* %s %d,%d,%d %p */\n",
-diff --git a/testsuite/test_local_opcode_execution.c b/testsuite/test_local_opcode_execution.c
-index fc62a49..17230d6 100644
---- a/testsuite/test_local_opcode_execution.c
-+++ b/testsuite/test_local_opcode_execution.c
-@@ -5,6 +5,7 @@
- #include <orc/orc.h>
- #include <orc-test/orctest.h>
-+#include <orc-float/orcfloat.h>
- int error = FALSE;
-@@ -20,10 +21,11 @@ main (int argc, char *argv[])
-   int i;
-   OrcOpcodeSet *opcode_set;
-+  orc_float_init();
-   orc_test_init();
-   orc_init();
--  opcode_set = orc_opcode_set_get ("sys");
-+  opcode_set = orc_opcode_set_get ("float");
-   for(i=0;i<opcode_set->n_opcodes;i++){
-     printf("/* %s src %d,%d,%d */\n",
+
index e2a1084..1c07142 100644 (file)
@@ -13,7 +13,7 @@ functions in liborc.
 
 The code generated by orcpixel-sse.c does not produce correct
 results unless loop_shift is 0 or 1.  This patch will force that to
-be true, along with changing the tests to check pixel opcodes:
+be true:
 
 
 diff --git a/orc/orcprogram-sse.c b/orc/orcprogram-sse.c
@@ -28,63 +28,3 @@ index 01ae501..29f8c10 100644
  
    //compiler->long_jumps = TRUE;
  }
-diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
-index d4220db..a754193 100644
---- a/testsuite/Makefile.am
-+++ b/testsuite/Makefile.am
-@@ -4,5 +4,6 @@ TESTS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile t
- orcbin_PROGRAMS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile test_accsadubl test-schro
- AM_CFLAGS = $(ORC_CFLAGS)
--LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-0.3.la
-+LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-0.3.la \
-+      $(top_builddir)/orc-pixel/liborc-pixel-0.3.la
-diff --git a/testsuite/test_compile.c b/testsuite/test_compile.c
-index f95aeb5..a3f58e2 100644
---- a/testsuite/test_compile.c
-+++ b/testsuite/test_compile.c
-@@ -6,6 +6,7 @@
- #include <orc/orc.h>
- #include <orc-test/orctest.h>
-+#include <orc-pixel/orcpixel.h>
- int error = FALSE;
-@@ -22,8 +23,9 @@ main (int argc, char *argv[])
-   orc_init();
-   orc_test_init();
-+  orc_pixel_init();
--  opcode_set = orc_opcode_set_get ("sys");
-+  opcode_set = orc_opcode_set_get ("pixel");
-   for(i=0;i<opcode_set->n_opcodes;i++){
-     printf("/* %s %d,%d,%d %p */\n",
-diff --git a/testsuite/test_local_opcode_execution.c b/testsuite/test_local_opcode_execution.c
-index fc62a49..17230d6 100644
---- a/testsuite/test_local_opcode_execution.c
-+++ b/testsuite/test_local_opcode_execution.c
-@@ -5,6 +5,7 @@
- #include <orc/orc.h>
- #include <orc-test/orctest.h>
-+#include <orc-pixel/orcpixel.h>
- int error = FALSE;
-@@ -20,10 +21,11 @@ main (int argc, char *argv[])
-   int i;
-   OrcOpcodeSet *opcode_set;
-+  orc_pixel_init();
-   orc_test_init();
-   orc_init();
--  opcode_set = orc_opcode_set_get ("sys");
-+  opcode_set = orc_opcode_set_get ("pixel");
-   for(i=0;i<opcode_set->n_opcodes;i++){
-     printf("/* %s src %d,%d,%d */\n",
index d4220db..11a8edc 100644 (file)
@@ -1,8 +1,24 @@
 
-TESTS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile test_accsadubl test-schro
+TESTS = test1 test2 test3 test4 test5 \
+       test_local_opcode_execution test_compile test_accsadubl test-schro \
+       compile_opcodes_float exec_opcodes_float \
+       compile_opcodes_pixel exec_opcodes_pixel
 
-orcbin_PROGRAMS = test1 test2 test3 test4 test5 test_local_opcode_execution test_compile test_accsadubl test-schro
+orcbin_PROGRAMS = test1 test2 test3 test4 test5 \
+       test_local_opcode_execution test_compile test_accsadubl test-schro \
+       compile_opcodes_float exec_opcodes_float \
+       compile_opcodes_pixel exec_opcodes_pixel
 
 AM_CFLAGS = $(ORC_CFLAGS)
 LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-0.3.la
 
+compile_opcodes_float_LDADD = \
+       $(top_builddir)/orc-float/liborc-float-0.3.la
+exec_opcodes_float_LDADD = \
+       $(top_builddir)/orc-float/liborc-float-0.3.la
+
+compile_opcodes_pixel_LDADD = \
+       $(top_builddir)/orc-pixel/liborc-pixel-0.3.la
+exec_opcodes_pixel_LDADD = \
+       $(top_builddir)/orc-pixel/liborc-pixel-0.3.la
+
diff --git a/testsuite/compile_opcodes_float.c b/testsuite/compile_opcodes_float.c
new file mode 100644 (file)
index 0000000..e94c17d
--- /dev/null
@@ -0,0 +1,143 @@
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <orc/orc.h>
+#include <orc-test/orctest.h>
+#include <orc-float/orcfloat.h>
+
+
+int error = FALSE;
+
+void test_opcode (OrcStaticOpcode *opcode);
+void test_opcode_const (OrcStaticOpcode *opcode);
+void test_opcode_param (OrcStaticOpcode *opcode);
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+  OrcOpcodeSet *opcode_set;
+
+  orc_init();
+  orc_test_init();
+  orc_float_init();
+
+  opcode_set = orc_opcode_set_get ("float");
+
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s const %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode_const (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s param %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode_param (opcode_set->opcodes + i);
+  }
+
+  if (error) return 1;
+  return 0;
+}
+
+void
+test_opcode (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+
+  if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) {
+    if (opcode->src_size[1] == 0) {
+      p = orc_program_new_as (opcode->dest_size[0], opcode->src_size[0]);
+    } else {
+      p = orc_program_new_ass (opcode->dest_size[0], opcode->src_size[0],
+          opcode->src_size[1]);
+    }
+  } else {
+    if (opcode->src_size[1] == 0) {
+      p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+    } else {
+      p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+          opcode->src_size[1]);
+    }
+  }
+
+  sprintf(s, "test_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) {
+    orc_program_append_str (p, opcode->name, "a1", "s1", "s2");
+  } else {
+    orc_program_append_str (p, opcode->name, "d1", "s1", "s2");
+  }
+
+  orc_test_gcc_compile (p);
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_const (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+
+  if (opcode->src_size[1] == 0) return;
+
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_constant (p, opcode->src_size[1], 1, "c1");
+
+  sprintf(s, "test_const_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "c1");
+
+  orc_test_gcc_compile (p);
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_param (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) return;
+
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_parameter (p, opcode->src_size[1], "p1");
+
+  sprintf(s, "test_param_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "p1");
+
+  ret = orc_test_gcc_compile (p);
+  if (!ret) {
+    printf("%s", orc_program_get_asm_code (p));
+  }
+
+  orc_program_free (p);
+}
+
diff --git a/testsuite/compile_opcodes_pixel.c b/testsuite/compile_opcodes_pixel.c
new file mode 100644 (file)
index 0000000..a3f58e2
--- /dev/null
@@ -0,0 +1,143 @@
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <orc/orc.h>
+#include <orc-test/orctest.h>
+#include <orc-pixel/orcpixel.h>
+
+
+int error = FALSE;
+
+void test_opcode (OrcStaticOpcode *opcode);
+void test_opcode_const (OrcStaticOpcode *opcode);
+void test_opcode_param (OrcStaticOpcode *opcode);
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+  OrcOpcodeSet *opcode_set;
+
+  orc_init();
+  orc_test_init();
+  orc_pixel_init();
+
+  opcode_set = orc_opcode_set_get ("pixel");
+
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s const %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode_const (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s param %d,%d,%d %p */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1],
+        opcode_set->opcodes[i].emulate);
+    test_opcode_param (opcode_set->opcodes + i);
+  }
+
+  if (error) return 1;
+  return 0;
+}
+
+void
+test_opcode (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+
+  if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) {
+    if (opcode->src_size[1] == 0) {
+      p = orc_program_new_as (opcode->dest_size[0], opcode->src_size[0]);
+    } else {
+      p = orc_program_new_ass (opcode->dest_size[0], opcode->src_size[0],
+          opcode->src_size[1]);
+    }
+  } else {
+    if (opcode->src_size[1] == 0) {
+      p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+    } else {
+      p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+          opcode->src_size[1]);
+    }
+  }
+
+  sprintf(s, "test_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  if (opcode->flags & ORC_STATIC_OPCODE_ACCUMULATOR) {
+    orc_program_append_str (p, opcode->name, "a1", "s1", "s2");
+  } else {
+    orc_program_append_str (p, opcode->name, "d1", "s1", "s2");
+  }
+
+  orc_test_gcc_compile (p);
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_const (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+
+  if (opcode->src_size[1] == 0) return;
+
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_constant (p, opcode->src_size[1], 1, "c1");
+
+  sprintf(s, "test_const_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "c1");
+
+  orc_test_gcc_compile (p);
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_param (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) return;
+
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_parameter (p, opcode->src_size[1], "p1");
+
+  sprintf(s, "test_param_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "p1");
+
+  ret = orc_test_gcc_compile (p);
+  if (!ret) {
+    printf("%s", orc_program_get_asm_code (p));
+  }
+
+  orc_program_free (p);
+}
+
diff --git a/testsuite/exec_opcodes_float.c b/testsuite/exec_opcodes_float.c
new file mode 100644 (file)
index 0000000..bd2eefa
--- /dev/null
@@ -0,0 +1,174 @@
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include <orc/orc.h>
+#include <orc-test/orctest.h>
+#include <orc-float/orcfloat.h>
+
+
+int error = FALSE;
+
+void test_opcode_src (OrcStaticOpcode *opcode);
+void test_opcode_const (OrcStaticOpcode *opcode);
+void test_opcode_param (OrcStaticOpcode *opcode);
+void test_opcode_inplace (OrcStaticOpcode *opcode);
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+  OrcOpcodeSet *opcode_set;
+
+  orc_float_init();
+  orc_test_init();
+  orc_init();
+
+  opcode_set = orc_opcode_set_get ("float");
+
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s src %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_src (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s const %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_const (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s param %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_param (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s inplace %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_inplace (opcode_set->opcodes + i);
+  }
+
+  if (error) return 1;
+  return 0;
+}
+
+void
+test_opcode_src (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  } else {
+    p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+        opcode->src_size[1]);
+  }
+
+  sprintf(s, "test_s_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "s2");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_const (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    return;
+  }
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_constant (p, opcode->src_size[1], 1, "c1");
+
+  sprintf(s, "test_c_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "c1");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_param (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    return;
+  }
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_parameter (p, opcode->src_size[1], "p1");
+
+  sprintf(s, "test_c_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "p1");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_inplace (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->dest_size[0] != opcode->src_size[0]) return;
+
+  if (opcode->src_size[1] == 0) {
+    p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  } else {
+    p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+        opcode->src_size[1]);
+  }
+
+  sprintf(s, "test_inplace_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "d1", "s2");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
diff --git a/testsuite/exec_opcodes_pixel.c b/testsuite/exec_opcodes_pixel.c
new file mode 100644 (file)
index 0000000..17230d6
--- /dev/null
@@ -0,0 +1,174 @@
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include <orc/orc.h>
+#include <orc-test/orctest.h>
+#include <orc-pixel/orcpixel.h>
+
+
+int error = FALSE;
+
+void test_opcode_src (OrcStaticOpcode *opcode);
+void test_opcode_const (OrcStaticOpcode *opcode);
+void test_opcode_param (OrcStaticOpcode *opcode);
+void test_opcode_inplace (OrcStaticOpcode *opcode);
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+  OrcOpcodeSet *opcode_set;
+
+  orc_pixel_init();
+  orc_test_init();
+  orc_init();
+
+  opcode_set = orc_opcode_set_get ("pixel");
+
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s src %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_src (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s const %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_const (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s param %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_param (opcode_set->opcodes + i);
+  }
+  for(i=0;i<opcode_set->n_opcodes;i++){
+    printf("/* %s inplace %d,%d,%d */\n",
+        opcode_set->opcodes[i].name,
+        opcode_set->opcodes[i].dest_size[0],
+        opcode_set->opcodes[i].src_size[0],
+        opcode_set->opcodes[i].src_size[1]);
+    test_opcode_inplace (opcode_set->opcodes + i);
+  }
+
+  if (error) return 1;
+  return 0;
+}
+
+void
+test_opcode_src (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  } else {
+    p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+        opcode->src_size[1]);
+  }
+
+  sprintf(s, "test_s_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "s2");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_const (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    return;
+  }
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_constant (p, opcode->src_size[1], 1, "c1");
+
+  sprintf(s, "test_c_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "c1");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_param (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->src_size[1] == 0) {
+    return;
+  }
+  p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  orc_program_add_parameter (p, opcode->src_size[1], "p1");
+
+  sprintf(s, "test_c_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "s1", "p1");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+
+void
+test_opcode_inplace (OrcStaticOpcode *opcode)
+{
+  OrcProgram *p;
+  char s[40];
+  int ret;
+
+  if (opcode->dest_size[0] != opcode->src_size[0]) return;
+
+  if (opcode->src_size[1] == 0) {
+    p = orc_program_new_ds (opcode->dest_size[0], opcode->src_size[0]);
+  } else {
+    p = orc_program_new_dss (opcode->dest_size[0], opcode->src_size[0],
+        opcode->src_size[1]);
+  }
+
+  sprintf(s, "test_inplace_%s", opcode->name);
+  orc_program_set_name (p, s);
+
+  orc_program_append_str (p, opcode->name, "d1", "d1", "s2");
+
+  ret = orc_test_compare_output (p);
+  if (!ret) {
+    error = TRUE;
+  }
+
+  orc_program_free (p);
+}
+