1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
25cd27208SKumar Gala #include <linux/types.h>
35cd27208SKumar Gala #include <linux/errno.h>
47c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
55cd27208SKumar Gala
6d2b194edSKumar Gala #include <asm/sfp-machine.h>
7d2b194edSKumar Gala #include <math-emu/soft-fp.h>
8d2b194edSKumar Gala #include <math-emu/double.h>
95cd27208SKumar Gala
105cd27208SKumar Gala int
fctiwz(u32 * frD,void * frB)115cd27208SKumar Gala fctiwz(u32 *frD, void *frB)
125cd27208SKumar Gala {
135cd27208SKumar Gala FP_DECL_D(B);
14d2b194edSKumar Gala FP_DECL_EX;
155cd27208SKumar Gala u32 fpscr;
165cd27208SKumar Gala unsigned int r;
175cd27208SKumar Gala
185cd27208SKumar Gala fpscr = __FPU_FPSCR;
195cd27208SKumar Gala __FPU_FPSCR &= ~(3);
205cd27208SKumar Gala __FPU_FPSCR |= FP_RND_ZERO;
215cd27208SKumar Gala
22d2b194edSKumar Gala FP_UNPACK_DP(B, frB);
235cd27208SKumar Gala FP_TO_INT_D(r, B, 32, 1);
245cd27208SKumar Gala frD[1] = r;
255cd27208SKumar Gala
265cd27208SKumar Gala __FPU_FPSCR = fpscr;
275cd27208SKumar Gala
285cd27208SKumar Gala #ifdef DEBUG
29e48b1b45SHarvey Harrison printk("%s: D %p, B %p: ", __func__, frD, frB);
305cd27208SKumar Gala dump_double(frD);
315cd27208SKumar Gala printk("\n");
325cd27208SKumar Gala #endif
335cd27208SKumar Gala
345cd27208SKumar Gala return 0;
355cd27208SKumar Gala }
36