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

Merge pull request #310 from lioncash/ssat16

armemu: Fix SSAT16.
This commit is contained in:
bunnei 2014-12-20 16:23:54 -05:00
commit 993afd3bf0
1 changed files with 20 additions and 14 deletions

View File

@ -6091,22 +6091,28 @@ L_stm_s_takeabort:
//ichfly //ichfly
//SSAT16 //SSAT16
{ {
u8 tar = BITS(12, 15); const u8 rd_idx = BITS(12, 15);
u8 src = BITS(0, 3); const u8 rn_idx = BITS(0, 3);
u8 val = BITS(16, 19) + 1; const u8 num_bits = BITS(16, 19) + 1;
s16 a1 = (state->Reg[src]); const s16 min = -(0x8000 >> (16 - num_bits));
s16 a2 = (state->Reg[src] >> 0x10); const s16 max = (0x7FFF >> (16 - num_bits));
s16 min = (s16)(0x8000 >> (16 - val)); s16 rn_lo = (state->Reg[rn_idx]);
s16 max = 0x7FFF >> (16 - val); s16 rn_hi = (state->Reg[rn_idx] >> 16);
if (min > a1) a1 = min;
if (max < a1) a1 = max; if (rn_lo > max)
if (min > a2) a2 = min; rn_lo = max;
if (max < a2) a2 = max; else if (rn_lo < min)
u32 temp2 = ((u32)(a2)) << 0x10; rn_lo = min;
state->Reg[tar] = (a1 & 0xFFFF) | (temp2);
if (rn_hi > max)
rn_hi = max;
else if (rn_hi < min)
rn_hi = min;
state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi & 0xFFFF) << 16);
return 1;
} }
return 1;
default: default:
break; break;
} }