__ucmpdi2.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* __ucmpdi2.S: 64-bit unsigned compare
  2. *
  3. * Copyright (C) 2008 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 License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. .text
  12. .p2align 4
  13. ###############################################################################
  14. #
  15. # int __ucmpdi2(unsigned long long a [D0:D1],
  16. # unsigned long long b [(SP,12),(SP,16)])
  17. #
  18. # - returns 0, 1, or 2 as a <, =, > b respectively.
  19. #
  20. ###############################################################################
  21. .globl __ucmpdi2
  22. .type __ucmpdi2,@function
  23. __ucmpdi2:
  24. mov (12,sp),a0 # b.lsw
  25. mov (16,sp),a1 # b.msw
  26. sub a0,d0
  27. subc a1,d1 # may clear Z, never sets it
  28. bne __ucmpdi2_differ # a.msw != b.msw
  29. mov +1,d0
  30. rets
  31. __ucmpdi2_differ:
  32. # C flag is set if LE, clear if GE
  33. subc d0,d0 # -1 if LE, 0 if GE
  34. add +1,d0 # 0 if LE, 1 if GE
  35. add d0,d0 # 0 if LE, 2 if GE
  36. rets
  37. .size __ucmpdi2, .-__ucmpdi2