ref: de2876e46f5e7534cc986b351eea85abd788d425
parent: c97f69cb8e5300d8048604863b451e3685e8f105
author: Ori Bernstein <[email protected]>
date: Mon Jul 23 19:33:35 EDT 2012
Fix flipped operands and misnamed instructions.
--- a/8/insns.def
+++ b/8/insns.def
@@ -49,7 +49,7 @@
Insn(Isetnz, "\tsetnz %v\n", Use(), Def(.l={1}))
Insn(Isetl, "\tsetl %v\n", Use(), Def(.l={1}))
Insn(Isetle, "\tsetle %v\n", Use(), Def(.l={1}))
-Insn(Isetgt, "\tsetgt %v\n", Use(), Def(.l={1}))
+Insn(Isetg, "\tsetg %v\n", Use(), Def(.l={1}))
Insn(Isetge, "\tsetge %v\n", Use(), Def(.l={1}))
/* branch instructions */
--- a/8/isel.c
+++ b/8/isel.c
@@ -42,7 +42,7 @@
[Olnot] = {Itest, Ijz, Isetz},
[Oeq] = {Icmp, Ijz, Isetz},
[One] = {Icmp, Ijnz, Isetnz},
- [Ogt] = {Icmp, Ijg, Isetgt},
+ [Ogt] = {Icmp, Ijg, Isetg},
[Oge] = {Icmp, Ijge, Isetge},
[Olt] = {Icmp, Ijl, Isetl},
[Ole] = {Icmp, Ijle, Isetle}
@@ -526,10 +526,10 @@
case Oeq: case One: case Ogt: case Oge: case Olt: case Ole:
a = selexpr(s, args[0]);
b = selexpr(s, args[1]);
- b = inr(s, b);
+ a = inr(s, a);
c = locreg(ModeB);
r = locreg(mode(n));
- g(s, reloptab[exprop(n)].test, a, b, NULL);
+ g(s, reloptab[exprop(n)].test, b, a, NULL);
g(s, reloptab[exprop(n)].getflag, c, NULL);
movz(s, c, r);
return r;
--- /dev/null
+++ b/test/condifrel.myr
@@ -1,0 +1,10 @@
+
+var x = 3
+var y = 9
+const main = {
+ if x < 5 && y > 7
+ -> 7
+ else
+ -> 9
+ ;;
+}
--- a/test/tests
+++ b/test/tests
@@ -38,6 +38,7 @@
B loop E 45
B condiftrue E 7
B condiffalse E 9
+B condifrel E 7
B fib E 21
B float E 1
B log-and E 0