summaryrefslogtreecommitdiff
path: root/src/core/arm/interpreter
diff options
context:
space:
mode:
authorGravatar Lioncash2015-01-02 18:21:45 -0500
committerGravatar Lioncash2015-01-02 18:29:30 -0500
commit3337b846204c3d18fde4e28ad1558f5e73532ccc (patch)
tree32689d9d8e3c8cb811682c9b025370fa0c332844 /src/core/arm/interpreter
parentMerge pull request #382 from lioncash/sx (diff)
downloadyuzu-3337b846204c3d18fde4e28ad1558f5e73532ccc.tar.gz
yuzu-3337b846204c3d18fde4e28ad1558f5e73532ccc.tar.xz
yuzu-3337b846204c3d18fde4e28ad1558f5e73532ccc.zip
dyncom: Implement SMLAD/SMUAD/SMLSD/SMUSD
Diffstat (limited to 'src/core/arm/interpreter')
-rw-r--r--src/core/arm/interpreter/armemu.cpp6
-rw-r--r--src/core/arm/interpreter/armsupp.cpp8
2 files changed, 9 insertions, 5 deletions
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index 43b1ba40e..40e4837d8 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -6470,10 +6470,12 @@ L_stm_s_takeabort:
6470 6470
6471 if (BITS(12, 15) != 15) { 6471 if (BITS(12, 15) != 15) {
6472 state->Reg[rd_idx] += state->Reg[ra_idx]; 6472 state->Reg[rd_idx] += state->Reg[ra_idx];
6473 ARMul_AddOverflowQ(state, product1 + product2, state->Reg[ra_idx]); 6473 if (ARMul_AddOverflowQ(product1 + product2, state->Reg[ra_idx]))
6474 SETQ;
6474 } 6475 }
6475 6476
6476 ARMul_AddOverflowQ(state, product1, product2); 6477 if (ARMul_AddOverflowQ(product1, product2))
6478 SETQ;
6477 } 6479 }
6478 // SMUSD and SMLSD 6480 // SMUSD and SMLSD
6479 else { 6481 else {
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index 426b67831..eec34143e 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -453,12 +453,14 @@ ARMul_AddOverflow (ARMul_State * state, ARMword a, ARMword b, ARMword result)
453 ASSIGNV (AddOverflow (a, b, result)); 453 ASSIGNV (AddOverflow (a, b, result));
454} 454}
455 455
456/* Assigns the Q flag if the given result is considered an overflow from the addition of a and b */ 456// Returns true if the Q flag should be set as a result of overflow.
457void ARMul_AddOverflowQ(ARMul_State* state, ARMword a, ARMword b) 457bool ARMul_AddOverflowQ(ARMword a, ARMword b)
458{ 458{
459 u32 result = a + b; 459 u32 result = a + b;
460 if (((result ^ a) & (u32)0x80000000) && ((a ^ b) & (u32)0x80000000) == 0) 460 if (((result ^ a) & (u32)0x80000000) && ((a ^ b) & (u32)0x80000000) == 0)
461 SETQ; 461 return true;
462
463 return false;
462} 464}
463 465
464/* Assigns the C flag after an subtraction of a and b to give result. */ 466/* Assigns the C flag after an subtraction of a and b to give result. */