shithub: riscv

Download patch

ref: e6d64bab9dc7c71c80e82b7c41555a413f502399
parent: 107ca1b42d099d74cd033be7f363b92d4ff29e3c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 4 16:06:59 EDT 2015

8c: handle 64 bit mixedmode asop and type vlong <-> float/double type conversions

--- a/sys/src/cmd/8c/machcap.c
+++ b/sys/src/cmd/8c/machcap.c
@@ -18,7 +18,7 @@
 		if(typev[n->type->etype]) {
 //		if(typev[n->type->etype] && n->right->op == OCONST) {
 //			if(hi64v(n->right) == 0)
-				return 1;
+				return !mixedasop(n->left->type, n->right->type);
 		}
 		break;
 
@@ -58,6 +58,8 @@
 
 	case OASADD:
 	case OASSUB:
+		return !mixedasop(n->left->type, n->right->type);
+
 	case OASAND:
 	case OASOR:
 	case OASXOR:
--- a/sys/src/cmd/8c/txt.c
+++ b/sys/src/cmd/8c/txt.c
@@ -621,20 +621,18 @@
 		a = AMOVWLZX;
 		goto ld;
 	case TINT:
-	case TUINT:
 	case TLONG:
-	case TULONG:
-	case TIND:
 		if(typefd[tt]) {
 			gins(AFMOVL, f, &fregnode0);
 			gmove(&fregnode0, t);
 			return;
 		}
+	case TUINT:
+	case TULONG:
+	case TIND:
 		a = AMOVL;
-
 	ld:
 		regalloc(&nod, f, t);
-		nod.type = types[TLONG];
 		gins(a, f, &nod);
 		gmove(&nod, t);
 		regfree(&nod);