aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--include/ejit/ejit.h2
-rw-r--r--src/compile/compile.c508
-rw-r--r--src/interp.c5
-rw-r--r--tests/makefile10
5 files changed, 520 insertions, 10 deletions
diff --git a/TODO b/TODO
index e7bfab0..b4cf973 100644
--- a/TODO
+++ b/TODO
@@ -3,3 +3,8 @@ systems
+ (MAYBE) Check that there aren't duplicate destinations in operand list?
+ Darn, the return type doesn't really work with 32bit systems, should fix that
somehow
++ Internally we currently expect all values to be doubles, but apparently
+lightening doesn't automatically convert between the types when moving
+parameters. Either we add in float operations and make sure the user knows which
+type is being used when, or we add some filter that rewrites the floats to
+doubles?
diff --git a/include/ejit/ejit.h b/include/ejit/ejit.h
index ce7260b..6e42f15 100644
--- a/include/ejit/ejit.h
+++ b/include/ejit/ejit.h
@@ -254,7 +254,7 @@ static inline struct ejit_arg ejit_pointer(void *p)
static inline struct ejit_arg ejit_float(float a)
{
- return (struct ejit_arg){.d = a, .type = EJIT_FLOAT};
+ return (struct ejit_arg){.f = a, .type = EJIT_FLOAT};
}
static inline struct ejit_arg ejit_double(double a)
diff --git a/src/compile/compile.c b/src/compile/compile.c
index aa16339..e8e32b7 100644
--- a/src/compile/compile.c
+++ b/src/compile/compile.c
@@ -176,6 +176,16 @@ static void compile_andi(struct ejit_func *f, jit_state_t *j,
putloc(f, j, i.r0, r0);
}
+static void compile_andr(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_andr(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
static void compile_absr_f(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
@@ -195,6 +205,30 @@ static void compile_addr_f(struct ejit_func *f, jit_state_t *j,
putloc_f(f, j, i.r0, r0);
}
+static void compile_stxi8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_stxi_c(j, i.o, r1, r0);
+}
+
+static void compile_stxi16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_stxi_s(j, i.o, r1, r0);
+}
+
+static void compile_stxi32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_stxi_i(j, i.o, r1, r0);
+}
+
static void compile_stxi64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
@@ -203,6 +237,105 @@ static void compile_stxi64(struct ejit_func *f, jit_state_t *j,
jit_stxi_l(j, i.o, r1, r0);
}
+static void compile_stxif(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_fpr_t r0 = getloc_f(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_extr_d_f(j, r0, r0);
+ jit_stxi_f(j, i.o, r1, r0);
+}
+
+static void compile_stxid(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_fpr_t r0 = getloc_f(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_stxi_d(j, i.o, r1, r0);
+}
+
+static void compile_stxr8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_stxr_c(j, r2, r1, r0);
+}
+
+static void compile_stxr16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_stxr_s(j, r2, r1, r0);
+}
+
+static void compile_stxr32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_stxr_i(j, r2, r1, r0);
+}
+
+static void compile_stxr64(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getloc(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_stxr_l(j, r2, r1, r0);
+}
+
+static void compile_stxrf(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_fpr_t r0 = getloc_f(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_extr_d_f(j, r0, r0);
+ jit_stxr_f(j, r2, r1, r0);
+}
+
+static void compile_stxrd(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_fpr_t r0 = getloc_f(f, j, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_stxr_d(j, r2, r1, r0);
+}
+
+static void compile_ldxiu8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_uc(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxiu16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_us(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxiu32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_ui(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
static void compile_ldxiu64(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i)
{
@@ -212,6 +345,122 @@ static void compile_ldxiu64(struct ejit_func *f, jit_state_t *j,
putloc(f, j, i.r0, r0);
}
+static void compile_ldxi8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_c(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxi16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_s(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxi32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_i(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxi64(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_ldxi_l(j, r0, r1, i.o);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxru8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_uc(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxru16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_us(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxru32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_ui(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxru64(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_l(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxr8(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_c(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxr16(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_s(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxr32(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_i(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
+static void compile_ldxr64(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i)
+{
+ jit_gpr_t r0 = getgpr(f, i.r0, 0);
+ jit_gpr_t r1 = getloc(f, j, i.r1, 1);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 2);
+ jit_ldxr_l(j, r0, r1, r2);
+ putloc(f, j, i.r0, r0);
+}
+
static void compile_reg_cmp(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i,
jit_reloc_t (*bcomp)(jit_state_t *, jit_gpr_t,
@@ -246,6 +495,44 @@ static void compile_eqr(struct ejit_func *f, jit_state_t *j, struct ejit_insn i)
compile_reg_cmp(f, j, i, jit_beqr, 1);
}
+static void compile_bmci(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_bmci(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bmcr(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bmcr(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bmsi(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_bmsi(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bmsr(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bmsr(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
static void compile_beqi(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i, struct vec *relocs)
{
@@ -255,6 +542,26 @@ static void compile_beqi(struct ejit_func *f, jit_state_t *j,
vect_append(struct reloc_helper, *relocs, &h);
}
+static void compile_beqr(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_beqr(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_beqr_f(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_fpr_t r1 = getloc_f(f, j, i.r1, 0);
+ jit_fpr_t r2 = getloc_f(f, j, i.r2, 1);
+ jit_reloc_t r = jit_beqr_d(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
static void compile_bnei(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i, struct vec *relocs)
{
@@ -264,6 +571,94 @@ static void compile_bnei(struct ejit_func *f, jit_state_t *j,
vect_append(struct reloc_helper, *relocs, &h);
}
+static void compile_bner(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bner(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bner_f(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_fpr_t r1 = getloc_f(f, j, i.r1, 0);
+ jit_fpr_t r2 = getloc_f(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bner_d(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bger(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bger(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bger_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bger_u(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bgei(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_bgei(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bgei_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_bgei_u(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bger_f(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_fpr_t r1 = getloc_f(f, j, i.r1, 0);
+ jit_fpr_t r2 = getloc_f(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bger_d(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bgtr(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bgtr(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bgtr_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_gpr_t r2 = getloc(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bgtr_u(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
static void compile_bgti(struct ejit_func *f, jit_state_t *j,
struct ejit_insn i, struct vec *relocs)
{
@@ -273,6 +668,61 @@ static void compile_bgti(struct ejit_func *f, jit_state_t *j,
vect_append(struct reloc_helper, *relocs, &h);
}
+static void compile_bgti_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_bgti_u(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_bgtr_f(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_fpr_t r1 = getloc_f(f, j, i.r1, 0);
+ jit_fpr_t r2 = getloc_f(f, j, i.r2, 1);
+ jit_reloc_t r = jit_bgtr_d(j, r1, r2);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_blei(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_blei(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_blei_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_blei_u(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_blti(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_blti(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
+static void compile_blti_u(struct ejit_func *f, jit_state_t *j,
+ struct ejit_insn i, struct vec *relocs)
+{
+ jit_gpr_t r1 = getloc(f, j, i.r1, 0);
+ jit_reloc_t r = jit_blti_u(j, r1, i.o);
+ struct reloc_helper h = {.r = r, .to = i.r0};
+ vect_append(struct reloc_helper, *relocs, &h);
+}
+
static void compile_jmp(struct ejit_func *f, jit_state_t *j, struct ejit_insn i,
struct vec *relocs)
{
@@ -414,18 +864,76 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena,
case SUBR: compile_subr(f, j, i); break;
case SUBI: compile_subi(f, j, i); break;
case ANDI: compile_andi(f, j, i); break;
+ case ANDR: compile_andr(f, j, i); break;
case ADDR_F: compile_addr_f(f, j, i); break;
case ABSR_F: compile_absr_f(f, j, i); break;
+ case STXI8: compile_stxi8(f, j, i); break;
+ case STXI16: compile_stxi16(f, j, i); break;
+ case STXI32: compile_stxi32(f, j, i); break;
case STXI64: compile_stxi64(f, j, i); break;
+ case STXIF: compile_stxif(f, j, i); break;
+ case STXID: compile_stxid(f, j, i); break;
+
+ case STXR8: compile_stxr8(f, j, i); break;
+ case STXR16: compile_stxr16(f, j, i); break;
+ case STXR32: compile_stxr32(f, j, i); break;
+ case STXR64: compile_stxr64(f, j, i); break;
+ case STXRF: compile_stxrf(f, j, i); break;
+ case STXRD: compile_stxrd(f, j, i); break;
+
+ case LDXI8: compile_ldxi8(f, j, i); break;
+ case LDXI16: compile_ldxi16(f, j, i); break;
+ case LDXI32: compile_ldxi32(f, j, i); break;
+ case LDXI64: compile_ldxi64(f, j, i); break;
+ case LDXIU8: compile_ldxiu8(f, j, i); break;
+ case LDXIU16: compile_ldxiu16(f, j, i); break;
+ case LDXIU32: compile_ldxiu32(f, j, i); break;
case LDXIU64: compile_ldxiu64(f, j, i); break;
+ case LDXR8: compile_ldxr8(f, j, i); break;
+ case LDXR16: compile_ldxr16(f, j, i); break;
+ case LDXR32: compile_ldxr32(f, j, i); break;
+ case LDXR64: compile_ldxr64(f, j, i); break;
+ case LDXRU8: compile_ldxru8(f, j, i); break;
+ case LDXRU16: compile_ldxru16(f, j, i); break;
+ case LDXRU32: compile_ldxru32(f, j, i); break;
+ case LDXRU64: compile_ldxru64(f, j, i); break;
+
case EQR: compile_eqr(f, j, i); break;
+ case BMCI: compile_bmci(f, j, i, &relocs); break;
+ case BMCR: compile_bmcr(f, j, i, &relocs); break;
+
+ case BMSI: compile_bmsi(f, j, i, &relocs); break;
+ case BMSR: compile_bmsr(f, j, i, &relocs); break;
+
+ case BEQR: compile_beqr(f, j, i, &relocs); break;
case BEQI: compile_beqi(f, j, i, &relocs); break;
+ case BEQR_F: compile_beqr_f(f, j, i, &relocs); break;
+ case BNER: compile_bner(f, j, i, &relocs); break;
case BNEI: compile_bnei(f, j, i, &relocs); break;
+ case BNER_F: compile_bner_f(f, j, i, &relocs); break;
+
+ case BGER: compile_bger(f, j, i, &relocs); break;
+ case BGER_U: compile_bger_u(f, j, i, &relocs); break;
+ case BGEI: compile_bgei(f, j, i, &relocs); break;
+ case BGEI_U: compile_bgei_u(f, j, i, &relocs); break;
+ case BGER_F: compile_bger_f(f, j, i, &relocs); break;
+
+ case BGTR: compile_bgtr(f, j, i, &relocs); break;
+ case BGTR_U: compile_bgtr_u(f, j, i, &relocs); break;
case BGTI: compile_bgti(f, j, i, &relocs); break;
+ case BGTI_U: compile_bgti_u(f, j, i, &relocs); break;
+ case BGTR_F: compile_bgtr_f(f, j, i, &relocs); break;
+
+ case BLEI: compile_blei(f, j, i, &relocs); break;
+ case BLEI_U: compile_blei_u(f, j, i, &relocs); break;
+
+ case BLTI: compile_blti(f, j, i, &relocs); break;
+ case BLTI_U: compile_blti_u(f, j, i, &relocs); break;
+
case JMP: compile_jmp(f, j, i, &relocs); break;
case ARG: {
diff --git a/src/interp.c b/src/interp.c
index a86b754..8462112 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -850,7 +850,10 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc,
DISPATCH();
DO(PARAM_F);
- fpr[i.r2] = args[i.r0].d;
+ if (i.r1 == EJIT_FLOAT)
+ fpr[i.r2] = args[i.r0].f;
+ else
+ fpr[i.r2] = args[i.r0].d;
DISPATCH();
DO(ARG);
diff --git a/tests/makefile b/tests/makefile
index 4a0afc9..5aeef98 100644
--- a/tests/makefile
+++ b/tests/makefile
@@ -11,21 +11,15 @@ INCLUDE_FLAGS := -I include
COMPILE_TEST := $(COMPILER) $(CFLAGS) $(INCLUDE_FLAGS)
.PHONY: check
-check: $(TESTS) check-bcode check-jit
- echo "Success!"
-
-.PHONY: check-bcode
-check-bcode: $(TESTS)
+check: $(TESTS)
@echo "Running bytecode tests..."
@set -e; for test in $(TESTS); do \
echo "Testing: $$test"; \
./$$test; \
done
-
-.PHONY: check-jit
-check-jit: $(TESTS)
@echo "Running jit tests..."
@set -e; for test in $(TESTS); do \
echo "Testing: $$test"; \
./$$test 1; \
done
+ @echo "Success!"