mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-25 01:11:48 +01:00
armemu: Simplify USAT16/UXTB/UXTAB
This commit is contained in:
parent
5e16216afb
commit
914ecfe04f
@ -6422,29 +6422,12 @@ L_stm_s_takeabort:
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 0x6e: {
|
||||
ARMword Rm;
|
||||
int ror = -1;
|
||||
|
||||
switch (BITS(4, 11)) {
|
||||
case 0x07:
|
||||
ror = 0;
|
||||
break;
|
||||
case 0x47:
|
||||
ror = 8;
|
||||
break;
|
||||
case 0x87:
|
||||
ror = 16;
|
||||
break;
|
||||
case 0xc7:
|
||||
ror = 24;
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
case 0xf3:
|
||||
//ichfly
|
||||
//USAT16
|
||||
case 0x6e: // USAT, USAT16, UXTB, and UXTAB
|
||||
{
|
||||
const u8 op2 = BITS(5, 7);
|
||||
|
||||
// USAT16
|
||||
if (op2 == 0x01) {
|
||||
const u8 rd_idx = BITS(12, 15);
|
||||
const u8 rn_idx = BITS(0, 3);
|
||||
const u8 num_bits = BITS(16, 19);
|
||||
@ -6471,30 +6454,24 @@ L_stm_s_takeabort:
|
||||
state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi << 16) & 0xFFFF);
|
||||
return 1;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ror == -1) {
|
||||
if (BITS(4, 6) == 0x7) {
|
||||
printf("Unhandled v6 insn: usat\n");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Rm = ((state->Reg[BITS(0, 3)] >> ror) & 0xFF) | (((state->Reg[BITS(0, 3)] << (32 - ror)) & 0xFF) & 0xFF);
|
||||
else if (op2 == 0x03) {
|
||||
const u8 rotate = BITS(10, 11) * 8;
|
||||
const u32 rm = ((state->Reg[BITS(0, 3)] >> rotate) & 0xFF) | (((state->Reg[BITS(0, 3)] << (32 - rotate)) & 0xFF) & 0xFF);
|
||||
|
||||
if (BITS(16, 19) == 0xf)
|
||||
/* UXTB */
|
||||
state->Reg[BITS(12, 15)] = Rm;
|
||||
state->Reg[BITS(12, 15)] = rm;
|
||||
else
|
||||
/* UXTAB */
|
||||
state->Reg[BITS(12, 15)] = state->Reg[BITS(16, 19)] + Rm;
|
||||
state->Reg[BITS(12, 15)] = state->Reg[BITS(16, 19)] + rm;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
printf("Unimplemented op: USAT");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x6f: // UXTH, UXTAH, and REVSH.
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user