all repos — mgba @ 86c228f2e4b16df681658cb2d52b0cf1d5fe19ab

mGBA Game Boy Advance Emulator

Implement SMLAL
Jeffrey Pfau jeffrey@endrift.com
Thu, 02 May 2013 00:29:06 -0700
commit

86c228f2e4b16df681658cb2d52b0cf1d5fe19ab

parent

a80175e689bd30109e6db062b8d3968824febab7

1 files changed, 9 insertions(+), 2 deletions(-)

jump to
M src/arm/isa-arm.csrc/arm/isa-arm.c

@@ -587,8 +587,15 @@ // Begin multiply definitions

DEFINE_MULTIPLY_INSTRUCTION_ARM(MLA, cpu->gprs[rdHi] = cpu->gprs[rm] * cpu->gprs[rs] + cpu->gprs[rd], ARM_NEUTRAL_S(, , cpu->gprs[rdHi])) DEFINE_MULTIPLY_INSTRUCTION_ARM(MUL, cpu->gprs[rdHi] = cpu->gprs[rm] * cpu->gprs[rs], ARM_NEUTRAL_S(cpu->gprs[rm], cpu->gprs[rs], cpu->gprs[rd])) -DEFINE_INSTRUCTION_ARM(SMLAL, ARM_STUB) -DEFINE_INSTRUCTION_ARM(SMLALS, ARM_STUB) + +DEFINE_MULTIPLY_INSTRUCTION_ARM(SMLAL, + int64_t d = ((int64_t) cpu->gprs[rm]) * ((int64_t) cpu->gprs[rs]); + int32_t dm = cpu->gprs[rd]; + int32_t dn = d; + cpu->gprs[rd] = dm + dn; + cpu->gprs[rdHi] = cpu->gprs[rdHi] + (d >> 32) + ARM_CARRY_FROM(dm, dn, cpu->gprs[rd]);, + ARM_NEUTRAL_HI_S(cpu->gprs[rd], cpu->gprs[rdHi])) + DEFINE_MULTIPLY_INSTRUCTION_ARM(SMULL, int64_t d = ((int64_t) cpu->gprs[rm]) * ((int64_t) cpu->gprs[rs]); cpu->gprs[rd] = d;