mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
sh2 drc, improve T bit propagation
This commit is contained in:
parent
0de604b1ff
commit
b286d66f7b
1 changed files with 8 additions and 6 deletions
|
@ -6847,7 +6847,7 @@ end:
|
||||||
|
|
||||||
// 2nd pass: some analysis
|
// 2nd pass: some analysis
|
||||||
lowest_literal = end_literals = lowest_mova = 0;
|
lowest_literal = end_literals = lowest_mova = 0;
|
||||||
t = T_UNKNOWN;
|
t = T_UNKNOWN; // T flag state
|
||||||
last_btarget = 0;
|
last_btarget = 0;
|
||||||
op = 0; // delay/poll insns counter
|
op = 0; // delay/poll insns counter
|
||||||
is_divop = 0; // divide op insns counter
|
is_divop = 0; // divide op insns counter
|
||||||
|
@ -6857,7 +6857,7 @@ end:
|
||||||
crc += FETCH_OP(pc);
|
crc += FETCH_OP(pc);
|
||||||
|
|
||||||
// propagate T (TODO: DIV0U)
|
// propagate T (TODO: DIV0U)
|
||||||
if ((op_flags[i] & OF_BTARGET) || (opd->dest & BITMASK1(SHR_T)))
|
if (op_flags[i] & OF_BTARGET)
|
||||||
t = T_UNKNOWN;
|
t = T_UNKNOWN;
|
||||||
|
|
||||||
if ((opd->op == OP_BRANCH_CT && t == T_SET) ||
|
if ((opd->op == OP_BRANCH_CT && t == T_SET) ||
|
||||||
|
@ -6867,10 +6867,12 @@ end:
|
||||||
} else if ((opd->op == OP_BRANCH_CT && t == T_CLEAR) ||
|
} else if ((opd->op == OP_BRANCH_CT && t == T_CLEAR) ||
|
||||||
(opd->op == OP_BRANCH_CF && t == T_SET))
|
(opd->op == OP_BRANCH_CF && t == T_SET))
|
||||||
opd->op = OP_BRANCH_N;
|
opd->op = OP_BRANCH_N;
|
||||||
else if ((opd->op == OP_SETCLRT && !opd->imm) || opd->op == OP_BRANCH_CT)
|
else if (OP_ISBRACND(opd->op))
|
||||||
t = T_CLEAR;
|
t = (opd->op == OP_BRANCH_CF ? T_SET : T_CLEAR);
|
||||||
else if ((opd->op == OP_SETCLRT && opd->imm) || opd->op == OP_BRANCH_CF)
|
else if (opd->op == OP_SETCLRT)
|
||||||
t = T_SET;
|
t = (opd->imm ? T_SET : T_CLEAR);
|
||||||
|
else if (opd->dest & BITMASK1(SHR_T))
|
||||||
|
t = T_UNKNOWN;
|
||||||
|
|
||||||
// "overscan" detection: unreachable code after unconditional branch
|
// "overscan" detection: unreachable code after unconditional branch
|
||||||
// this can happen if the insn after a forward branch isn't a local target
|
// this can happen if the insn after a forward branch isn't a local target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue