umodsi3.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * libgcc1 routines for Blackfin 5xx
  3. *
  4. * Copyright 2004-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the Clear BSD license or the GPL-2 (or later)
  7. */
  8. #ifdef CONFIG_ARITHMETIC_OPS_L1
  9. .section .l1.text
  10. #else
  11. .text
  12. #endif
  13. .extern ___udivsi3;
  14. .type ___udivsi3, STT_FUNC;
  15. .globl ___umodsi3
  16. .type ___umodsi3, STT_FUNC;
  17. ___umodsi3:
  18. CC=R0==0;
  19. IF CC JUMP .LRETURN_R0; /* Return 0, if NR == 0 */
  20. CC= R1==0;
  21. IF CC JUMP .LRETURN_ZERO_VAL; /* Return 0, if DR == 0 */
  22. CC=R0==R1;
  23. IF CC JUMP .LRETURN_ZERO_VAL; /* Return 0, if NR == DR */
  24. CC = R1 == 1;
  25. IF CC JUMP .LRETURN_ZERO_VAL; /* Return 0, if DR == 1 */
  26. CC = R0<R1 (IU);
  27. IF CC JUMP .LRETURN_R0; /* Return dividend (R0),IF NR<DR */
  28. [--SP] = (R7:6); /* Push registers and */
  29. [--SP] = RETS; /* Return address */
  30. R7 = R0; /* Copy of R0 */
  31. R6 = R1;
  32. SP += -12; /* Should always provide this space */
  33. CALL ___udivsi3; /* Compute unsigned quotient using ___udiv32()*/
  34. SP += 12;
  35. R0 *= R6; /* Quotient * divisor */
  36. R0 = R7 - R0; /* Dividend - (quotient * divisor) */
  37. RETS = [SP++]; /* Pop return address */
  38. ( R7:6) = [SP++]; /* And registers */
  39. RTS; /* Return remainder */
  40. .LRETURN_ZERO_VAL:
  41. R0 = 0;
  42. .LRETURN_R0:
  43. RTS;
  44. .size ___umodsi3, .-___umodsi3