diff options
| author | 2014-12-28 11:45:13 -0500 | |
|---|---|---|
| committer | 2014-12-28 11:57:09 -0500 | |
| commit | 5e16216afb0d41855aeabaff81f17cd4bee59fe5 (patch) | |
| tree | 155cb82fe2a67bc4ebfae2e9a5511dc4204ccd19 /src | |
| parent | Merge pull request #350 from lioncash/qops (diff) | |
| download | yuzu-5e16216afb0d41855aeabaff81f17cd4bee59fe5.tar.gz yuzu-5e16216afb0d41855aeabaff81f17cd4bee59fe5.tar.xz yuzu-5e16216afb0d41855aeabaff81f17cd4bee59fe5.zip | |
armemu: Simplify REVSH/UXTH/UXTAH
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/interpreter/armemu.cpp | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp index 5d26456c7..a955d6aac 100644 --- a/src/core/arm/interpreter/armemu.cpp +++ b/src/core/arm/interpreter/armemu.cpp | |||
| @@ -6496,58 +6496,33 @@ L_stm_s_takeabort: | |||
| 6496 | return 1; | 6496 | return 1; |
| 6497 | } | 6497 | } |
| 6498 | 6498 | ||
| 6499 | case 0x6f: { | 6499 | case 0x6f: // UXTH, UXTAH, and REVSH. |
| 6500 | ARMword Rm; | 6500 | { |
| 6501 | int ror = -1; | 6501 | const u8 op2 = BITS(5, 7); |
| 6502 | |||
| 6503 | switch (BITS(4, 11)) { | ||
| 6504 | case 0x07: | ||
| 6505 | ror = 0; | ||
| 6506 | break; | ||
| 6507 | case 0x47: | ||
| 6508 | ror = 8; | ||
| 6509 | break; | ||
| 6510 | case 0x87: | ||
| 6511 | ror = 16; | ||
| 6512 | break; | ||
| 6513 | case 0xc7: | ||
| 6514 | ror = 24; | ||
| 6515 | break; | ||
| 6516 | 6502 | ||
| 6517 | case 0xfb: // REVSH | 6503 | // REVSH |
| 6518 | { | 6504 | if (op2 == 0x05) { |
| 6519 | DEST = ((RHS & 0xFF) << 8) | ((RHS & 0xFF00) >> 8); | 6505 | DEST = ((RHS & 0xFF) << 8) | ((RHS & 0xFF00) >> 8); |
| 6520 | if (DEST & 0x8000) | 6506 | if (DEST & 0x8000) |
| 6521 | DEST |= 0xffff0000; | 6507 | DEST |= 0xffff0000; |
| 6522 | return 1; | 6508 | return 1; |
| 6523 | } | ||
| 6524 | default: | ||
| 6525 | break; | ||
| 6526 | } | 6509 | } |
| 6510 | // UXTH and UXTAH | ||
| 6511 | else if (op2 == 0x03) { | ||
| 6512 | const u8 rotate = BITS(10, 11) * 8; | ||
| 6513 | const ARMword rm = ((state->Reg[BITS(0, 3)] >> rotate) & 0xFFFF) | (((state->Reg[BITS(0, 3)] << (32 - rotate)) & 0xFFFF) & 0xFFFF); | ||
| 6514 | |||
| 6515 | // UXTH | ||
| 6516 | if (BITS(16, 19) == 0xf) { | ||
| 6517 | state->Reg[BITS(12, 15)] = rm; | ||
| 6518 | } | ||
| 6519 | // UXTAH | ||
| 6520 | else { | ||
| 6521 | state->Reg[BITS(12, 15)] = state->Reg[BITS(16, 19)] + rm; | ||
| 6522 | } | ||
| 6527 | 6523 | ||
| 6528 | if (ror == -1) | 6524 | return 1; |
| 6529 | break; | ||
| 6530 | |||
| 6531 | Rm = ((state->Reg[BITS(0, 3)] >> ror) & 0xFFFF) | (((state->Reg[BITS(0, 3)] << (32 - ror)) & 0xFFFF) & 0xFFFF); | ||
| 6532 | |||
| 6533 | /* UXT */ | ||
| 6534 | /* state->Reg[BITS (12, 15)] = Rm; */ | ||
| 6535 | /* dyf add */ | ||
| 6536 | if (BITS(16, 19) == 0xf) { | ||
| 6537 | state->Reg[BITS(12, 15)] = Rm; | ||
| 6538 | } | ||
| 6539 | else { | ||
| 6540 | /* UXTAH */ | ||
| 6541 | /* state->Reg[BITS (12, 15)] = state->Reg [BITS (16, 19)] + Rm; */ | ||
| 6542 | // printf("rd is %x rn is %x rm is %x rotate is %x\n", state->Reg[BITS (12, 15)], state->Reg[BITS (16, 19)] | ||
| 6543 | // , Rm, BITS(10, 11)); | ||
| 6544 | // printf("icounter is %lld\n", state->NumInstrs); | ||
| 6545 | state->Reg[BITS(12, 15)] = state->Reg[BITS(16, 19)] + Rm; | ||
| 6546 | // printf("rd is %x\n", state->Reg[BITS (12, 15)]); | ||
| 6547 | // exit(-1); | ||
| 6548 | } | 6525 | } |
| 6549 | |||
| 6550 | return 1; | ||
| 6551 | } | 6526 | } |
| 6552 | case 0x70: | 6527 | case 0x70: |
| 6553 | // ichfly | 6528 | // ichfly |