s_truncf.S 649 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Based on code written by J.T. Conklin <[email protected]>.
  3. * Public domain.
  4. */
  5. #include <i387/bsd_asm.h>
  6. //__FBSDID("$FreeBSD: src/lib/msun/i387/s_truncf.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
  7. ENTRY(truncf)
  8. pushl %ebp
  9. movl %esp,%ebp
  10. subl $8,%esp
  11. fstcw -4(%ebp) /* store fpu control word */
  12. movw -4(%ebp),%dx
  13. orw $0x0c00,%dx /* round towards -oo */
  14. movw %dx,-8(%ebp)
  15. fldcw -8(%ebp) /* load modfied control word */
  16. flds 8(%ebp) /* round */
  17. frndint
  18. fldcw -4(%ebp) /* restore original control word */
  19. leave
  20. ret
  21. END(truncf)
  22. /* Enable stack protection */
  23. #if defined(__ELF__)
  24. .section .note.GNU-stack,"",%progbits
  25. #endif