summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-07 13:38:55 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-07 13:38:55 -0500
commita55dd6fc07b38599e012f664c90125838009134a (patch)
treee64a04c2dfb154504cb3b338d3e2b232434f441b
parent4c855e3e125ff8bdf64b1970460e0d9fc2db52c1 (diff)
downloadroux-a55dd6fc07b38599e012f664c90125838009134a.tar.gz
refine immediate reload test
We only need to load all the bits of a large
constant when it is used in long context.
-rw-r--r--lisc/isel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 6a6f0f4..6834d17 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -81,7 +81,8 @@ noimm(Ref r, Fn *fn)
 {
 	int64_t val;
 
-	assert(rtype(r) == RCon);
+	if (rtype(r) != RCon)
+		return 0;
 	switch (fn->con[r.val].type) {
 	default:
 		diag("isel: invalid constant");
@@ -161,7 +162,7 @@ fixarg(Ref *r, int k, int phi, Fn *fn)
 		sprintf(a.offset.label, ".Lfp%d", n);
 		fn->mem[fn->nmem-1] = a;
 	}
-	else if (!phi && rtype(r0) == RCon && noimm(r0, fn)) {
+	else if (!phi && k == Kl && noimm(r0, fn)) {
 		/* load constants that do not fit in
 		 * a 32bit signed integer into a
 		 * long temporary