summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-06 16:35:17 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit7dc3e5dcf60d1995857c85773cd15c9904ec9abd (patch)
tree80fdc629c43569d868705622b8139f1628efd03f /lisc/isel.c
parent27f32f26b32d9dd4138f30a23baaea237984c58c (diff)
downloadroux-7dc3e5dcf60d1995857c85773cd15c9904ec9abd.tar.gz
split cmp in two sizes
Diffstat (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 8fe7535..31de291 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -39,6 +39,12 @@ newtmp(int type, Fn *fn)
 	return t;
 }
 
+static int
+islong(Ref r, Fn *fn)
+{
+	return rtype(r) == RTmp && fn->tmp[r.val].type == TLong;
+}
+
 static void
 sel(Ins i, Fn *fn)
 {
@@ -103,7 +109,10 @@ sel(Ins i, Fn *fn)
 				}
 			}
 			emit(OXSet+c, i.to, R, R);
-			emit(OXCmp, R, i.arg[1], r0);
+			if (islong(r0, fn) || islong(i.arg[1], fn))
+				emit(OXCmpl, R, i.arg[1], r0);
+			else
+				emit(OXCmpw, R, i.arg[1], r0);
 			if (t != -1)
 				emit(OCopy, r0, i.arg[0], R);
 			break;