shithub: riscv

Download patch

ref: d42f9b511025014fb2e561813a535f9296886017
parent: cbe45e78f988184938ab63f8bac28632058e5810
author: cinap_lenrek <[email protected]>
date: Mon Aug 3 19:16:41 EDT 2020

reverting 7c change, breaks some 64-bit shifts...

--- a/sys/src/cmd/7c/cgen.c
+++ b/sys/src/cmd/7c/cgen.c
@@ -287,25 +287,28 @@
 				reglcgen(&nod2, l, Z);
 			else
 				nod2 = *l;
-			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
+			regalloc(&nod, n, nn);
+			cgen(r, &nod);
 		} else {
-			regalloc(&nod1, r, Z);
-			cgen(r, &nod1);
+			regalloc(&nod, n, nn);
+			cgen(r, &nod);
 			if(l->addable < INDEXED)
 				reglcgen(&nod2, l, Z);
 			else
 				nod2 = *l;
 		}
-		if(nod1.type == nod2.type || !typefd[nod1.type->etype])
-			regalloc(&nod, &nod2, nn);
-		else
-			regalloc(&nod, &nod1, Z);
-		gmove(&nod2, &nod);
-		gopcode(o, &nod1, &nod, &nod);
+		regalloc(&nod1, n, Z);
+		gopcode(OAS, &nod2, Z, &nod1);
+		if(nod1.type->etype != nod.type->etype){
+			regalloc(&nod3, &nod, Z);
+			gmove(&nod1, &nod3);
+			regfree(&nod1);
+			nod1 = nod3;
+		}
+		gopcode(o, &nod, &nod1, &nod);
 		gmove(&nod, &nod2);
 		if(nn != Z)
-			gmove(&nod2, nn);
+			gmove(&nod, nn);
 		regfree(&nod);
 		regfree(&nod1);
 		if(l->addable < INDEXED)