yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Merge pull request #304 from lioncash/sflags

armemu: Set GE flags properly for SSUB16, SADD16, SSAX, and SASX.
This commit is contained in:
bunnei 2014-12-18 17:46:10 -05:00
commit 24b5e87279
1 changed files with 29 additions and 4 deletions

View File

@ -5839,21 +5839,46 @@ L_stm_s_takeabort:
const s16 rm_lo = (state->Reg[rm_idx] & 0xFFFF); const s16 rm_lo = (state->Reg[rm_idx] & 0xFFFF);
const s16 rm_hi = ((state->Reg[rm_idx] >> 16) & 0xFFFF); const s16 rm_hi = ((state->Reg[rm_idx] >> 16) & 0xFFFF);
s32 lo_result;
s32 hi_result;
// SSUB16 // SSUB16
if ((instr & 0xFF0) == 0xf70) { if ((instr & 0xFF0) == 0xf70) {
state->Reg[rd_idx] = ((rn_lo - rm_lo) & 0xFFFF) | (((rn_hi - rm_hi) & 0xFFFF) << 16); lo_result = (rn_lo - rm_lo);
hi_result = (rn_hi - rm_hi);
} }
// SADD16 // SADD16
else if ((instr & 0xFF0) == 0xf10) { else if ((instr & 0xFF0) == 0xf10) {
state->Reg[rd_idx] = ((rn_lo + rm_lo) & 0xFFFF) | (((rn_hi + rm_hi) & 0xFFFF) << 16); lo_result = (rn_lo + rm_lo);
hi_result = (rn_hi + rm_hi);
} }
// SSAX // SSAX
else if ((instr & 0xFF0) == 0xf50) { else if ((instr & 0xFF0) == 0xf50) {
state->Reg[rd_idx] = ((rn_lo + rm_hi) & 0xFFFF) | (((rn_hi - rm_lo) & 0xFFFF) << 16); lo_result = (rn_lo + rm_hi);
hi_result = (rn_hi - rm_lo);
} }
// SASX // SASX
else { else {
state->Reg[rd_idx] = ((rn_lo - rm_hi) & 0xFFFF) | (((rn_hi + rm_lo) & 0xFFFF) << 16); lo_result = (rn_lo - rm_hi);
hi_result = (rn_hi + rm_lo);
}
state->Reg[rd_idx] = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16);
if (lo_result >= 0) {
state->Cpsr |= (1 << 16);
state->Cpsr |= (1 << 17);
} else {
state->Cpsr &= ~(1 << 16);
state->Cpsr &= ~(1 << 17);
}
if (hi_result >= 0) {
state->Cpsr |= (1 << 18);
state->Cpsr |= (1 << 19);
} else {
state->Cpsr &= ~(1 << 18);
state->Cpsr &= ~(1 << 19);
} }
return 1; return 1;
} else { } else {