summaryrefslogtreecommitdiff
path: root/8/isel.c
diff options
context:
space:
mode:
Diffstat (limited to '8/isel.c')
-rw-r--r--8/isel.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/8/isel.c b/8/isel.c
index f4989e9..f74fcd5 100644
--- a/8/isel.c
+++ b/8/isel.c
@@ -44,7 +44,7 @@ struct {
[One] = {Icmp, Ijnz, Isetnz},
[Ogt] = {Icmp, Ijg, Isetgt},
[Oge] = {Icmp, Ijge, Isetge},
- [Olt] = {Icmp, Ijl, Isetlt},
+ [Olt] = {Icmp, Ijl, Isetl},
[Ole] = {Icmp, Ijle, Isetle}
};
@@ -158,6 +158,15 @@ static void g(Isel *s, AsmOp op, ...)
lappend(&s->curbb->il, &s->curbb->ni, i);
}
+static void movz(Isel *s, Loc *src, Loc *dst)
+{
+ if (src->mode == dst->mode)
+ g(s, Imov, src, dst, NULL);
+ else
+ g(s, Imovz, src, dst, NULL);
+}
+
+
static void load(Isel *s, Loc *a, Loc *b)
{
Loc *l;
@@ -511,7 +520,7 @@ Loc *selexpr(Isel *s, Node *n)
r = locreg(mode(n));
g(s, reloptab[exprop(n)].test, a, a, NULL);
g(s, reloptab[exprop(n)].getflag, b, NULL);
- g(s, Imovz, b, r, NULL);
+ movz(s, b, r);
break;
case Oeq: case One: case Ogt: case Oge: case Olt: case Ole:
@@ -522,7 +531,7 @@ Loc *selexpr(Isel *s, Node *n)
r = locreg(mode(n));
g(s, reloptab[exprop(n)].test, a, b, NULL);
g(s, reloptab[exprop(n)].getflag, c, NULL);
- g(s, Imovz, c, r, NULL);
+ movz(s, c, r);
return r;
case Oasn: /* relabel */