s_lroundf.S 781 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Round argument toward 0. SH4 version.
  2. * According to ISO/IEC 9899:1999. This version doesn't handle range error.
  3. * If arg is not finite or if the result cannot be represented into a long,
  4. * return an unspecified value. No exception raised.
  5. *
  6. * Copyright (C) 2010 STMicroelectronics Ltd.
  7. *
  8. * Author: Christian Bruel <christian.bruel@st.com>
  9. *
  10. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  11. */
  12. #include <sysdep.h>
  13. ENTRY(lroundf)
  14. mov #0,r0
  15. sts fpscr,r3
  16. lds r0,fpscr
  17. flds fr5,fpul
  18. mov.l LOCAL(mask),r1
  19. sts fpul,r2
  20. and r2,r1
  21. mov.l LOCAL(midway),r2
  22. or r1,r2
  23. lds r2,fpul
  24. fsts fpul,fr2
  25. fadd fr2,fr5
  26. ftrc fr5,fpul
  27. sts fpul,r0
  28. rts
  29. lds r3,fpscr
  30. .align 2
  31. LOCAL(mask):
  32. .long 0x80000000
  33. LOCAL(midway):
  34. .long 1056964608
  35. END(lroundf)