summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-22 21:43:22 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-30 13:20:42 -0400
commit82d79017ffff082f2237453ebf8d9f640fa10710 (patch)
treee8a3aeeaf4f5aa6692133caeeb41a0a01b4c0e67 /lisc
parente205856bc6b038e31a16d948e7830234412a3dfe (diff)
downloadroux-82d79017ffff082f2237453ebf8d9f640fa10710.tar.gz
fix test for load folding
Diffstat (limited to 'lisc')
-rw-r--r--lisc/isel.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index c6d9d65..9235c83 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -29,7 +29,7 @@ struct Addr {
 	int scale;
 };
 
-/* static */ void amatch(Addr *, Ref, ANum *, Fn *, int);
+static void amatch(Addr *, Ref, ANum *, Fn *, int);
 
 static int
 noimm(Ref r, Fn *fn)
@@ -165,7 +165,9 @@ Emit:
 			r0 = i.arg[n];
 			if (opdesc[i.op].nmem > n)
 			if ((i0 = an[r0.val].i))
-			if (i0->op == OLoad+Tsw || i0->op == OLoad+Tl) {
+			if (i0->op >= OLoad+Tl)
+			if ((i.wide == 0 && i0->op <= OLoad+Tsw)
+			||  (i.wide == 1 && i0->op <= OLoad+Tl)) {
 				amatch(&a, i0->arg[0], an, fn, 1);
 				curi->arg[n] = a.base;
 				if (a.offset.type == CUndef)
@@ -695,7 +697,7 @@ anumber(ANum *ai, Blk *b, Con *con)
 	}
 }
 
-/* static TESTING */ void
+static void
 amatch(Addr *a, Ref r, ANum *ai, Fn *fn, int top)
 {
 	Ins *i;