From c11efa4a9dc0e457a26a82e4517476dff3463123 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 15 Oct 2009 12:32:44 -0700 Subject: [PATCH] tests: handle float opcodes --- testsuite/compile_opcodes_sys_c.c | 25 +++++++++-- testsuite/orcc/Makefile.am | 13 +++--- testsuite/orcc/test.orc | 93 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 10 deletions(-) diff --git a/testsuite/compile_opcodes_sys_c.c b/testsuite/compile_opcodes_sys_c.c index f109eef..0af7588 100644 --- a/testsuite/compile_opcodes_sys_c.c +++ b/testsuite/compile_opcodes_sys_c.c @@ -2,6 +2,7 @@ #include "config.h" #include +#include #include #include @@ -49,13 +50,19 @@ test_opcode (OrcStaticOpcode *opcode) { OrcProgram *p; OrcCompileResult result; + const char *s; p = orc_test_get_program_for_opcode (opcode); if (!p) return; result = orc_program_compile_for_target (p, orc_target_get_by_name("c")); if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) { - printf("%s", orc_program_get_asm_code (p)); + s = orc_program_get_asm_code (p); + if (s != NULL) { + printf("%s\n", s); + } else { + printf("no code\n"); + } error = TRUE; return; } @@ -68,13 +75,19 @@ test_opcode_const (OrcStaticOpcode *opcode) { OrcProgram *p; OrcCompileResult result; + const char *s; p = orc_test_get_program_for_opcode_const (opcode); if (!p) return; result = orc_program_compile_for_target (p, orc_target_get_by_name("c")); if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) { - printf("%s", orc_program_get_asm_code (p)); + s = orc_program_get_asm_code (p); + if (s != NULL) { + printf("%s\n", s); + } else { + printf("no code\n"); + } error = TRUE; return; } @@ -87,13 +100,19 @@ test_opcode_param (OrcStaticOpcode *opcode) { OrcProgram *p; OrcCompileResult result; + const char *s; p = orc_test_get_program_for_opcode_param (opcode); if (!p) return; result = orc_program_compile_for_target (p, orc_target_get_by_name("c")); if (!ORC_COMPILE_RESULT_IS_SUCCESSFUL(result)) { - printf("%s", orc_program_get_asm_code (p)); + s = orc_program_get_asm_code (p); + if (s != NULL) { + printf("%s\n", s); + } else { + printf("no code\n"); + } error = TRUE; return; } diff --git a/testsuite/orcc/Makefile.am b/testsuite/orcc/Makefile.am index 1007f39..4d339f7 100644 --- a/testsuite/orcc/Makefile.am +++ b/testsuite/orcc/Makefile.am @@ -2,19 +2,18 @@ TESTS = orc_test -#noinst_PROGRAMS = orc_test +noinst_PROGRAMS = orc_test -#nodist_SOURCES = orc_test.c +BUILT_SOURCES = orc_test.c AM_CFLAGS = $(ORC_CFLAGS) LIBS = $(ORC_LIBS) $(top_builddir)/orc-test/liborc-test-@ORC_MAJORMINOR@.la CLEANFILES = testorc.c testorc.h orc_test.c -orc_test.c: - $(top_builddir)/tools/orcc$(EXEEXT) test.orc - cp out.c testorc.c - cp out.h testorc.h - cp test_out.c orc_test.c +orc_test.c: $(srcdir)/test.orc + $(top_builddir)/tools/orcc$(EXEEXT) --header -o testorc.h test.orc + $(top_builddir)/tools/orcc$(EXEEXT) --implementation -o testorc.c test.orc + $(top_builddir)/tools/orcc$(EXEEXT) --test -o orc_test.c test.orc diff --git a/testsuite/orcc/test.orc b/testsuite/orcc/test.orc index 6718165..221ea7d 100644 --- a/testsuite/orcc/test.orc +++ b/testsuite/orcc/test.orc @@ -847,3 +847,96 @@ mergewl d1, s1, s2 mergebw d1, s1, s2 +.function orc_addf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +addf d1, s1, s2 + + +.function orc_subf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +subf d1, s1, s2 + + +.function orc_mulf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +mulf d1, s1, s2 + + +.function orc_divf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +divf d1, s1, s2 + + +.function orc_sqrtf +.dest 4 d1 +.source 4 s1 + +sqrtf d1, s1 + + +.function orc_maxf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +maxf d1, s1, s2 + + +.function orc_minf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +minf d1, s1, s2 + + +.function orc_cmpeqf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +cmpeqf d1, s1, s2 + + +.function orc_cmpltf +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +cmpltf d1, s1, s2 + + +.function orc_cmplef +.dest 4 d1 +.source 4 s1 +.source 4 s2 + +cmplef d1, s1, s2 + + +.function orc_convfl +.dest 4 d1 +.source 4 s1 + +convfl d1, s1 + + +.function orc_convlf +.dest 4 d1 +.source 4 s1 + +convlf d1, s1 + + -- 2.7.4