summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2013-03-20 13:57:13 -0400
committerOri Bernstein <orib@google.com>2013-03-20 13:57:18 -0400
commite3670dfc5c38e7c42971b833738e6cd265ca77f9 (patch)
treea1b2bf63040cb42c757e2c9263753057294bd283
parent64f02da800fa67fc90084cdef6c6fee0dc24e9dd (diff)
downloadmc-e3670dfc5c38e7c42971b833738e6cd265ca77f9.tar.gz
Use 'lea' to calculate offset addresses.
Again, shorter and easier to understand code. Possibly faster too.
-rw-r--r--6/isel.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/6/isel.c b/6/isel.c
index dd688f0..1c58297 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -360,13 +360,18 @@ static void blit(Isel *s, Loc *to, Loc *from, size_t dstoff, size_t srcoff, size
sp = inr(s, from);
dp = inr(s, to);
- g(s, Imov, len, locphysreg(Rrcx), NULL); /* length to blit */
- g(s, Imov, sp, locphysreg(Rrsi), NULL); /* source index */
- g(s, Imov, dp, locphysreg(Rrdi), NULL); /* dest index */
+ /* length to blit */
+ g(s, Imov, len, locphysreg(Rrcx), NULL);
+ /* source address with offset */
if (srcoff)
- g(s, Iadd, loclit(srcoff, ModeQ), locphysreg(Rrsi), NULL);
+ g(s, Ilea, locmem(srcoff, sp, NULL, ModeQ), locphysreg(Rrsi), NULL);
+ else
+ g(s, Imov, sp, locphysreg(Rrsi), NULL);
+ /* dest address with offset */
if (dstoff)
- g(s, Iadd, loclit(dstoff, ModeQ), locphysreg(Rrdi), NULL);
+ g(s, Ilea, locmem(dstoff, dp, NULL, ModeQ), locphysreg(Rrdi), NULL);
+ else
+ g(s, Imov, dp, locphysreg(Rrdi), NULL);
g(s, op, NULL);
}