diff options
| author | 2014-12-29 14:53:04 -0500 | |
|---|---|---|
| committer | 2014-12-29 14:53:04 -0500 | |
| commit | 2d2aa2c0beae1bc7913e043444dadfab509afa8c (patch) | |
| tree | f5428b3fd197cf3f7f00002b71cc7fdc754bd890 /src/core/arm/interpreter/armsupp.cpp | |
| parent | Merge pull request #363 from lioncash/label (diff) | |
| parent | dyncom: Implement QADD8/QSUB8 (diff) | |
| download | yuzu-2d2aa2c0beae1bc7913e043444dadfab509afa8c.tar.gz yuzu-2d2aa2c0beae1bc7913e043444dadfab509afa8c.tar.xz yuzu-2d2aa2c0beae1bc7913e043444dadfab509afa8c.zip | |
Merge pull request #361 from lioncash/moreqops
dyncom/armemu: Implement QADD8/QSUB8.
Diffstat (limited to 'src/core/arm/interpreter/armsupp.cpp')
| -rw-r--r-- | src/core/arm/interpreter/armsupp.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp index 8f158e2c8..8b3661c8f 100644 --- a/src/core/arm/interpreter/armsupp.cpp +++ b/src/core/arm/interpreter/armsupp.cpp | |||
| @@ -478,6 +478,66 @@ ARMul_SubOverflow (ARMul_State * state, ARMword a, ARMword b, ARMword result) | |||
| 478 | ASSIGNV (SubOverflow (a, b, result)); | 478 | ASSIGNV (SubOverflow (a, b, result)); |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | /* 8-bit signed saturated addition */ | ||
| 482 | u8 ARMul_SignedSaturatedAdd8(u8 left, u8 right) | ||
| 483 | { | ||
| 484 | u8 result = left + right; | ||
| 485 | |||
| 486 | if (((result ^ left) & 0x80) && ((left ^ right) & 0x80) == 0) { | ||
| 487 | if (left & 0x80) | ||
| 488 | result = 0x80; | ||
| 489 | else | ||
| 490 | result = 0x7F; | ||
| 491 | } | ||
| 492 | |||
| 493 | return result; | ||
| 494 | } | ||
| 495 | |||
| 496 | /* 8-bit signed saturated subtraction */ | ||
| 497 | u8 ARMul_SignedSaturatedSub8(u8 left, u8 right) | ||
| 498 | { | ||
| 499 | u8 result = left - right; | ||
| 500 | |||
| 501 | if (((result ^ left) & 0x80) && ((left ^ right) & 0x80) != 0) { | ||
| 502 | if (left & 0x80) | ||
| 503 | result = 0x80; | ||
| 504 | else | ||
| 505 | result = 0x7F; | ||
| 506 | } | ||
| 507 | |||
| 508 | return result; | ||
| 509 | } | ||
| 510 | |||
| 511 | /* 16-bit signed saturated addition */ | ||
| 512 | u16 ARMul_SignedSaturatedAdd16(u16 left, u16 right) | ||
| 513 | { | ||
| 514 | u16 result = left + right; | ||
| 515 | |||
| 516 | if (((result ^ left) & 0x8000) && ((left ^ right) & 0x8000) == 0) { | ||
| 517 | if (left & 0x8000) | ||
| 518 | result = 0x8000; | ||
| 519 | else | ||
| 520 | result = 0x7FFF; | ||
| 521 | } | ||
| 522 | |||
| 523 | return result; | ||
| 524 | } | ||
| 525 | |||
| 526 | /* 16-bit signed saturated subtraction */ | ||
| 527 | u16 ARMul_SignedSaturatedSub16(u16 left, u16 right) | ||
| 528 | { | ||
| 529 | u16 result = left - right; | ||
| 530 | |||
| 531 | if (((result ^ left) & 0x8000) && ((left ^ right) & 0x8000) != 0) { | ||
| 532 | if (left & 0x8000) | ||
| 533 | result = 0x8000; | ||
| 534 | else | ||
| 535 | result = 0x7FFF; | ||
| 536 | } | ||
| 537 | |||
| 538 | return result; | ||
| 539 | } | ||
| 540 | |||
| 481 | /* 8-bit unsigned saturated addition */ | 541 | /* 8-bit unsigned saturated addition */ |
| 482 | u8 ARMul_UnsignedSaturatedAdd8(u8 left, u8 right) | 542 | u8 ARMul_UnsignedSaturatedAdd8(u8 left, u8 right) |
| 483 | { | 543 | { |