muldi3.S 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ! Copyright (C) 2012 by Imagination Technologies Ltd.
  2. !
  3. ! 64-bit multiply routine.
  4. !
  5. !
  6. ! 64-bit signed/unsigned multiply
  7. !
  8. ! A = D1Ar1:D0Ar2 = a 2^48 + b 2^32 + c 2^16 + d 2^0
  9. !
  10. ! B = D1Ar3:D0Ar4 = w 2^48 + x 2^32 + y 2^16 + z 2^0
  11. !
  12. .text
  13. .global ___muldi3
  14. .type ___muldi3,function
  15. ___muldi3:
  16. MULD D1Re0,D1Ar1,D0Ar4 ! (a 2^48 + b 2^32)(y 2^16 + z 2^0)
  17. MULD D0Re0,D0Ar2,D1Ar3 ! (w 2^48 + x 2^32)(c 2^16 + d 2^0)
  18. ADD D1Re0,D1Re0,D0Re0
  19. MULW D0Re0,D0Ar2,D0Ar4 ! (d 2^0) * (z 2^0)
  20. RTDW D0Ar2,D0Ar2
  21. MULW D0Ar6,D0Ar2,D0Ar4 ! (c 2^16)(z 2^0)
  22. LSR D1Ar5,D0Ar6,#16
  23. LSL D0Ar6,D0Ar6,#16
  24. ADDS D0Re0,D0Re0,D0Ar6
  25. ADDCS D1Re0,D1Re0,#1
  26. RTDW D0Ar4,D0Ar4
  27. ADD D1Re0,D1Re0,D1Ar5
  28. MULW D0Ar6,D0Ar2,D0Ar4 ! (c 2^16)(y 2^16)
  29. ADD D1Re0,D1Re0,D0Ar6
  30. RTDW D0Ar2,D0Ar2
  31. MULW D0Ar6,D0Ar2,D0Ar4 ! (d 2^0)(y 2^16)
  32. LSR D1Ar5,D0Ar6,#16
  33. LSL D0Ar6,D0Ar6,#16
  34. ADDS D0Re0,D0Re0,D0Ar6
  35. ADD D1Re0,D1Re0,D1Ar5
  36. ADDCS D1Re0,D1Re0,#1
  37. MOV PC, D1RtP
  38. .size ___muldi3,.-___muldi3