summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--arm64/abi.c6
-rw-r--r--rv64/abi.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/arm64/abi.c b/arm64/abi.c
index 396c704..b2b5973 100644
--- a/arm64/abi.c
+++ b/arm64/abi.c
@@ -183,12 +183,14 @@ selret(Blk *b, Fn *fn)
 
 	if (j == Jretc) {
 		typclass(&cr, &typ[fn->retty], gpreg, fpreg);
-		cty = (cr.nfp << 2) | cr.ngp;
 		if (cr.class & Cptr) {
 			assert(rtype(fn->retr) == RTmp);
 			blit0(fn->retr, r, cr.t->size, fn);
-		} else
+			cty = 0;
+		} else {
 			ldregs(cr.reg, cr.cls, cr.nreg, r, fn);
+			cty = (cr.nfp << 2) | cr.ngp;
+		}
 	} else {
 		k = j - Jretw;
 		if (KBASE(k) == 0) {
diff --git a/rv64/abi.c b/rv64/abi.c
index 0baaa67..3a97a6a 100644
--- a/rv64/abi.c
+++ b/rv64/abi.c
@@ -220,12 +220,13 @@ selret(Blk *b, Fn *fn)
 
 	if (j == Jretc) {
 		typclass(&cr, &typ[fn->retty], 1, gpreg, fpreg);
-		cty = (cr.nfp << 2) | cr.ngp;
 		if (cr.class & Cptr) {
 			assert(rtype(fn->retr) == RTmp);
 			blit0(fn->retr, r, cr.type->size, fn);
+			cty = 0;
 		} else {
 			ldregs(&cr, r, fn);
+			cty = (cr.nfp << 2) | cr.ngp;
 		}
 	} else {
 		k = j - Jretw;