__lshrdi3.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* MN10300 64-bit logical right shift
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #include <asm/cache.h>
  12. .text
  13. .balign L1_CACHE_BYTES
  14. ###############################################################################
  15. #
  16. # unsigned long long __lshrdi3(unsigned long long value [D1:D0],
  17. # unsigned by [(12,SP)])
  18. #
  19. ###############################################################################
  20. .globl __lshrdi3
  21. .type __lshrdi3,@function
  22. __lshrdi3:
  23. mov (12,sp),a0
  24. and +63,a0
  25. beq __lshrdi3_zero
  26. cmp +31,a0
  27. bhi __lshrdi3_32plus
  28. # the count is in the range 1-31
  29. lsr a0,d0
  30. mov +32,a1
  31. sub a0,a1,a1 # a1 = 32 - count
  32. asl a1,d1,a1 # get underflow from MSW -> LSW
  33. or_lsr a1,d0,a0,d1 # insert underflow into LSW and
  34. # shift the MSW
  35. rets
  36. .balign L1_CACHE_BYTES
  37. # the count is in the range 32-63
  38. __lshrdi3_32plus:
  39. lsr a0,d1,d0
  40. clr d1
  41. __lshrdi3_zero:
  42. rets
  43. .size __lshrdi3, .-__lshrdi3