[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 72/86: Add int->float tests
From: |
Andy Wingo |
Subject: |
[Guile-commits] 72/86: Add int->float tests |
Date: |
Wed, 3 Apr 2019 11:39:03 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit bbb8bd94f221d48a5911150bc440c537c8b76cca
Author: Andy Wingo <address@hidden>
Date: Tue Mar 26 22:32:40 2019 +0100
Add int->float tests
---
tests/extr_d.c | 29 +++++++++++++++++++++++++++++
tests/extr_f.c | 29 +++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/tests/extr_d.c b/tests/extr_d.c
new file mode 100644
index 0000000..35d0ab3
--- /dev/null
+++ b/tests/extr_d.c
@@ -0,0 +1,29 @@
+#include "test.h"
+
+static void
+run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
+{
+ jit_begin(j, arena_base, arena_size);
+
+ const jit_arg_abi_t abi[] = { JIT_ARG_ABI_INTMAX };
+ jit_arg_t args[1];
+ const jit_anyreg_t regs[] = { { .gpr=JIT_R0 } };
+
+ jit_receive(j, 1, abi, args);
+ jit_load_args(j, 1, abi, args, regs);
+
+ jit_extr_d(j, JIT_F0, JIT_R0);
+ jit_retr_d(j, JIT_F0);
+
+ double (*f)(intmax_t) = jit_end(j, NULL);
+
+ ASSERT(f(0) == 0.0);
+ ASSERT(f(1) == 1.0);
+ ASSERT(f(-100) == -100.0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/extr_f.c b/tests/extr_f.c
new file mode 100644
index 0000000..f16cd8c
--- /dev/null
+++ b/tests/extr_f.c
@@ -0,0 +1,29 @@
+#include "test.h"
+
+static void
+run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
+{
+ jit_begin(j, arena_base, arena_size);
+
+ const jit_arg_abi_t abi[] = { JIT_ARG_ABI_INTMAX };
+ jit_arg_t args[1];
+ const jit_anyreg_t regs[] = { { .gpr=JIT_R0 } };
+
+ jit_receive(j, 1, abi, args);
+ jit_load_args(j, 1, abi, args, regs);
+
+ jit_extr_f(j, JIT_F0, JIT_R0);
+ jit_retr_f(j, JIT_F0);
+
+ float (*f)(intmax_t) = jit_end(j, NULL);
+
+ ASSERT(f(0) == 0.0f);
+ ASSERT(f(1) == 1.0f);
+ ASSERT(f(-100) == -100.0f);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
- [Guile-commits] 67/86: Add some nop and jmp tests, and fix a hazard with jmpi/calli, (continued)
- [Guile-commits] 67/86: Add some nop and jmp tests, and fix a hazard with jmpi/calli, Andy Wingo, 2019/04/03
- [Guile-commits] 62/86: Add anti-float comparison tests, Andy Wingo, 2019/04/03
- [Guile-commits] 51/86: Add str tests, Andy Wingo, 2019/04/03
- [Guile-commits] 58/86: Add bltr test, Andy Wingo, 2019/04/03
- [Guile-commits] 65/86: Add add-and-branch-on-overflow tests, Andy Wingo, 2019/04/03
- [Guile-commits] 59/86: Add more integer reg/reg branch-and-compare tests, Andy Wingo, 2019/04/03
- [Guile-commits] 80/86: Add subdir-objects option to libguile makefile., Andy Wingo, 2019/04/03
- [Guile-commits] 82/86: Merge in changes from upstream lightening, Andy Wingo, 2019/04/03
- [Guile-commits] 68/86: Add push/pop test, Andy Wingo, 2019/04/03
- [Guile-commits] 70/86: Add truncr_[df]_[li] tests, Andy Wingo, 2019/04/03
- [Guile-commits] 72/86: Add int->float tests,
Andy Wingo <=
- [Guile-commits] 54/86: Add stxi tests, Andy Wingo, 2019/04/03
- [Guile-commits] 16/86: Create beginning of stripped-down lightning interface, Andy Wingo, 2019/04/03
- [Guile-commits] 84/86: Allow users to pass custom allocators, Andy Wingo, 2019/04/03
- [Guile-commits] 85/86: Fix jit_reset to be useful, Andy Wingo, 2019/04/03
- [Guile-commits] 76/86: Implement arg shuffling for jit_call{i,r}, Andy Wingo, 2019/04/03
- [Guile-commits] 86/86: Merge from upstream Lightening, Andy Wingo, 2019/04/03
- [Guile-commits] 81/86: Change headers and files to be named "lightening" instead of "jit", Andy Wingo, 2019/04/03
- [Guile-commits] 71/86: Add float/double cast inst tests, Andy Wingo, 2019/04/03
- [Guile-commits] 60/86: Add floating-point reg/reg compare-and-branch tests, Andy Wingo, 2019/04/03
- [Guile-commits] 20/86: Trim unneded bits from jit.c, Andy Wingo, 2019/04/03