summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-24 22:02:41 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-24 22:12:13 -0700
commit42cf99ad1a168e86247b37ad804a94ddd87a43c4 (patch)
treedd0e2b435c1d60879b3d8af330a972fa6f86b558
parent85f8cd1246e4df870f8767bf64f3f1fe5f006101 (diff)
downloadmc-42cf99ad1a168e86247b37ad804a94ddd87a43c4.tar.gz
Revert "Generates 'rol' instructions."
This reverts commit 6a921aa5b2045b172370c1677c1e3f75b8c3cfc4. This broke sha1 hashing.
-rw-r--r--6/insns.def11
-rw-r--r--6/isel.c60
2 files changed, 1 insertions, 70 deletions
diff --git a/6/insns.def b/6/insns.def
index 4838061..8682263 100644
--- a/6/insns.def
+++ b/6/insns.def
@@ -92,7 +92,6 @@ Insn(Iimul,
"\tIMUL%T %X,%R\n",
Use(.l={1,2}),
Def(.l={2}))
-
/* there is no imul for 8 bit values. */
Insn(Iimul_r,
"\timul%t %r\n",
@@ -169,16 +168,6 @@ Insn(Ishr,
"\tSHR%2T %U,%R\n",
Use(.l={1,2}),
Def(.l={2}))
-Insn(Irol,
- "\trol%2t %u,%r\n",
- "\tROL%2T %U,%R\n",
- Use(.l={1,2}),
- Def(.l={2}))
-Insn(Iror,
- "\tror%2t %u,%r\n",
- "\tROR%2T %U,%R\n",
- Use(.l={1,2}),
- Def(.l={2}))
Insn(Itest,
"\ttest%t %x,%r\n",
diff --git a/6/isel.c b/6/isel.c
index 4a0295e..6cc8ab2 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -593,59 +593,6 @@ static Loc *gencall(Isel *s, Node *n)
return ret;
}
-static int litval(Node *n, vlong *v)
-{
- Node *l;
-
- if (exprop(n) != Olit)
- return 0;
- l = n->expr.args[0];
- if (l->lit.littype != Lint)
- return 0;
- *v = l->lit.intval;
- return 1;
-}
-
-int isrol(Isel *s, Node *l, Node *r, Loc **dist, Loc **rol)
-{
- vlong a, b, sz;
-
- sz = size(r)*8;
- /* check if we have paired left/right shifts */
- if (exprop(l) != Obsl && exprop(l) != Obsr)
- return 0;
- if (exprop(r) != Obsl && exprop(r) != Obsr)
- return 0;
- if (exprop(r) == exprop(l))
- return 0;
-
- /* check if we're shifting by constants */
- if (!litval(l->expr.args[1], &a))
- return 0;
- if (!litval(r->expr.args[1], &b))
- return 0;
-
- /* and we're shifting the same variable */
- if (exprop(l->expr.args[0]) != Ovar)
- return 0;
- if (exprop(r->expr.args[0]) != Ovar)
- return 0;
- if (l->expr.args[0]->expr.did != r->expr.args[0]->expr.did)
- return 0;
-
- /* and then figure out the shift amount */
- if (a + b != sz)
- return 0;
- if (exprop(l) == Obsl)
- *dist = loclit(a, mode(l));
- else
- *dist = loclit(sz - a, mode(l));
- *rol = selexpr(s, l->expr.args[0]);
- return 1;
-}
-
-
-
Loc *selexpr(Isel *s, Node *n)
{
Loc *a, *b, *c, *d, *r;
@@ -661,14 +608,9 @@ Loc *selexpr(Isel *s, Node *n)
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 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 Obor:
- if (isrol(s, args[0], args[1], &d, &r))
- g(s, Irol, d, r, NULL);
- else
- r = binop(s, Ior, args[0], args[1]);
- break;
case Omul:
if (size(args[0]) == 1) {
a = selexpr(s, args[0]);