diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-29 20:19:10 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-29 20:19:10 +0300 |
commit | 864a078cf9faf9b85a7a9042b4033d46847aea8f (patch) | |
tree | a5aea56a78a9c9671a19d16d5921e5a599ec435d | |
parent | 9fe8ccf4ae09018fdde01a9d83f9db10ad354221 (diff) | |
download | ejit-864a078cf9faf9b85a7a9042b4033d46847aea8f.tar.gz ejit-864a078cf9faf9b85a7a9042b4033d46847aea8f.zip |
remove some tests that won't get implemented
-rw-r--r-- | tests/bordr_d.c | 36 | ||||
-rw-r--r-- | tests/buneqr_d.c | 35 | ||||
-rw-r--r-- | tests/bunger_d.c | 34 | ||||
-rw-r--r-- | tests/bungtr_d.c | 34 | ||||
-rw-r--r-- | tests/bunler_d.c | 34 | ||||
-rw-r--r-- | tests/bunltr_d.c | 34 | ||||
-rw-r--r-- | tests/bunordr_d.c | 36 | ||||
-rw-r--r-- | tests/divr_d.c | 27 | ||||
-rw-r--r-- | tests/extr_d.c | 25 | ||||
-rw-r--r-- | tests/extr_f_d.c | 26 | ||||
-rw-r--r-- | tests/jmpi.c | 41 | ||||
-rw-r--r-- | tests/jmpr.c | 25 | ||||
-rw-r--r-- | tests/link-register.c | 35 | ||||
-rw-r--r-- | tests/movi_d.c | 22 | ||||
-rw-r--r-- | tests/mulr_d.c | 27 | ||||
-rw-r--r-- | tests/negr_d.c | 26 | ||||
-rw-r--r-- | tests/sqrtr_d.c | 25 | ||||
-rw-r--r-- | tests/subr_d.c | 27 |
18 files changed, 0 insertions, 549 deletions
diff --git a/tests/bordr_d.c b/tests/bordr_d.c deleted file mode 100644 index ca44db7..0000000 --- a/tests/bordr_d.c +++ /dev/null @@ -1,36 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bordr_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_t (*f)(double, double) = jit_end(j, NULL); - - ASSERT(f(0, 0) == 1); - ASSERT(f(0, 1) == 1); - ASSERT(f(1, 0) == 1); - ASSERT(f(-1, 0) == 1); - ASSERT(f(0, -1) == 1); - ASSERT(f(1, 1) == 1); - - ASSERT(f(0, 0.0/0.0) == 0); - ASSERT(f(0.0/0.0, 0) == 0); - ASSERT(f(0.0/0.0, 0.0/0.0) == 0); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/buneqr_d.c b/tests/buneqr_d.c deleted file mode 100644 index e0ed6e9..0000000 --- a/tests/buneqr_d.c +++ /dev/null @@ -1,35 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_buneqr_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_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); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/bunger_d.c b/tests/bunger_d.c deleted file mode 100644 index e65f136..0000000 --- a/tests/bunger_d.c +++ /dev/null @@ -1,34 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bunger_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_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); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/bungtr_d.c b/tests/bungtr_d.c deleted file mode 100644 index 0985696..0000000 --- a/tests/bungtr_d.c +++ /dev/null @@ -1,34 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bungtr_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_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); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/bunler_d.c b/tests/bunler_d.c deleted file mode 100644 index decd314..0000000 --- a/tests/bunler_d.c +++ /dev/null @@ -1,34 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bunler_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_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); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/bunltr_d.c b/tests/bunltr_d.c deleted file mode 100644 index 9ce8d63..0000000 --- a/tests/bunltr_d.c +++ /dev/null @@ -1,34 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bunltr_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_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); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/bunordr_d.c b/tests/bunordr_d.c deleted file mode 100644 index 13ed8a6..0000000 --- a/tests/bunordr_d.c +++ /dev/null @@ -1,36 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_reloc_t r = jit_bunordr_d(j, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 0); - jit_patch_here(j, r); - jit_leave_jit_abi(j, 0, 0, align); - jit_reti(j, 1); - - jit_word_t (*f)(double, double) = jit_end(j, NULL); - - ASSERT(f(0, 0) == 0); - ASSERT(f(0, 1) == 0); - ASSERT(f(1, 0) == 0); - ASSERT(f(-1, 0) == 0); - ASSERT(f(0, -1) == 0); - ASSERT(f(1, 1) == 0); - - ASSERT(f(0, 0.0/0.0) == 1); - ASSERT(f(0.0/0.0, 0) == 1); - ASSERT(f(0.0/0.0, 0.0/0.0) == 1); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/divr_d.c b/tests/divr_d.c deleted file mode 100644 index 41dd6c3..0000000 --- a/tests/divr_d.c +++ /dev/null @@ -1,27 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_divr_d(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - size_t size = 0; - void* ret = jit_end(j, &size); - - double (*f)(double, double) = ret; - ASSERT(f(-0.5f, 0.5f) == -1.0f); - ASSERT(f(1.25f, 0.5f) == 2.5f); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/extr_d.c b/tests/extr_d.c deleted file mode 100644 index ac8b2f9..0000000 --- a/tests/extr_d.c +++ /dev/null @@ -1,25 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_gpr (JIT_OPERAND_ABI_WORD, JIT_R0)); - - jit_extr_d(j, JIT_F0, JIT_R0); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - double (*f)(jit_word_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_d.c b/tests/extr_f_d.c deleted file mode 100644 index 8a9d38c..0000000 --- a/tests/extr_f_d.c +++ /dev/null @@ -1,26 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_fpr (JIT_OPERAND_ABI_FLOAT, JIT_F0)); - - jit_extr_f_d(j, JIT_F0, JIT_F0); - jit_leave_jit_abi(j, 0, 0, align); - 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); -} diff --git a/tests/jmpi.c b/tests/jmpi.c deleted file mode 100644 index cb12789..0000000 --- a/tests/jmpi.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "test.h" - -void *tail; - -static void *target; - -static void -run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size) -{ - jit_begin(j, arena_base, arena_size); - jit_enter_jit_abi(j, 0, 0, 0); - jit_movi(j, JIT_R0, 42); - jit_jmpi(j, target); - // Unreachable. - jit_breakpoint(j); - int (*f)(void) = jit_end(j, NULL); - ASSERT(f() == 42); -} - -// Make the tail-call target via a separate main_helper because probably the new -// arena will be allocated farther away, forcing nonlocal jumps. -static void -make_target(jit_state_t *j, uint8_t *arena_base, size_t arena_size) -{ - jit_begin(j, arena_base, arena_size); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - // Tail call target assumes tail caller called enter_jit_abi with compatible - // parameters. - target = jit_address(j); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr(j, JIT_R0); - jit_end(j, NULL); - - main_helper(0, NULL, run_test); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, make_target); -} diff --git a/tests/jmpr.c b/tests/jmpr.c deleted file mode 100644 index 45111f9..0000000 --- a/tests/jmpr.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "test.h" - -static int tail(void) { - return 42; -} - -static void -run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size) -{ - jit_begin(j, arena_base, arena_size); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_gpr (JIT_OPERAND_ABI_POINTER, JIT_R0)); - jit_leave_jit_abi(j, 0, 0, align); - - jit_jmpr(j, JIT_R0); - - int (*f)(void*) = jit_end(j, NULL); - ASSERT(f(tail) == 42); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/link-register.c b/tests/link-register.c deleted file mode 100644 index 9e5413b..0000000 --- a/tests/link-register.c +++ /dev/null @@ -1,35 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_gpr (JIT_OPERAND_ABI_POINTER, JIT_R0)); - - jit_reloc_t call_tramp = jit_jmp (j); - - void *tramp = jit_address (j); - jit_pop_link_register (j); - jit_movr (j, JIT_R0, JIT_LR); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr (j, JIT_R0); - - jit_patch_here (j, call_tramp); - jit_jmpi_with_link (j, tramp); - - void *expected_link = jit_address_to_function_pointer (jit_address (j)); - - size_t size = 0; - void* ret = jit_end(j, &size); - - void* (*f)(void) = ret; - - ASSERT(f() == expected_link); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/movi_d.c b/tests/movi_d.c deleted file mode 100644 index 650064b..0000000 --- a/tests/movi_d.c +++ /dev/null @@ -1,22 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - - jit_movi_d(j, JIT_F0, 3.14159); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - double (*f)(void) = jit_end(j, NULL); - - ASSERT(f() == 3.14159); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/mulr_d.c b/tests/mulr_d.c deleted file mode 100644 index 5464170..0000000 --- a/tests/mulr_d.c +++ /dev/null @@ -1,27 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_mulr_d(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - size_t size = 0; - void* ret = jit_end(j, &size); - - double (*f)(double, double) = ret; - ASSERT(f(-0.5, 0.5) == -0.25); - ASSERT(f(0.25, 0.75) == 0.1875); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/negr_d.c b/tests/negr_d.c deleted file mode 100644 index b8d4a00..0000000 --- a/tests/negr_d.c +++ /dev/null @@ -1,26 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0)); - - jit_negr_d(j, JIT_F0, JIT_F0); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - double (*f)(double) = jit_end(j, NULL); - - ASSERT(f(0.0) == -0.0); - ASSERT(f(0.5) == -0.5); - ASSERT(f(1.0 / 0.0) == -1.0 / 0.0); - ASSERT(f(-1.25) == 1.25); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/sqrtr_d.c b/tests/sqrtr_d.c deleted file mode 100644 index f07b94f..0000000 --- a/tests/sqrtr_d.c +++ /dev/null @@ -1,25 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_1(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0)); - - jit_sqrtr_d(j, JIT_F0, JIT_F0); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - double (*f)(double) = jit_end(j, NULL); - - ASSERT(f(0.0) == 0.0); - ASSERT(f(4.0) == 2.0); - ASSERT(f(-4.0) != f(-4.0)); // nan -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} diff --git a/tests/subr_d.c b/tests/subr_d.c deleted file mode 100644 index 65b5ecd..0000000 --- a/tests/subr_d.c +++ /dev/null @@ -1,27 +0,0 @@ -#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); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - jit_load_args_2(j, jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); - - jit_subr_d(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); - - size_t size = 0; - void* ret = jit_end(j, &size); - - double (*f)(double, double) = ret; - ASSERT(f(42., 69.) == -27.); - ASSERT(f(42., 69.5) == -27.5); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); -} |