ref: a4c149a1f8d9256f4aad6625b5868874e1f512ee
parent: 1f1347b5b30a7cec94bfe58e84fef595310d2b1c
author: Ori Bernstein <[email protected]>
date: Mon May 7 20:47:31 EDT 2012
Add more binary ops.
--- a/8/insns.def
+++ b/8/insns.def
@@ -22,10 +22,15 @@
Insn(Iadd, "\tadd%t %r,%x\n", 0)
Insn(Isub, "\tsub%t %r,%x\n", 0)
-Insn(Ipush, "\tpush%t %r\n", 0)
-Insn(Ipop, "\tpop%t %r\n", 0)
+Insn(Iand, "\tand%d %r,%x\n", 0)
+Insn(Ior, "\tor%d %r,%x\n", 0)
+Insn(Ixor, "\txor%d %r,%x\n", 0)
+
Insn(Itest, "\ttest%t %r,%r", 0)
Insn(Icmp, "\tcmp%t %r,%r", 0)
+
+Insn(Ipush, "\tpush%t %r\n", 0)
+Insn(Ipop, "\tpop%t %r\n", 0)
/* branch instructions */
Insn(Isetz, "\tsetz\n", 0)
--- a/8/isel.c
+++ b/8/isel.c
@@ -361,23 +361,23 @@
args = n->expr.args;
r = (Loc){Locnone, };
switch (exprop(n)) {
- case Oadd: r = binop(s, Iadd, args[0], args[1]); break;
- case Osub: r = binop(s, Isub, args[0], args[1]); break;
+ case Oadd: r = binop(s, Iadd, args[0], args[1]); break;
+ case Osub: r = binop(s, Isub, args[0], args[1]); break;
- case Omul: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Odiv: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Omod: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Oneg: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Omul: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Odiv: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Omod: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Oneg: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Obor: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Oband: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Obxor: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Obsl: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Obsr: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Obnot: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Obor: r = binop(s, Ior, args[0], args[1]); break;
+ case Oband: r = binop(s, Iand, args[0], args[1]); break;
+ case Obxor: r = binop(s, Ixor, args[0], args[1]); break;
+ case Obsl: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Obsr: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Obnot: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Oaddr: die("Unimplemented op %s", opstr(exprop(n))); break;
- case Oderef: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Oaddr: die("Unimplemented op %s", opstr(exprop(n))); break;
+ case Oderef: die("Unimplemented op %s", opstr(exprop(n))); break;
case Olnot:
a = selexpr(s, args[0]);