aboutsummaryrefslogtreecommitdiff
path: root/tests/ldxr_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ldxr_d.c')
-rw-r--r--tests/ldxr_d.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/tests/ldxr_d.c b/tests/ldxr_d.c
index e8bb45e..3a9edc0 100644
--- a/tests/ldxr_d.c
+++ b/tests/ldxr_d.c
@@ -1,28 +1,31 @@
-#include "test.h"
+#include <ejit/ejit.h>
+#include <assert.h>
+#include "do_jit.h"
static double data[] = { -1.0, 0.0, 0.5 };
-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_gpr (JIT_OPERAND_ABI_POINTER, JIT_R0),
- jit_operand_gpr (JIT_OPERAND_ABI_WORD, JIT_R1));
+ struct ejit_operand operands[2] = {
+ EJIT_OPERAND_GPR(0, EJIT_POINTER),
+ EJIT_OPERAND_GPR(1, EJIT_TYPE(unsigned))
+ };
+ struct ejit_func *f = ejit_create_func(EJIT_TYPE(double), 2, operands);
- jit_ldxr_d(j, JIT_F0, JIT_R0, JIT_R1);
- jit_leave_jit_abi(j, 0, 0, align);
- jit_retr_d(j, JIT_F0);
+ ejit_ldxr_d(f, EJIT_FPR(0), EJIT_GPR(0), EJIT_GPR(1));
+ ejit_retr_f(f, EJIT_FPR(0));
- double (*f)(void*, jit_uword_t) = jit_end(j, NULL);
+ ejit_select_compile_func(f, 2, 1, false, do_jit);
- ASSERT(f(data, 0) == data[0]);
- ASSERT(f(data, 8) == data[1]);
- ASSERT(f(data, 16) == data[2]);
-}
+ assert(erff2(f,
+ EJIT_ARG(data, void *),
+ EJIT_ARG(0 * sizeof(double), unsigned)) == data[0]);
-int
-main (int argc, char *argv[])
-{
- return main_helper(argc, argv, run_test);
+ assert(erff2(f,
+ EJIT_ARG(data, void *),
+ EJIT_ARG(1 * sizeof(double), unsigned)) == data[1]);
+
+ assert(erff2(f,
+ EJIT_ARG(data, void *),
+ EJIT_ARG(2 * sizeof(double), unsigned)) == data[2]);
}