summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2009-06-10 22:29:00 -0700
committerDavid Schleef <ds@schleef.org>2009-06-10 22:29:00 -0700
commit43562477b40bf250a5002fef7983522cc88b5272 (patch)
treefbea4c9c339d3cb69077dd3dbf9f8f9c0c029db0 /testsuite
parent31cc86647003d622d02b98032d578cd6588260ad (diff)
Add c64x opcodes test
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/compile_opcodes_sys_c64x.c116
1 files changed, 116 insertions, 0 deletions
diff --git a/testsuite/compile_opcodes_sys_c64x.c b/testsuite/compile_opcodes_sys_c64x.c
new file mode 100644
index 0000000..4cca5e8
--- /dev/null
+++ b/testsuite/compile_opcodes_sys_c64x.c
@@ -0,0 +1,116 @@
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <orc/orc.h>
+#include <orc-test/orctest.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();
+
+ opcode_set = orc_opcode_set_get ("sys");
+
+ 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;
+ OrcTestResult ret;
+
+ p = orc_test_get_program_for_opcode (opcode);
+ if (!p) return;
+
+ ret = orc_test_gcc_compile_c64x (p);
+ if (ret == ORC_TEST_FAILED) {
+ printf("%s", orc_program_get_asm_code (p));
+ error = TRUE;
+ return;
+ }
+
+ orc_program_free (p);
+}
+
+void
+test_opcode_const (OrcStaticOpcode *opcode)
+{
+ OrcProgram *p;
+ OrcTestResult ret;
+
+ p = orc_test_get_program_for_opcode_const (opcode);
+ if (!p) return;
+
+ ret = orc_test_gcc_compile_c64x (p);
+ if (ret == ORC_TEST_FAILED) {
+ printf("%s", orc_program_get_asm_code (p));
+ error = TRUE;
+ return;
+ }
+
+ orc_program_free (p);
+}
+
+void
+test_opcode_param (OrcStaticOpcode *opcode)
+{
+ OrcProgram *p;
+ OrcTestResult ret;
+
+ p = orc_test_get_program_for_opcode_param (opcode);
+ if (!p) return;
+
+ ret = orc_test_gcc_compile_c64x (p);
+ if (ret == ORC_TEST_FAILED) {
+ printf("%s", orc_program_get_asm_code (p));
+ error = TRUE;
+ return;
+ }
+
+ orc_program_free (p);
+}
+