[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 71/86: Add float/double cast inst tests
From: |
Andy Wingo |
Subject: |
[Guile-commits] 71/86: Add float/double cast inst tests |
Date: |
Wed, 3 Apr 2019 11:39:03 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit ece71ef64c96717b1f50bcac2933a97075e9198c
Author: Andy Wingo <address@hidden>
Date: Tue Mar 26 22:29:48 2019 +0100
Add float/double cast inst tests
---
tests/extr_d_f.c | 30 ++++++++++++++++++++++++++++++
tests/extr_f_d.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/tests/extr_d_f.c b/tests/extr_d_f.c
new file mode 100644
index 0000000..570bae8
--- /dev/null
+++ b/tests/extr_d_f.c
@@ -0,0 +1,30 @@
+#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_DOUBLE };
+ jit_arg_t args[1];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 } };
+
+ jit_receive(j, 1, abi, args);
+ jit_load_args(j, 1, abi, args, regs);
+
+ jit_extr_d_f(j, JIT_F0, JIT_F0);
+ jit_retr_f(j, JIT_F0);
+
+ float (*f)(double) = jit_end(j, NULL);
+
+ ASSERT(f(0.0) == 0.0f);
+ ASSERT(f(0.5) == 0.5f);
+ ASSERT(f(1.0 / 0.0) == 1.0f / 0.0f);
+ ASSERT(f(1.25) == 1.25f);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/extr_f_d.c b/tests/extr_f_d.c
new file mode 100644
index 0000000..5e90be4
--- /dev/null
+++ b/tests/extr_f_d.c
@@ -0,0 +1,30 @@
+#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_FLOAT };
+ jit_arg_t args[1];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 } };
+
+ jit_receive(j, 1, abi, args);
+ jit_load_args(j, 1, abi, args, regs);
+
+ jit_extr_f_d(j, JIT_F0, JIT_F0);
+ jit_retr_d(j, JIT_F0);
+
+ double (*f)(float) = jit_end(j, NULL);
+
+ ASSERT(f(0.0f) == 0.0);
+ ASSERT(f(0.5f) == 0.5);
+ ASSERT(f(1.0f / 0.0f) == 1.0 / 0.0);
+ ASSERT(f(1.25f) == 1.25);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
- [Guile-commits] 68/86: Add push/pop test, (continued)
- [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, 2019/04/03
- [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 <=
- [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
- [Guile-commits] 05/86: Inline body.texi and version.texi into lightning.texi, Andy Wingo, 2019/04/03
- [Guile-commits] 77/86: Provide some type safety for jit_gpr_t and jit_fpr_t, Andy Wingo, 2019/04/03
- [Guile-commits] 79/86: Replace GNU Lightning with Lightening, Andy Wingo, 2019/04/03
- [Guile-commits] 83/86: Adapt to lightning -> lightening name change, Andy Wingo, 2019/04/03
- [Guile-commits] 13/86: Remove -sz.c files, Andy Wingo, 2019/04/03
- [Guile-commits] 07/86: Archive lightning ChangeLog, Andy Wingo, 2019/04/03
- [Guile-commits] 74/86: Remove old tests, Andy Wingo, 2019/04/03
- [Guile-commits] 24/86: Really finish stdint conversion, Andy Wingo, 2019/04/03