fctiwz.c 535 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <linux/types.h>
  2. #include <linux/errno.h>
  3. #include <asm/uaccess.h>
  4. #include <asm/sfp-machine.h>
  5. #include <math-emu/soft-fp.h>
  6. #include <math-emu/double.h>
  7. int
  8. fctiwz(u32 *frD, void *frB)
  9. {
  10. FP_DECL_D(B);
  11. FP_DECL_EX;
  12. u32 fpscr;
  13. unsigned int r;
  14. fpscr = __FPU_FPSCR;
  15. __FPU_FPSCR &= ~(3);
  16. __FPU_FPSCR |= FP_RND_ZERO;
  17. FP_UNPACK_DP(B, frB);
  18. FP_TO_INT_D(r, B, 32, 1);
  19. frD[1] = r;
  20. __FPU_FPSCR = fpscr;
  21. #ifdef DEBUG
  22. printk("%s: D %p, B %p: ", __func__, frD, frB);
  23. dump_double(frD);
  24. printk("\n");
  25. #endif
  26. return 0;
  27. }