Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. Umul/Smul

    Affected Flags
    C V N Z
    X
    X
    X

    umul : unsigned integer multiplication
    smul : signed integer multiplication

    The Umul and Smul instruction does integer multiplication. The Umul instruction is for unsigned numbers. The smul is for signed numbers. The result of the multiplications are always the double the size of the source operands.
    Warning : In the long form, the result of the multiplication of two 32 bit registers is a 64 bit result. In this case, the first 32 bits are put in the destination register and the last 32 bits are put in the register following the destination register. So, with the instruction mul.l r0,r1 the result will be in r1 and r2.

    Forms and variants

    rx = Destination register
    rx2 = Register following the destination register.
    ry = Source register

    Form Effect
    umul.b ry,rx
    rx.w = rx.b * ry.b
    umul.w ry,rx
    rx.l = rx.w * ry.w
    umul.l ry,rx
    [rx.l-rx2.l] = rx.l * ry.l
    smul.b ry,rx
    rx.w = rx.b * ry.b
    smul.w ry,rx
    rx.l = rx.w * ry.w
    smul.l ry,rx
    [rx.l-rx2.l] = rx.l * ry.l

    Instruction encoding

    D = Working Register
    
    Instruction Op
    Code
    Cycles Encoding
    umul.b ry,rx 18 150 00011000 SSSSDDDD
    umul.w ry,rx 58 150 01011000 SSSSDDDD
    umul.l ry,rx 98 150 10011000 SSSSDDDD
    smul.b ry,rx 19 150 00011001 SSSSDDDD
    smul.w ry,rx 59 150 01011001 SSSSDDDD
    smul.l ry,rx 99 150 10011001 SSSSDDDD

    Code Examples

    // Example : Todo
    
    
              
     
     
  2. Google+