summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-16 12:39:50 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:31 -0400
commite1725c0cdd15d7fea5beefec24759cc15825ead1 (patch)
tree87b614be2a5ef16aaf7048f9b645fb7add26ec20 /lisc/isel.c
parentca8c320dec82df1700216a5a040768bfc2d81632 (diff)
downloadroux-e1725c0cdd15d7fea5beefec24759cc15825ead1.tar.gz
make sure tests emitted are encodable
Diffstat (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 4f6b054..c36773c 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -333,6 +333,11 @@ seljmp(Blk *b, Fn *fn)
 				fi->op = OXTestw;
 			fi->to = R;
 			b->jmp.type = JXJc + Cne;
+			if (rtype(fi->arg[1]) == RCon) {
+				r = fi->arg[1];
+				fi->arg[1] = fi->arg[0];
+				fi->arg[0] = r;
+			}
 			return;
 		}
 		if (fn->tmp[r.val].nuse > 1) {