aboutsummaryrefslogtreecommitdiff
path: root/examples/matrix_mult.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-13 19:20:56 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-13 19:25:59 +0200
commit57f6b41047e95374701ee276248f0f8615168450 (patch)
tree919a47249b2442dab31ae236f1f9f858651e5357 /examples/matrix_mult.c
parentba9145b0b7af2a82c62f8dfa28807958af5d0c8d (diff)
downloadejit-57f6b41047e95374701ee276248f0f8615168450.tar.gz
ejit-57f6b41047e95374701ee276248f0f8615168450.zip
improve register allocation
+ Still linear, but orders regs by some kind of priority + Use all registers available, not just callee-save
Diffstat (limited to 'examples/matrix_mult.c')
-rw-r--r--examples/matrix_mult.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/matrix_mult.c b/examples/matrix_mult.c
index 04ebb9d..fab2319 100644
--- a/examples/matrix_mult.c
+++ b/examples/matrix_mult.c
@@ -63,7 +63,7 @@ static struct ejit_func *compile()
struct ejit_reloc inner = ejit_bgei(f, KR, X);
/* A[i][k] at addr 4 * (i * 400 + k) */
- ejit_movi(f, TMP, 400);
+ ejit_movi(f, TMP, X);
ejit_mulr(f, AX, IR, TMP);
ejit_addr(f, AX, AX, KR);
ejit_movi(f, TMP, 4);
@@ -71,7 +71,7 @@ static struct ejit_func *compile()
EJIT_LDXR(f, int, AX, AR, AX);
/* B[k][j] at addr 4 * (k * 400 + j) */
- ejit_movi(f, TMP, 400);
+ ejit_movi(f, TMP, X);
ejit_mulr(f, BX, KR, TMP);
ejit_addr(f, BX, BX, JR);
ejit_movi(f, TMP, 4);
@@ -79,7 +79,7 @@ static struct ejit_func *compile()
EJIT_LDXR(f, int, BX, BR, BX);
/* C[i][j] at addr 4 * (i * 400 + j) */
- ejit_movi(f, TMP, 400);
+ ejit_movi(f, TMP, X);
ejit_mulr(f, CX, IR, TMP);
ejit_addr(f, CX, CX, JR);
ejit_movi(f, TMP, 4);