diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-29 20:11:34 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-29 20:11:34 +0300 |
commit | 9fe8ccf4ae09018fdde01a9d83f9db10ad354221 (patch) | |
tree | 664f802240a2810b5db3e783400351f1eb51c1a0 /tests/ler.c | |
parent | 322c7fba3d2f4c9b5b0d78b44feefd38ae44d017 (diff) | |
download | ejit-9fe8ccf4ae09018fdde01a9d83f9db10ad354221.tar.gz ejit-9fe8ccf4ae09018fdde01a9d83f9db10ad354221.zip |
work through branching instructions
Diffstat (limited to 'tests/ler.c')
-rw-r--r-- | tests/ler.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ler.c b/tests/ler.c new file mode 100644 index 0000000..0bd6e26 --- /dev/null +++ b/tests/ler.c @@ -0,0 +1,30 @@ +#include <ejit/ejit.h> +#include <assert.h> +#include "do_jit.h" + +int main() +{ + struct ejit_operand operands[2] = { + EJIT_OPERAND_GPR(0, EJIT_TYPE(long)) + EJIT_OPERAND_GPR(1, EJIT_TYPE(long)) + }; + + struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 2, operands); + + ejit_ler(f, EJIT_GPR(0), EJIT_GPR(0), EJIT_GPR(1)); + ejit_retr(f, EJIT_GPR(0)); + + ejit_select_compile_func(f, 2, 0, EJIT_USE64(long), do_jit); + + assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(1, long)) == 1); + assert(ejit_run_func_2(f, EJIT_ARG(1, long), EJIT_ARG(0, long)) == 1); + + assert(ejit_run_func_2(f, + EJIT_ARG(0x0fffffffffffffff, long), + EJIT_ARG(0x0ffffffffffffff0, long)) == 1); + + assert(ejit_run_func_2(f, + EJIT_ARG(0x7fffffffffffffff, long), + EJIT_ARG(0x6fffffffffffffff, long)) == 0); + ejit_destroy_func(f); +} |