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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc2/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 928 and 929

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 928 Rev 929
Line 397... Line 397...
    modified = 0;
    modified = 0;
    for (b = 0; b < f->num_bb; b++) if (!(f->bb[b].type & BB_DEAD)) {
    for (b = 0; b < f->num_bb; b++) if (!(f->bb[b].type & BB_DEAD)) {
      for (i = 0; i < f->bb[b].ninsn; i++) {
      for (i = 0; i < f->bb[b].ninsn; i++) {
        cuc_insn *ii = &f->bb[b].insn[i];
        cuc_insn *ii = &f->bb[b].insn[i];
        /* We tend to have the third parameter const if instruction is cumutative */
        /* We tend to have the third parameter const if instruction is cumutative */
        if ((ii->opt[1] & OPT_CONST) && !(ii->opt[2] & OPT_CONST)
        if ((ii->opt[1] & OPT_CONST) && !(ii->opt[2] & OPT_CONST)) {
            && known[ii->index].comutative) {
          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];
          unsigned long t = ii->opt[1];
          ii->opt[1] = ii->opt[2];
          ii->opt[1] = ii->opt[2];
          ii->opt[2] = t;
          ii->opt[2] = t;
          t = ii->op[1];
          t = ii->op[1];
          ii->op[1] = ii->op[2];
          ii->op[1] = ii->op[2];
          ii->op[2] = t;
          ii->op[2] = t;
          modified = 1; cucdebug (2, "%08x:<>\n", REF(b, i));
          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 */
        /* Try to do the promotion */
        /* We have two consecutive expressions, containing constants,
        /* We have two consecutive expressions, containing constants,
         * if previous is a simple expression we can handle it simply: */
         * if previous is a simple expression we can handle it simply: */
Line 511... Line 524...
            } else /* sub - add joining */
            } else /* sub - add joining */
            if (ii->index == II_SUB && prev->index == II_ADD) {
            if (ii->index == II_SUB && prev->index == II_ADD) {
              ii->op[1] = prev->op[1]; ii->opt[1] = prev->opt[1];
              ii->op[1] = prev->op[1]; ii->opt[1] = prev->opt[1];
              ii->op[2] += prev->op[2];
              ii->op[2] += prev->op[2];
              modified = 1; cucdebug (2, "%8x: sub-add\n", REF(b, i));
              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.