diff options
Diffstat (limited to 'lisc/emit.c')
-rw-r--r-- | lisc/emit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisc/emit.c b/lisc/emit.c index 141c3f2..6a485a7 100644 --- a/lisc/emit.c +++ b/lisc/emit.c @@ -57,6 +57,15 @@ eins(Ins i, Fn *fn, FILE *f) switch (i.op) { case OAdd: case OSub: + if (req(i.to, i.arg[1])) + switch (opdesc[i.op].comm) { + case T: + i.arg[1] = i.arg[0]; + i.arg[0] = i.to; + break; + default: + diag("emit: instruction can't be encoded"); + } if (!req(i.to, i.arg[0])) eop("mov", i.arg[0], i.to, fn, f); eop(opi[i.op], i.arg[1], i.to, fn, f); |