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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_34/] [or1ksim/] [cuc/] [insn.c] - Diff between revs 953 and 973

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

Rev 953 Rev 973
Line 322... Line 322...
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = ii->op[1] <= ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[1] = ii->op[1] <= ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
 
    } else if (ii->opt[2] && OPT_CONST && ii->op[2] == 0) {
 
      change_insn_type (ii, II_SFEQ);
    } else break;
    } else break;
  case II_SFLT:
  case II_SFLT:
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = ii->op[1] < ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[1] = ii->op[1] < ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
    } else break;
    } else if (ii->opt[2] && OPT_CONST && ii->op[2] == 0) {
 
      change_insn_type (ii, II_ADD);
 
      ii->op[1] = 0; ii->opt[1] = OPT_CONST;
 
    } break;
  case II_SFGE:
  case II_SFGE:
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = ii->op[1] >= ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[1] = ii->op[1] >= ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
 
    } else if (ii->opt[2] && OPT_CONST && ii->op[2] == 0) {
 
      change_insn_type (ii, II_ADD);
 
      ii->op[1] = 1; ii->opt[1] = OPT_CONST;
    } else break;
    } else break;
  case II_SFGT:
  case II_SFGT:
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
    if (ii->opt[1] & OPT_CONST && ii->opt[2] & OPT_CONST) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[1] = ii->op[1] > ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[1] = ii->op[1] > ii->op[2]; ii->opt[1] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      return 1;
      return 1;
 
    } else if (ii->opt[2] && OPT_CONST && ii->op[2] == 0) {
 
      change_insn_type (ii, II_SFNE);
    } else break;
    } else break;
  case II_CMOV:
  case II_CMOV:
    if (ii->opt[1] == ii->opt[2] && ii->op[1] == ii->op[2]) {
    if (ii->opt[1] == ii->opt[2] && ii->op[1] == ii->op[2]) {
      change_insn_type (ii, II_ADD);
      change_insn_type (ii, II_ADD);
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
      ii->op[2] = 0; ii->opt[2] = OPT_CONST;
Line 795... Line 805...
}
}
 
 
static void unmark_tree (cuc_func *f, int ref)
static void unmark_tree (cuc_func *f, int ref)
{
{
  cuc_insn *ii = &f->INSN(ref);
  cuc_insn *ii = &f->INSN(ref);
  printf ("%x ", ref);
  cucdebug (5, "%x ", ref);
  if (ii->type & IT_UNUSED) {
  if (ii->type & IT_UNUSED) {
    int j;
    int j;
    ii->type &= ~IT_UNUSED;
    ii->type &= ~IT_UNUSED;
    for (j = 0; j < MAX_OPERANDS; j++)
    for (j = 0; j < MAX_OPERANDS; j++)
      if (ii->opt[j] & OPT_REF) unmark_tree (f, ii->op[j]);
      if (ii->opt[j] & OPT_REF) unmark_tree (f, ii->op[j]);
Line 819... Line 829...
      cuc_insn *ii = &f->bb[b].insn[i];
      cuc_insn *ii = &f->bb[b].insn[i];
      if (ii->type & IT_VOLATILE || ii->type & IT_OUTPUT
      if (ii->type & IT_VOLATILE || ii->type & IT_OUTPUT
       || II_IS_LOAD (ii->index) && (f->memory_order == MO_NONE || f->memory_order == MO_WEAK)
       || II_IS_LOAD (ii->index) && (f->memory_order == MO_NONE || f->memory_order == MO_WEAK)
       || II_IS_STORE (ii->index)) {
       || II_IS_STORE (ii->index)) {
        unmark_tree (f, REF (b, i));
        unmark_tree (f, REF (b, i));
        printf ("\n");
        cucdebug (5, "\n");
      }
      }
    }
    }
 
 
  for (b = 0; b < f->num_bb; b++)
  for (b = 0; b < f->num_bb; b++)
    for (i = 0; i < f->bb[b].ninsn; i++)
    for (i = 0; i < f->bb[b].ninsn; i++)

powered by: WebSVN 2.1.0

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