summaryrefslogtreecommitdiffstats
path: root/src/core/arm/interpreter/armemu.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-12-23 15:55:07 +0100
committerLioncash <mathew1800@gmail.com>2014-12-23 15:58:21 +0100
commit79a7a432c524c7c999eed177e3ed34ba2646359a (patch)
tree61a4f8eef151f32bca6685879ad0ef73e1af7df8 /src/core/arm/interpreter/armemu.cpp
parentMerge pull request #334 from lioncash/cpsr (diff)
downloadyuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar.gz
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar.bz2
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar.lz
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar.xz
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.tar.zst
yuzu-79a7a432c524c7c999eed177e3ed34ba2646359a.zip
Diffstat (limited to 'src/core/arm/interpreter/armemu.cpp')
-rw-r--r--src/core/arm/interpreter/armemu.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index 578d71380..23469f4df 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -6478,22 +6478,28 @@ L_stm_s_takeabort:
const s16 rn_lo = (rn_val & 0xFFFF);
const s16 rn_hi = ((rn_val >> 16) & 0xFFFF);
- // SMUAD
- if ((instr & 0xf0d0) == 0xf010) {
- state->Reg[rd_idx] = (rn_lo * rm_lo) + (rn_hi * rm_hi);
- }
- // SMUSD
- else if ((instr & 0xf0d0) == 0xf050) {
- state->Reg[rd_idx] = (rn_lo * rm_lo) - (rn_hi * rm_hi);
- }
- // SMLAD
- else if ((instr & 0xd0) == 0x10) {
- state->Reg[rd_idx] = (rn_lo * rm_lo) + (rn_hi * rm_hi) + (s32)state->Reg[ra_idx];
+ const u32 product1 = (rn_lo * rm_lo);
+ const u32 product2 = (rn_hi * rm_hi);
+
+ // SMUAD and SMLAD
+ if (BIT(6) == 0) {
+ state->Reg[rd_idx] = product1 + product2;
+
+ if (BITS(12, 15) != 15) {
+ state->Reg[rd_idx] += state->Reg[ra_idx];
+ ARMul_AddOverflowQ(state, product1 + product2, state->Reg[ra_idx]);
+ }
+
+ ARMul_AddOverflowQ(state, product1, product2);
}
- // SMLSD
+ // SMUSD and SMLSD
else {
- state->Reg[rd_idx] = ((rn_lo * rm_lo) - (rn_hi * rm_hi)) + (s32)state->Reg[ra_idx];
+ state->Reg[rd_idx] = product1 - product2;
+
+ if (BITS(12, 15) != 15)
+ state->Reg[rd_idx] += state->Reg[ra_idx];
}
+
return 1;
}
break;