[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 60/86: Add floating-point reg/reg compare-and-branch tes
From: |
Andy Wingo |
Subject: |
[Guile-commits] 60/86: Add floating-point reg/reg compare-and-branch tests |
Date: |
Wed, 3 Apr 2019 11:39:00 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit ab0d17286a2390f602ead7a1be3554536a879d45
Author: Andy Wingo <address@hidden>
Date: Tue Mar 26 14:43:53 2019 +0100
Add floating-point reg/reg compare-and-branch tests
---
tests/beqr_d.c | 34 ++++++++++++++++++++++++++++++++++
tests/beqr_f.c | 34 ++++++++++++++++++++++++++++++++++
tests/bger_d.c | 33 +++++++++++++++++++++++++++++++++
tests/bger_f.c | 33 +++++++++++++++++++++++++++++++++
tests/bgtr_d.c | 33 +++++++++++++++++++++++++++++++++
tests/bgtr_f.c | 33 +++++++++++++++++++++++++++++++++
tests/bler_d.c | 33 +++++++++++++++++++++++++++++++++
tests/bler_f.c | 33 +++++++++++++++++++++++++++++++++
tests/bltr_d.c | 33 +++++++++++++++++++++++++++++++++
tests/bltr_f.c | 33 +++++++++++++++++++++++++++++++++
tests/bner_d.c | 33 +++++++++++++++++++++++++++++++++
tests/bner_f.c | 33 +++++++++++++++++++++++++++++++++
12 files changed, 398 insertions(+)
diff --git a/tests/beqr_d.c b/tests/beqr_d.c
new file mode 100644
index 0000000..9bc6c0f
--- /dev/null
+++ b/tests/beqr_d.c
@@ -0,0 +1,34 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_beqr_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 0);
+ ASSERT(f(1, 1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/beqr_f.c b/tests/beqr_f.c
new file mode 100644
index 0000000..00e1fcc
--- /dev/null
+++ b/tests/beqr_f.c
@@ -0,0 +1,34 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_beqr_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 0);
+ ASSERT(f(1, 1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bger_d.c b/tests/bger_d.c
new file mode 100644
index 0000000..24a52dc
--- /dev/null
+++ b/tests/bger_d.c
@@ -0,0 +1,33 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bger_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bger_f.c b/tests/bger_f.c
new file mode 100644
index 0000000..f068d77
--- /dev/null
+++ b/tests/bger_f.c
@@ -0,0 +1,33 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bger_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bgtr_d.c b/tests/bgtr_d.c
new file mode 100644
index 0000000..5bc6914
--- /dev/null
+++ b/tests/bgtr_d.c
@@ -0,0 +1,33 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bgtr_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bgtr_f.c b/tests/bgtr_f.c
new file mode 100644
index 0000000..da271b7
--- /dev/null
+++ b/tests/bgtr_f.c
@@ -0,0 +1,33 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bgtr_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 0);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 0);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bler_d.c b/tests/bler_d.c
new file mode 100644
index 0000000..9550043
--- /dev/null
+++ b/tests/bler_d.c
@@ -0,0 +1,33 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bler_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bler_f.c b/tests/bler_f.c
new file mode 100644
index 0000000..751f2bb
--- /dev/null
+++ b/tests/bler_f.c
@@ -0,0 +1,33 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bler_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 1);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bltr_d.c b/tests/bltr_d.c
new file mode 100644
index 0000000..fd7daf2
--- /dev/null
+++ b/tests/bltr_d.c
@@ -0,0 +1,33 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bltr_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bltr_f.c b/tests/bltr_f.c
new file mode 100644
index 0000000..20075e3
--- /dev/null
+++ b/tests/bltr_f.c
@@ -0,0 +1,33 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bltr_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 0);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 0);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bner_d.c b/tests/bner_d.c
new file mode 100644
index 0000000..a4d361b
--- /dev/null
+++ b/tests/bner_d.c
@@ -0,0 +1,33 @@
+#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_ABI_DOUBLE };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bner_d(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(double, double) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
diff --git a/tests/bner_f.c b/tests/bner_f.c
new file mode 100644
index 0000000..e2badd9
--- /dev/null
+++ b/tests/bner_f.c
@@ -0,0 +1,33 @@
+#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_ABI_FLOAT };
+ jit_arg_t args[2];
+ const jit_anyreg_t regs[] = { { .fpr=JIT_F0 }, { .fpr=JIT_F1 } };
+
+ jit_receive(j, 2, abi, args);
+ jit_load_args(j, 2, abi, args, regs);
+
+ jit_reloc_t r = jit_bner_f(j, JIT_F0, JIT_F1);
+ jit_reti(j, 0);
+ jit_patch_here(j, r);
+ jit_reti(j, 1);
+
+ intmax_t (*f)(float, float) = jit_end(j, NULL);
+
+ ASSERT(f(0, 0) == 0);
+ ASSERT(f(0, 1) == 1);
+ ASSERT(f(1, 0) == 1);
+ ASSERT(f(-1, 0) == 1);
+ ASSERT(f(0, -1) == 1);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
- [Guile-commits] 70/86: Add truncr_[df]_[li] tests, (continued)
- [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, 2019/04/03
- [Guile-commits] 60/86: Add floating-point reg/reg compare-and-branch tests,
Andy Wingo <=
- [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
- [Guile-commits] 29/86: Implementation of new design, Andy Wingo, 2019/04/03