blob: 71e782fd4fe35b13a2d1e1b77d6f8b7f32855738 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
Kumar Galad2b194e2008-06-04 02:59:29 -05005#include <asm/sfp-machine.h>
6#include <math-emu/soft-fp.h>
7#include <math-emu/double.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9int
10fctiwz(u32 *frD, void *frB)
11{
12 FP_DECL_D(B);
Kumar Galad2b194e2008-06-04 02:59:29 -050013 FP_DECL_EX;
Linus Torvalds1da177e2005-04-16 15:20:36 -070014 u32 fpscr;
15 unsigned int r;
16
17 fpscr = __FPU_FPSCR;
18 __FPU_FPSCR &= ~(3);
19 __FPU_FPSCR |= FP_RND_ZERO;
20
Kumar Galad2b194e2008-06-04 02:59:29 -050021 FP_UNPACK_DP(B, frB);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 FP_TO_INT_D(r, B, 32, 1);
23 frD[1] = r;
24
25 __FPU_FPSCR = fpscr;
26
27#ifdef DEBUG
Harvey Harrisone48b1b42008-03-29 08:21:07 +110028 printk("%s: D %p, B %p: ", __func__, frD, frB);
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 dump_double(frD);
30 printk("\n");
31#endif
32
33 return 0;
34}