diff options
Diffstat (limited to 'tests/addr_f.c')
-rw-r--r-- | tests/addr_f.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/tests/addr_f.c b/tests/addr_f.c index 2aa9002..6562134 100644 --- a/tests/addr_f.c +++ b/tests/addr_f.c @@ -1,27 +1,24 @@ -#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_DOUBLE, JIT_F0), - jit_operand_fpr (JIT_OPERAND_ABI_DOUBLE, JIT_F1)); + struct ejit_operand operands[2] = { + EJIT_OPERAND_FPR(0, EJIT_TYPE(double)), + EJIT_OPERAND_FPR(1, EJIT_TYPE(double)) + }; - jit_addr_d(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_d(j, JIT_F0); + struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands); - size_t size = 0; - void* ret = jit_end(j, &size); + ejit_addr_f(f, EJIT_FPR(0), EJIT_FPR(0), EJIT_FPR(1)); + ejit_retr_f(f, EJIT_FPR(0)); - double (*f)(double, double) = ret; - ASSERT(f(42., 69.) == 111.); - ASSERT(f(42.5, 69.5) == 112.); -} + ejit_select_compile_func(f, 0, 2, EJIT_USE64(double), do_jit); -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); + assert(ejit_run_func_f_2(f, EJIT_ARG(42., double), + EJIT_ARG(69., double)) == 111.); + assert(ejit_run_func_f_2(f, EJIT_ARG(42.5, double), + EJIT_ARG(69.5, double)) == 112.); + ejit_destroy_func(f); } |