signbit.S 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ; Copyright (C) 2012-2022 Free Software Foundation, Inc.
  2. ; Contributed by Red Hat.
  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. ;; int signbitf (float X)
  24. ;; int signbit (double X)
  25. ;; int signbitl (long double X)
  26. ;;
  27. ;; `signbit' returns a nonzero value if the value of X has its sign
  28. ;; bit set.
  29. ;;
  30. ;; This is not the same as `x < 0.0', because IEEE 754 floating point
  31. ;; allows zero to be signed. The comparison `-0.0 < 0.0' is false,
  32. ;; but `signbit (-0.0)' will return a nonzero value.
  33. ;----------------------------------------------------------------------
  34. .text
  35. START_FUNC _signbit
  36. START_ANOTHER_FUNC _signbitf
  37. ;; X is at [sp+4]..[SP+7]
  38. ;; result is in R8..R9
  39. movw r8, #0
  40. mov a, [sp+7]
  41. mov1 cy, a.7
  42. sknc
  43. movw r8, #1
  44. ret
  45. END_ANOTHER_FUNC _signbitf
  46. END_FUNC _signbit
  47. START_FUNC _signbitl
  48. ;; X is at [sp+4]..[SP+7]
  49. ;; result is in R8..R9
  50. movw r8, #0
  51. mov a, [sp+11]
  52. mov1 cy, a.7
  53. sknc
  54. movw r8, #1
  55. ret
  56. END_FUNC _signbitl