Home | History | Annotate | Download | only in armv5te
      1     /*
      2      * Signed 64-bit integer multiply.
      3      *
      4      * For JIT: op1 in r0/r1, op2 in r2/r3, return in r0/r1
      5      *
      6      * Consider WXxYZ (r1r0 x r3r2) with a long multiply:
      7      *        WX
      8      *      x YZ
      9      *  --------
     10      *     ZW ZX
     11      *  YW YX
     12      *
     13      * The low word of the result holds ZX, the high word holds
     14      * (ZW+YX) + (the high overflow from ZX).  YW doesn't matter because
     15      * it doesn't fit in the low 64 bits.
     16      *
     17      * Unlike most ARM math operations, multiply instructions have
     18      * restrictions on using the same register more than once (Rd and Rm
     19      * cannot be the same).
     20      */
     21     /* mul-long vAA, vBB, vCC */
     22     mul     ip, r2, r1                  @  ip<- ZxW
     23     umull   r9, r10, r2, r0             @  r9/r10 <- ZxX
     24     mla     r2, r0, r3, ip              @  r2<- YxX + (ZxW)
     25     add     r10, r2, r10                @  r10<- r10 + low(ZxW + (YxX))
     26     mov     r0,r9
     27     mov     r1,r10
     28     bx      lr
     29