summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-04 19:39:01 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit1477dffe32ae769c15ee49e77c5f0856bd0f56ea (patch)
tree60a3e6602227b8c2cb3141a43e5c8e82cb18cd8d /lisc/emit.c
parentdf358ad6d21502568df9f937788f3fab6a81e047 (diff)
downloadroux-1477dffe32ae769c15ee49e77c5f0856bd0f56ea.tar.gz
use cmp $0, it works with spill slots
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 8a8d3e7..a014727 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -168,14 +168,14 @@ emitfn(Fn *fn, FILE *f)
 			break;
 		case JJez:
 			if (b->s1 == b->link) {
-				js = "jnz";
+				js = "jne";
 				s = b->s2;
 			} else if (b->s2 == b->link) {
-				js = "jz";
+				js = "je";
 				s = b->s1;
 			} else
 				diag("emit: unhandled jump (1)");
-			eop("test", b->jmp.arg, b->jmp.arg, fn, f);
+			eop("cmp $0,", b->jmp.arg, R, fn, f);
 			fprintf(f, "\t%s .L%s\n", js, s->name);
 			break;
 		default: