diff options
Diffstat (limited to 'tests/mulr_f.c')
-rw-r--r-- | tests/mulr_f.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/tests/mulr_f.c b/tests/mulr_f.c index 5e5f46a..44d6030 100644 --- a/tests/mulr_f.c +++ b/tests/mulr_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_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_mulr_f(j, JIT_F0, JIT_F0, JIT_F1); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr_f(j, JIT_F0); + ejit_mulr_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) == -0.25f); - ASSERT(f(0.25f, 0.75f) == 0.1875f); -} + assert(erff2(f, EJIT_ARG(-0.5f, double), + EJIT_ARG(0.50f, double)) == -0.25f); + assert(erff2(f, EJIT_ARG(0.25f, double), + EJIT_ARG(0.75f, double)) == 0.1875f); -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, run_test); + ejit_destroy_func(f); } |