diff options
Diffstat (limited to 'src/interp.c')
-rw-r--r-- | src/interp.c | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c index 383599e..30a7672 100644 --- a/src/interp.c +++ b/src/interp.c @@ -13,6 +13,13 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, [MOVR] = &&MOVR, [MOVR_F] = &&MOVR_F, + [EXTR8] = &&EXTR8, + [EXTR16] = &&EXTR16, + [EXTR32] = &&EXTR32, + [EXTRU8] = &&EXTRU8, + [EXTRU16] = &&EXTRU16, + [EXTRU32] = &&EXTRU32, + [ADDR] = &&ADDR, [ADDR_F] = &&ADDR_F, [ADDI] = &&ADDI, @@ -29,6 +36,11 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, [DIVR_U] = &&DIVR_U, [DIVR_F] = &&DIVR_F, + [LSHI] = &&LSHI, + [LSHR] = &&LSHR, + [RSHI] = &&RSHI, + [RSHR] = &&RSHR, + [ANDR] = &&ANDR, [ANDI] = &&ANDI, @@ -56,6 +68,17 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, [STXIF] = &&STXIF, [STXID] = &&STXID, + [LDI8] = &&LDI8, + [LDI16] = &&LDI16, + [LDI32] = &&LDI32, + [LDI64] = &&LDI64, + [LDIU8] = &&LDIU8, + [LDIU16] = &&LDIU16, + [LDIU32] = &&LDIU32, + [LDIU64] = &&LDIU64, + [LDIF] = &&LDIF, + [LDID] = &&LDID, + [LDXI8] = &&LDXI8, [LDXI16] = &&LDXI16, [LDXI32] = &&LDXI32, @@ -67,6 +90,17 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, [LDXIF] = &&LDXIF, [LDXID] = &&LDXID, + [LDXR8] = &&LDXR8, + [LDXR16] = &&LDXR16, + [LDXR32] = &&LDXR32, + [LDXR64] = &&LDXR64, + [LDXRU8] = &&LDXRU8, + [LDXRU16] = &&LDXRU16, + [LDXRU32] = &&LDXRU32, + [LDXRU64] = &&LDXRU64, + [LDXRF] = &&LDXRF, + [LDXRD] = &&LDXRD, + [BNER] = &&BNER, [BNEI] = &&BNEI, [BNER_F] = &&BNER_F, @@ -96,6 +130,7 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, [BLTGTR_F] = &&BLTGTR_F, [JMP] = &&JMP, + [JMPR] = &&JMPR, [BMCI] = &&BMCI, [BMCR] = &&BMCR, @@ -175,6 +210,30 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, fpr[i.r0] = fpr[i.r1]; DISPATCH(); + DO(EXTR8); + gpr[i.r0] = (int8_t)gpr[i.r1]; + DISPATCH(); + + DO(EXTR16); + gpr[i.r0] = (int16_t)gpr[i.r1]; + DISPATCH(); + + DO(EXTR32); + gpr[i.r0] = (int32_t)gpr[i.r1]; + DISPATCH(); + + DO(EXTRU8); + gpr[i.r0] = (uint8_t)gpr[i.r1]; + DISPATCH(); + + DO(EXTRU16); + gpr[i.r0] = (uint16_t)gpr[i.r1]; + DISPATCH(); + + DO(EXTRU32); + gpr[i.r0] = (uint32_t)gpr[i.r1]; + DISPATCH(); + DO(ADDR); gpr[i.r0] = gpr[i.r1] + gpr[i.r2]; DISPATCH(); @@ -219,6 +278,22 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, fpr[i.r0] = fpr[i.r1] / fpr[i.r2]; DISPATCH(); + DO(LSHI); + gpr[i.r0] = gpr[i.r1] << i.o; + DISPATCH(); + + DO(LSHR); + gpr[i.r0] = gpr[i.r1] << gpr[i.r2]; + DISPATCH(); + + DO(RSHI); + gpr[i.r0] = gpr[i.r1] >> i.o; + DISPATCH(); + + DO(RSHR); + gpr[i.r0] = gpr[i.r1] >> gpr[i.r2]; + DISPATCH(); + DO(ANDR); gpr[i.r0] = gpr[i.r1] & gpr[i.r2]; DISPATCH(); @@ -305,6 +380,56 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, *addr = fpr[i.r0]; DISPATCH(); + DO(LDI8); + int8_t *addr = (int8_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDI16); + int16_t *addr = (int16_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDI32); + int32_t *addr = (int32_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDI64); + int64_t *addr = (int64_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDIU8); + uint8_t *addr = (uint8_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDIU16); + uint16_t *addr = (uint16_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDIU32); + uint32_t *addr = (uint32_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDIU64); + uint64_t *addr = (uint64_t *)i.p; + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDIF); + float *addr = (float *)i.p; + fpr[i.r0] = *addr; + DISPATCH(); + + DO(LDID); + double *addr = (double *)i.p; + fpr[i.r0] = *addr; + DISPATCH(); + DO(LDXI8); int8_t *addr = (int8_t *)(gpr[i.r1] + i.o); gpr[i.r0] = *addr; @@ -355,6 +480,56 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, fpr[i.r0] = *addr; DISPATCH(); + DO(LDXR8); + int8_t *addr = (int8_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXR16); + int16_t *addr = (int16_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXR32); + int32_t *addr = (int32_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXR64); + int64_t *addr = (int64_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRU8); + uint8_t *addr = (uint8_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRU16); + uint16_t *addr = (uint16_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRU32); + uint32_t *addr = (uint32_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRU64); + uint64_t *addr = (uint64_t *)(gpr[i.r1] + gpr[i.r2]); + gpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRF); + float *addr = (float *)(gpr[i.r1] + gpr[i.r2]); + fpr[i.r0] = *addr; + DISPATCH(); + + DO(LDXRD); + double *addr = (double *)(gpr[i.r1] + gpr[i.r2]); + fpr[i.r0] = *addr; + DISPATCH(); + DO(BNER); if (gpr[i.r1] != gpr[i.r2]) JUMP(i.r0); @@ -491,6 +666,10 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, JUMP(i.r0); DISPATCH(); + DO(JMPR); + JUMP(gpr[i.r1]); + DISPATCH(); + DO(BMSR); if (gpr[i.r1] & gpr[i.r2]) JUMP(i.r0); |