aboutsummaryrefslogtreecommitdiff
path: root/src/interp.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-04-01 22:16:25 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-04-01 22:16:25 +0300
commit478c92b425eca53a0d884fb8f5dea8d769016858 (patch)
treed5d85feb1b796530429221d51ab88c8c7f1a0b55 /src/interp.c
parent4135845b93d5c0eab23ad5da526b03a911878d67 (diff)
downloadejit-478c92b425eca53a0d884fb8f5dea8d769016858.tar.gz
ejit-478c92b425eca53a0d884fb8f5dea8d769016858.zip
expose sqrt
+ Requires linking with libm in some cases, which is fine I suppose, but kind of annoying
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c
index b858f26..2d9b7c7 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -147,6 +147,9 @@ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg pa
[EJIT_OP_TRUNCR_F_32] = &&TRUNCR_F_32,
[EJIT_OP_TRUNCR_F_64] = &&TRUNCR_F_64,
+ [EJIT_OP_SQRTR_F] = &&SQRTR_F,
+ [EJIT_OP_SQRTR_D] = &&SQRTR_D,
+
[EJIT_OP_BNER] = &&BNER,
[EJIT_OP_BNEI] = &&BNEI,
[EJIT_OP_BNER_F] = &&BNER_F,
@@ -784,6 +787,14 @@ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg pa
gpr[i.r0] = (int64_t)fpr[i.r1].f;
DISPATCH();
+ DO(SQRTR_F);
+ fpr[i.r0].f = sqrt(fpr[i.r1].f);
+ DISPATCH();
+
+ DO(SQRTR_D);
+ fpr[i.r0].d = sqrt(fpr[i.r1].d);
+ DISPATCH();
+
DO(BNER);
if (gpr[i.r1] != gpr[i.r2])
JUMP(i.r0);