summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp67
1 files changed, 64 insertions, 3 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index bc55a082f..662b92579 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -2369,13 +2369,41 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smlal)(unsigned int inst, int index)
2369 inst_base->load_r15 = 1; 2369 inst_base->load_r15 = 1;
2370 return inst_base; 2370 return inst_base;
2371} 2371}
2372
2372ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); } 2373ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); }
2373ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); } 2374ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); }
2374ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); } 2375ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); }
2375ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); } 2376ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); }
2376ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLA"); } 2377
2377ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLS"); } 2378ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index)
2378ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMUL"); } 2379{
2380 arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(smlad_inst));
2381 smlad_inst* const inst_cream = (smlad_inst*)inst_base->component;
2382
2383 inst_base->cond = BITS(inst, 28, 31);
2384 inst_base->idx = index;
2385 inst_base->br = NON_BRANCH;
2386 inst_base->load_r15 = 0;
2387
2388 inst_cream->m = BIT(inst, 5);
2389 inst_cream->Ra = BITS(inst, 12, 15);
2390 inst_cream->Rm = BITS(inst, 8, 11);
2391 inst_cream->Rn = BITS(inst, 0, 3);
2392 inst_cream->Rd = BITS(inst, 16, 19);
2393 inst_cream->op1 = BITS(inst, 20, 22);
2394 inst_cream->op2 = BITS(inst, 5, 7);
2395
2396 return inst_base;
2397}
2398ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index)
2399{
2400 return INTERPRETER_TRANSLATE(smmla)(inst, index);
2401}
2402ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index)
2403{
2404 return INTERPRETER_TRANSLATE(smmla)(inst, index);
2405}
2406
2379ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index) 2407ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index)
2380{ 2408{
2381 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst)); 2409 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst));
@@ -5462,9 +5490,42 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
5462 SMLALD_INST: 5490 SMLALD_INST:
5463 SMLAW_INST: 5491 SMLAW_INST:
5464 SMLSLD_INST: 5492 SMLSLD_INST:
5493
5465 SMMLA_INST: 5494 SMMLA_INST:
5466 SMMLS_INST: 5495 SMMLS_INST:
5467 SMMUL_INST: 5496 SMMUL_INST:
5497 {
5498 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
5499 smlad_inst* const inst_cream = (smlad_inst*)inst_base->component;
5500
5501 const u32 rm_val = RM;
5502 const u32 rn_val = RN;
5503 const bool do_round = (inst_cream->m == 1);
5504
5505 // Assume SMMUL by default.
5506 s64 result = (s64)(s32)rn_val * (s64)(s32)rm_val;
5507
5508 if (inst_cream->Ra != 15) {
5509 const u32 ra_val = cpu->Reg[inst_cream->Ra];
5510
5511 // SMMLA, otherwise SMMLS
5512 if (BIT(inst_cream->op2, 1) == 0)
5513 result += ((s64)ra_val << 32);
5514 else
5515 result = ((s64)ra_val << 32) - result;
5516 }
5517
5518 if (do_round)
5519 result += 0x80000000;
5520
5521 RD = ((result >> 32) & 0xFFFFFFFF);
5522 }
5523
5524 cpu->Reg[15] += GET_INST_SIZE(cpu);
5525 INC_PC(sizeof(smlad_inst));
5526 FETCH_INST;
5527 GOTO_NEXT_INST;
5528 }
5468 5529
5469 SMUL_INST: 5530 SMUL_INST:
5470 { 5531 {