summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-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 5f09d8580..a37e6c94e 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -2358,13 +2358,41 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smlal)(unsigned int inst, int index)
2358 inst_base->load_r15 = 1; 2358 inst_base->load_r15 = 1;
2359 return inst_base; 2359 return inst_base;
2360} 2360}
2361
2361ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); } 2362ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); }
2362ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); } 2363ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALD"); }
2363ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); } 2364ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); }
2364ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); } 2365ARM_INST_PTR INTERPRETER_TRANSLATE(smlsld)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLSLD"); }
2365ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLA"); } 2366
2366ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMLS"); } 2367ARM_INST_PTR INTERPRETER_TRANSLATE(smmla)(unsigned int inst, int index)
2367ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMMUL"); } 2368{
2369 arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(smlad_inst));
2370 smlad_inst* const inst_cream = (smlad_inst*)inst_base->component;
2371
2372 inst_base->cond = BITS(inst, 28, 31);
2373 inst_base->idx = index;
2374 inst_base->br = NON_BRANCH;
2375 inst_base->load_r15 = 0;
2376
2377 inst_cream->m = BIT(inst, 5);
2378 inst_cream->Ra = BITS(inst, 12, 15);
2379 inst_cream->Rm = BITS(inst, 8, 11);
2380 inst_cream->Rn = BITS(inst, 0, 3);
2381 inst_cream->Rd = BITS(inst, 16, 19);
2382 inst_cream->op1 = BITS(inst, 20, 22);
2383 inst_cream->op2 = BITS(inst, 5, 7);
2384
2385 return inst_base;
2386}
2387ARM_INST_PTR INTERPRETER_TRANSLATE(smmls)(unsigned int inst, int index)
2388{
2389 return INTERPRETER_TRANSLATE(smmla)(inst, index);
2390}
2391ARM_INST_PTR INTERPRETER_TRANSLATE(smmul)(unsigned int inst, int index)
2392{
2393 return INTERPRETER_TRANSLATE(smmla)(inst, index);
2394}
2395
2368ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index) 2396ARM_INST_PTR INTERPRETER_TRANSLATE(smul)(unsigned int inst, int index)
2369{ 2397{
2370 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst)); 2398 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(smul_inst));
@@ -5494,9 +5522,42 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
5494 SMLALD_INST: 5522 SMLALD_INST:
5495 SMLAW_INST: 5523 SMLAW_INST:
5496 SMLSLD_INST: 5524 SMLSLD_INST:
5525
5497 SMMLA_INST: 5526 SMMLA_INST:
5498 SMMLS_INST: 5527 SMMLS_INST:
5499 SMMUL_INST: 5528 SMMUL_INST:
5529 {
5530 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
5531 smlad_inst* const inst_cream = (smlad_inst*)inst_base->component;
5532
5533 const u32 rm_val = RM;
5534 const u32 rn_val = RN;
5535 const bool do_round = (inst_cream->m == 1);
5536
5537 // Assume SMMUL by default.
5538 s64 result = (s64)(s32)rn_val * (s64)(s32)rm_val;
5539
5540 if (inst_cream->Ra != 15) {
5541 const u32 ra_val = cpu->Reg[inst_cream->Ra];
5542
5543 // SMMLA, otherwise SMMLS
5544 if (BIT(inst_cream->op2, 1) == 0)
5545 result += ((s64)ra_val << 32);
5546 else
5547 result = ((s64)ra_val << 32) - result;
5548 }
5549
5550 if (do_round)
5551 result += 0x80000000;
5552
5553 RD = ((result >> 32) & 0xFFFFFFFF);
5554 }
5555
5556 cpu->Reg[15] += GET_INST_SIZE(cpu);
5557 INC_PC(sizeof(smlad_inst));
5558 FETCH_INST;
5559 GOTO_NEXT_INST;
5560 }
5500 5561
5501 SMUL_INST: 5562 SMUL_INST:
5502 { 5563 {