xref: /linux/arch/powerpc/math-emu/fctiwz.c (revision e48b1b452ff630288c930fd8e0c2d808bc15f7ad)
15cd27208SKumar Gala #include <linux/types.h>
25cd27208SKumar Gala #include <linux/errno.h>
35cd27208SKumar Gala #include <asm/uaccess.h>
45cd27208SKumar Gala 
55cd27208SKumar Gala #include "soft-fp.h"
65cd27208SKumar Gala #include "double.h"
75cd27208SKumar Gala 
85cd27208SKumar Gala int
95cd27208SKumar Gala fctiwz(u32 *frD, void *frB)
105cd27208SKumar Gala {
115cd27208SKumar Gala 	FP_DECL_D(B);
125cd27208SKumar Gala 	u32 fpscr;
135cd27208SKumar Gala 	unsigned int r;
145cd27208SKumar Gala 
155cd27208SKumar Gala 	fpscr = __FPU_FPSCR;
165cd27208SKumar Gala 	__FPU_FPSCR &= ~(3);
175cd27208SKumar Gala 	__FPU_FPSCR |= FP_RND_ZERO;
185cd27208SKumar Gala 
195cd27208SKumar Gala 	__FP_UNPACK_D(B, frB);
205cd27208SKumar Gala 	FP_TO_INT_D(r, B, 32, 1);
215cd27208SKumar Gala 	frD[1] = r;
225cd27208SKumar Gala 
235cd27208SKumar Gala 	__FPU_FPSCR = fpscr;
245cd27208SKumar Gala 
255cd27208SKumar Gala #ifdef DEBUG
26*e48b1b45SHarvey Harrison 	printk("%s: D %p, B %p: ", __func__, frD, frB);
275cd27208SKumar Gala 	dump_double(frD);
285cd27208SKumar Gala 	printk("\n");
295cd27208SKumar Gala #endif
305cd27208SKumar Gala 
315cd27208SKumar Gala 	return 0;
325cd27208SKumar Gala }
33