ARM: Introduction to ARM: Multiply Instructions

by David Thomas on

32×32→32 Multiply Instructions

<operation>{cond}{S} Rd, Rm, Rs {, Rn}

<operation>

  • MULMultiply
    • Rd := Rm × Rs
  • MLAMultiply with Accumulate
    • Rd := Rn + (Rm × Rs)

The multiply instructions produce the same result for both signed and unsigned values.

Specifying the same register for Rm and Rs has UNPREDICTABLE results. UNPREDICTABLE means that the result of an instruction cannot be relied upon.

32×32→64 Multiply Instructions

<operation>{cond}{S} RdLo, RdHi, Rm, Rs

64-bit result output into two registers.

<operation>

  • UMULLUnsigned Multiply Long
    • RdHi, RdLo := Rm × Rs
  • UMLALUnsigned Multiply with Accumlate Long
    • RdHi, RdLo := RdHi,RdLo + (Rm × Rs)
  • SMULLSigned Multiply Long
    • RdHi, RdLo := Rm × Rs
  • SMLALSigned Multiply with Accumlate Long
    • RdHi, RdLo := RdHi,RdLo + (Rm × Rs)

Note that they have the same form, but they treat the sign bit differently.

Navigate