summary refs log tree commit diff
path: root/amd64
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-12-10 23:16:21 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-12-14 23:18:26 +0100
commit26c1c30b7d96d2170195970a8cdb3b024ba7421a (patch)
tree79c45ec28d63619fbe2a88ec2195f8fe4a95a8a5 /amd64
parent15e25a61b38b250c7543437a093a9efe076cce0a (diff)
downloadroux-26c1c30b7d96d2170195970a8cdb3b024ba7421a.tar.gz
new blit instruction
Diffstat (limited to 'amd64')
-rw-r--r--amd64/sysv.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/amd64/sysv.c b/amd64/sysv.c
index f4e0416..04dfd83 100644
--- a/amd64/sysv.c
+++ b/amd64/sysv.c
@@ -127,7 +127,8 @@ selret(Blk *b, Fn *fn)
 		if (aret.inmem) {
 			assert(rtype(fn->retr) == RTmp);
 			emit(Ocopy, Kl, TMP(RAX), fn->retr, R);
-			blit0(fn->retr, r0, aret.type->size, fn);
+			emit(Oblit1, 0, R, INT(aret.type->size), R);
+			emit(Oblit0, 0, R, r0, fn->retr);
 			ca = 1;
 		} else {
 			ca = retr(reg, &aret);
@@ -410,15 +411,15 @@ selcall(Fn *fn, Ins *i0, Ins *i1, RAlloc **rap)
 	for (i=i0, a=ac, off=0; i<i1; i++, a++) {
 		if (i->op >= Oarge || !a->inmem)
 			continue;
+		r1 = newtmp("abi", Kl, fn);
 		if (i->op == Oargc) {
 			if (a->align == 4)
 				off += off & 15;
-			blit(r, off, i->arg[1], 0, a->type->size, fn);
-		} else {
-			r1 = newtmp("abi", Kl, fn);
+			emit(Oblit1, 0, R, INT(a->type->size), R);
+			emit(Oblit0, 0, R, i->arg[1], r1);
+		} else
 			emit(Ostorel, 0, R, i->arg[0], r1);
-			emit(Oadd, Kl, r1, r, getcon(off, fn));
-		}
+		emit(Oadd, Kl, r1, r, getcon(off, fn));
 		off += a->size;
 	}
 	emit(Osalloc, Kl, r, getcon(stk, fn), R);