summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-17 19:00:51 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:31 -0400
commit40d0582ee06232bf8290fafca476a3288488743d (patch)
tree7c3e4545237f662f5a40c2a0f42eb3aea7a94cad /lisc/emit.c
parent5668e93147563c824e693255de5e58fdc398a36b (diff)
downloadroux-40d0582ee06232bf8290fafca476a3288488743d.tar.gz
add sign/zero extension operations
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 9d59890..e9887ef 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -130,6 +130,8 @@ eins(Ins i, Fn *fn, FILE *f)
 		[OSub]    = "sub",
 		[OMul]    = "imul",
 		[OAnd]    = "and",
+		[OSext]   = "movslq",
+		[OZext]   = "movzlq",
 		[OLoad]   = "mov",
 		[OLoadss] = "movsw",
 		[OLoadus] = "movzw",
@@ -182,6 +184,13 @@ eins(Ins i, Fn *fn, FILE *f)
 			eop("mov", i.arg[0], i.to, fn, f);
 		eop(otoa[i.op], i.arg[1], i.to, fn, f);
 		break;
+	case OSext:
+	case OZext:
+		if (rtype(i.to) != RTmp || i.to.val >= EAX
+		|| (rtype(i.arg[0]) == RTmp && i.arg[0].val < EAX))
+			diag("emit: invalid extension");
+		eop(otoa[i.op], i.arg[0], i.to, fn, f);
+		break;
 	case OCopy:
 		if (req(i.to, R))
 			break;