ARM application development SDK for MNT ZZ9000 graphics and coprocessor card for classic Amiga computers.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ulcmp.S 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Runtime ABI for the ARM Cortex-M0
  2. * ulcmp.S: unsigned 64 bit comparison
  3. *
  4. * Copyright (c) 2017 Jörg Mische <bobbl@gmx.de>
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  16. * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. .syntax unified
  19. .text
  20. .thumb
  21. .cpu cortex-m0
  22. @ int __aeabi_ulcmp(unsigned long long r1:r0, unsigned long long r3:r2)
  23. @
  24. @ Compare unsigned integers and return -1 if lower, 0 if equal or +1 if greater
  25. @
  26. .thumb_func
  27. .global __aeabi_ulcmp
  28. __aeabi_ulcmp:
  29. cmp r1, r3
  30. blo 1f @ cc
  31. bhi 2f
  32. cmp r0, r2
  33. blo 1f
  34. bhi 2f
  35. eors r0, r0
  36. bx lr
  37. 1: movs r0, #1
  38. rsbs r0, r0, #0
  39. bx lr
  40. 2: movs r0, #1
  41. bx lr
  42. cmp r1, r3
  43. blo 1f
  44. bhi 2f
  45. cmp r0, r2
  46. bhi 2f
  47. 1: sbcs r0, r0, r0 @ 0 if cs and -1 if cc
  48. bx lr
  49. 2: movs r0, #1
  50. bx lr