OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 928 to Rev 929
    Reverse comparison

Rev 928 → Rev 929

/trunk/or1ksim/cuc/insn.c
399,15 → 399,28
for (i = 0; i < f->bb[b].ninsn; i++) {
cuc_insn *ii = &f->bb[b].insn[i];
/* We tend to have the third parameter const if instruction is cumutative */
if ((ii->opt[1] & OPT_CONST) && !(ii->opt[2] & OPT_CONST)
&& known[ii->index].comutative) {
unsigned long t = ii->opt[1];
ii->opt[1] = ii->opt[2];
ii->opt[2] = t;
t = ii->op[1];
ii->op[1] = ii->op[2];
ii->op[2] = t;
modified = 1; cucdebug (2, "%08x:<>\n", REF(b, i));
if ((ii->opt[1] & OPT_CONST) && !(ii->opt[2] & OPT_CONST)) {
int cond = ii->index == II_SFEQ || ii->index == II_SFNE
|| ii->index == II_SFLT || ii->index == II_SFLE
|| ii->index == II_SFGT || ii->index == II_SFGE;
if (known[ii->index].comutative || cond) {
unsigned long t = ii->opt[1];
ii->opt[1] = ii->opt[2];
ii->opt[2] = t;
t = ii->op[1];
ii->op[1] = ii->op[2];
ii->op[2] = t;
modified = 1; cucdebug (2, "%08x:<>\n", REF(b, i));
if (cond) {
if (ii->index == II_SFEQ) ii->index = II_SFNE;
else if (ii->index == II_SFNE) ii->index = II_SFEQ;
else if (ii->index == II_SFLE) ii->index = II_SFGT;
else if (ii->index == II_SFLT) ii->index = II_SFGE;
else if (ii->index == II_SFGE) ii->index = II_SFLT;
else if (ii->index == II_SFGT) ii->index = II_SFLE;
else assert (0);
}
}
}
/* Try to do the promotion */
513,6 → 526,26
ii->op[1] = prev->op[1]; ii->opt[1] = prev->opt[1];
ii->op[2] += prev->op[2];
modified = 1; cucdebug (2, "%8x: sub-add\n", REF(b, i));
} else /* add - sfxx joining */
if (prev->index == II_ADD && (
ii->index == II_SFEQ || ii->index == II_SFNE
|| ii->index == II_SFLT || ii->index == II_SFLE
|| ii->index == II_SFGT || ii->index == II_SFGE)) {
if (ii->opt[2] & OPT_CONST) {
ii->op[1] = prev->op[1]; ii->opt[1] = prev->opt[1];
ii->op[2] -= prev->op[2];
modified = 1; cucdebug (2, "%8x: add-sfxx\n", REF(b, i));
}
} else /* sub - sfxx joining */
if (prev->index == II_SUB && (
ii->index == II_SFEQ || ii->index == II_SFNE
|| ii->index == II_SFLT || ii->index == II_SFLE
|| ii->index == II_SFGT || ii->index == II_SFGE)) {
if (ii->opt[2] & OPT_CONST) {
ii->op[1] = prev->op[1]; ii->opt[1] = prev->opt[1];
ii->op[2] += prev->op[2];
modified = 1; cucdebug (2, "%8x: sub-sfxx\n", REF(b, i));
}
}
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.