div64.S 547 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * unsigned long __xdiv64_32(unsigned long long n, unsigned long d);
  3. */
  4. #include <linux/linkage.h>
  5. .text
  6. ENTRY(__xdiv64_32)
  7. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  8. mov r4, r0
  9. mov r5, r1
  10. #else
  11. mov r4, r1
  12. mov r5, r0
  13. #endif
  14. cmp/hs r6, r1
  15. bf.s 1f
  16. mov #0, r2
  17. mov r1, r2
  18. mov #0, r3
  19. div0u
  20. .rept 32
  21. rotcl r2
  22. div1 r6, r3
  23. .endr
  24. rotcl r2
  25. mul.l r6, r2
  26. sts macl, r3
  27. sub r3, r1
  28. 1:
  29. div0u
  30. .rept 32
  31. rotcl r0
  32. div1 r6, r1
  33. .endr
  34. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  35. mov r2, r1
  36. rts
  37. rotcl r0
  38. #else
  39. rotcl r0
  40. mov r0, r1
  41. rts
  42. mov r2, r0
  43. #endif