summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 1867097..a1a70c4 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -128,7 +128,12 @@ eins(Ins i, Fn *fn, FILE *f)
 	case OAdd:
 	case OSub:
 		if (req(i.to, i.arg[1])) {
-			if (!opdesc[i.op].comm)
+			if (i.op == OSub) {
+				eop("neg", i.to, R, fn, f);
+				eop("add", i.arg[0], i.to, fn, f);
+				break;
+			}
+			if (opdesc[i.op].comm != T)
 				diag("emit: unhandled instruction (1)");
 			i.arg[1] = i.arg[0];
 			i.arg[0] = i.to;