summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-20 11:56:48 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:32 -0400
commit1abed68cc3b14606d83d8b0ad7d2b5855c8801df (patch)
tree5dd125c3da2495d10798929be36e5d64960aabe1 /lisc
parentfd31290dd37cfd8f7ba765eb330d719bafba42f0 (diff)
downloadroux-1abed68cc3b14606d83d8b0ad7d2b5855c8801df.tar.gz
change cmp $0, %reg, to test %reg, %reg
Diffstat (limited to 'lisc')
-rw-r--r--lisc/emit.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 59b439b..278f579 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -261,6 +261,11 @@ eins(Ins i, Fn *fn, FILE *f)
 		break;
 	case OXCmpw:
 	case OXCmpl:
+		if (rtype(i.arg[1]) == RTmp && req(i.arg[0], CON_Z)) {
+			eop("test", i.arg[1], i.arg[1], fn, f);
+			break;
+		}
+		/* fall through */
 	case OXTestw:
 	case OXTestl:
 		eop(otoa[i.op], i.arg[0], i.arg[1], fn, f);