From 26c1c30b7d96d2170195970a8cdb3b024ba7421a Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sat, 10 Dec 2022 23:16:21 +0100 Subject: new blit instruction --- arm64/abi.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'arm64') diff --git a/arm64/abi.c b/arm64/abi.c index 7282031..8ba4ffc 100644 --- a/arm64/abi.c +++ b/arm64/abi.c @@ -188,7 +188,8 @@ selret(Blk *b, Fn *fn) typclass(&cr, &typ[fn->retty], gpreg, fpreg); if (cr.class & Cptr) { assert(rtype(fn->retr) == RTmp); - blit0(fn->retr, r, cr.t->size, fn); + emit(Oblit1, 0, R, INT(cr.t->size), R); + emit(Oblit0, 0, R, r, fn->retr); cty = 0; } else { ldregs(cr.reg, cr.cls, cr.nreg, r, fn); @@ -438,8 +439,8 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp) if ((c->class & Cstk) == 0) continue; off = align(off, c->align); + r = newtmp("abi", Kl, fn); if (i->op == Oarg || isargbh(i->op)) { - r = newtmp("abi", Kl, fn); switch (c->size) { case 1: op = Ostoreb; break; case 2: op = Ostoreh; break; @@ -447,18 +448,22 @@ selcall(Fn *fn, Ins *i0, Ins *i1, Insl **ilp) case 8: op = store[*c->cls]; break; } emit(op, 0, R, i->arg[0], r); - emit(Oadd, Kl, r, TMP(SP), getcon(off, fn)); + } else { + assert(i->op == Oargc); + emit(Oblit1, 0, R, INT(c->size), R); + emit(Oblit0, 0, R, i->arg[1], r); } - if (i->op == Oargc) - blit(TMP(SP), off, i->arg[1], 0, c->size, fn); + emit(Oadd, Kl, r, TMP(SP), getcon(off, fn)); off += c->size; } if (stk) emit(Osub, Kl, TMP(SP), TMP(SP), rstk); for (i=i0, c=ca; iclass & Cptr) - blit0(i->arg[0], i->arg[1], c->t->size, fn); + if (c->class & Cptr) { + emit(Oblit1, 0, R, INT(c->t->size), R); + emit(Oblit0, 0, R, i->arg[1], i->arg[0]); + } } static Params -- cgit 1.4.1