URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 1045 to Rev 1046
- ↔ Reverse comparison
Rev 1045 → Rev 1046
/trunk/or1ksim/cuc/insn.c
607,6 → 607,51
} |
} |
} |
|
/* Check if both choices can be pushed through */ |
if (ii->opt[1] & OPT_REF && ii->opt[2] & OPT_REF) { |
cuc_insn *a, *b; |
a = &f->INSN(ii->op[1]); |
b = &f->INSN(ii->op[2]); |
if (a->index == b->index && !(a->type & IT_VOLATILE) && !(b->type & IT_VOLATILE)) { |
int diff = -1; |
int i; |
for (i = 0; i < MAX_OPERANDS; i++) |
if (a->opt[i] != b->opt[i] || !(a->op[i] == b->op[i] || a->opt[i] & OPT_REGISTER)) { |
if (diff == -1) diff = i; else diff = -2; |
} |
/* If diff == -1, it will be eliminated by CSE */ |
if (diff >= 0) { |
cuc_insn tmp, cmov; |
int ref2 = REF (REF_BB (ref), REF_I (ref) + 1); |
insert_insns (f, ref, 1); |
a = &f->INSN(f->INSN(ref2).op[1]); |
b = &f->INSN(f->INSN(ref2).op[2]); |
cucdebug (4, "ref = %x %x %x\n", ref, f->INSN(ref2).op[1], f->INSN(ref2).op[2]); |
if (cuc_debug >= 7) { |
print_cuc_bb (f, "AAA"); |
cuc_check (f); |
} |
tmp = *a; |
cmov = f->INSN(ref2); |
tmp.op[diff] = ref; tmp.opt[diff] = OPT_REF; |
cmov.op[1] = a->op[diff]; cmov.opt[1] = a->opt[diff]; |
cmov.op[2] = b->op[diff]; cmov.opt[2] = b->opt[diff]; |
change_insn_type (&cmov, II_CMOV); |
cmov.type &= ~IT_COND; |
cucdebug (4, "ref2 = %x %x %x\n", ref2, cmov.op[1], cmov.op[2]); |
if (cmov.opt[1] & OPT_REF && cmov.opt[2] & OPT_REF |
&& f->INSN(cmov.op[1]).type & IT_COND) { |
assert (f->INSN(cmov.op[2]).type & IT_COND); |
cmov.type |= IT_COND; |
} |
f->INSN(ref) = cmov; |
f->INSN(ref2) = tmp; |
if (cuc_debug >= 6) print_cuc_bb (f, "BBB"); |
cuc_check (f); |
} |
} |
} |
return 0; |
} |
|
753,7 → 798,7
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) { |
if (ii->opt[2] & OPT_CONST && ii->op[2] < 0x80000000) { |
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)); |