diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-30 00:53:34 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-30 00:53:34 +0300 |
commit | 451797936119d8236843c4e9aee4a47dc5cddd56 (patch) | |
tree | 5aed431a0058bbe00627659cefc8fef85a4e18bb /tests/divr_f.c | |
parent | 864a078cf9faf9b85a7a9042b4033d46847aea8f (diff) | |
download | ejit-451797936119d8236843c4e9aee4a47dc5cddd56.tar.gz ejit-451797936119d8236843c4e9aee4a47dc5cddd56.zip |
continue working through test cases
+ Remove overflow and more complicated floating point tests for now
Diffstat (limited to 'tests/divr_f.c')
-rw-r--r-- | tests/divr_f.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/divr_f.c b/tests/divr_f.c index 085ecff..081c63d 100644 --- a/tests/divr_f.c +++ b/tests/divr_f.c @@ -1,27 +1,27 @@ -#include "test.h" +#include <ejit/ejit.h> +#include <assert.h> +#include "do_jit.h" -static void -run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size) +int main() { - 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_FLOAT, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_FLOAT, JIT_F1)); + struct ejit_operand operands[2] = { + EJIT_OPERAND_FPR(0, EJIT_TYPE(double)), + EJIT_OPERAND_FPR(1, EJIT_TYPE(double)) + }; + struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands); - jit_divr_f(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_f(j, JIT_F0); + ejit_divr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1)); + ejit_retr_f(f, EJIT_FPR(0)); - size_t size = 0; - void* ret = jit_end(j, &size); + ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit); - float (*f)(float, float) = ret; - ASSERT(f(-0.5f, 0.5f) == -1.0f); - ASSERT(f(1.25f, 0.5f) == 2.5f); -} + assert(ejit_run_func_2(f, + EJIT_ARG(-0.5f, double), + EJIT_ARG(0.5f, double)) == -1.0f); -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); + assert(ejit_run_func_2(f, + EJIT_ARG(1.25f, double), + EJIT_ARG(0.5f, double)) == 2.5f); + + ejit_destroy_func(f); } |