smindi3.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ; Copyright (C) 2017-2022 Free Software Foundation, Inc.
  2. ; Contributed by Sebastian Perta.
  3. ;
  4. ; This file is free software; you can redistribute it and/or modify it
  5. ; under the terms of the GNU General Public License as published by the
  6. ; Free Software Foundation; either version 3, or (at your option) any
  7. ; later version.
  8. ;
  9. ; This file is distributed in the hope that it will be useful, but
  10. ; WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. ; General Public License for more details.
  13. ;
  14. ; Under Section 7 of GPL version 3, you are granted additional
  15. ; permissions described in the GCC Runtime Library Exception, version
  16. ; 3.1, as published by the Free Software Foundation.
  17. ;
  18. ; You should have received a copy of the GNU General Public License and
  19. ; a copy of the GCC Runtime Library Exception along with this program;
  20. ; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  21. ; <http://www.gnu.org/licenses/>.
  22. #include "vregs.h"
  23. .text
  24. START_FUNC ___smindi3
  25. ; copy first argument/operand to the output registers
  26. movw ax, [sp+4]
  27. movw r8, ax
  28. movw ax, [sp+6]
  29. movw r10, ax
  30. movw ax, [sp+8]
  31. movw r12, ax
  32. movw ax, [sp+10]
  33. movw r14, ax
  34. ; use 16-bit compares from the most significant words downto the least significant ones
  35. movw ax, [sp+18]
  36. cmpw ax, r14
  37. xor1 CY, a.7 ; first compare accounts for the
  38. xor1 CY, r15.7 ; sign bits of the two operands
  39. bc $.L1
  40. bnz $.L2
  41. movw ax, [sp+16]
  42. cmpw ax, r12
  43. bc $.L1
  44. bnz $.L2
  45. movw ax, [sp+14]
  46. cmpw ax, r10
  47. bc $.L1
  48. bnz $.L2
  49. movw ax, [sp+12]
  50. cmpw ax, r8
  51. bc $.L1
  52. ret
  53. .L1:
  54. ; copy second argument/operand to the output registers
  55. movw ax, [sp+12]
  56. movw r8, ax
  57. movw ax, [sp+14]
  58. movw r10, ax
  59. movw ax, [sp+16]
  60. movw r12, ax
  61. movw ax, [sp+18]
  62. movw r14, ax
  63. .L2:
  64. ret
  65. END_FUNC ___smindi3