xref: /linux/arch/powerpc/math-emu/fmuls.c (revision 7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba)
15cd27208SKumar Gala #include <linux/types.h>
25cd27208SKumar Gala #include <linux/errno.h>
3*7c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
45cd27208SKumar Gala 
5d2b194edSKumar Gala #include <asm/sfp-machine.h>
6d2b194edSKumar Gala #include <math-emu/soft-fp.h>
7d2b194edSKumar Gala #include <math-emu/double.h>
8d2b194edSKumar Gala #include <math-emu/single.h>
95cd27208SKumar Gala 
105cd27208SKumar Gala int
115cd27208SKumar Gala fmuls(void *frD, void *frA, void *frB)
125cd27208SKumar Gala {
135cd27208SKumar Gala 	FP_DECL_D(A);
145cd27208SKumar Gala 	FP_DECL_D(B);
155cd27208SKumar Gala 	FP_DECL_D(R);
16d2b194edSKumar Gala 	FP_DECL_EX;
175cd27208SKumar Gala 
185cd27208SKumar Gala #ifdef DEBUG
19e48b1b45SHarvey Harrison 	printk("%s: %p %p %p\n", __func__, frD, frA, frB);
205cd27208SKumar Gala #endif
215cd27208SKumar Gala 
22d2b194edSKumar Gala 	FP_UNPACK_DP(A, frA);
23d2b194edSKumar Gala 	FP_UNPACK_DP(B, frB);
245cd27208SKumar Gala 
255cd27208SKumar Gala #ifdef DEBUG
265cd27208SKumar Gala 	printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
275cd27208SKumar Gala 	       A_s, A_f1, A_f0, A_e, A_c, A_f1, A_f0, A_e + 1023);
285cd27208SKumar Gala 	printk("B: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
295cd27208SKumar Gala 	       B_s, B_f1, B_f0, B_e, B_c, B_f1, B_f0, B_e + 1023);
305cd27208SKumar Gala #endif
315cd27208SKumar Gala 
325cd27208SKumar Gala 	if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
335cd27208SKumar Gala 	    (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
34033b8a33SLiu Yu 		FP_SET_EXCEPTION(EFLAG_VXIMZ);
355cd27208SKumar Gala 
365cd27208SKumar Gala 	FP_MUL_D(R, A, B);
375cd27208SKumar Gala 
385cd27208SKumar Gala #ifdef DEBUG
395cd27208SKumar Gala 	printk("D: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
405cd27208SKumar Gala 	       R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
415cd27208SKumar Gala #endif
425cd27208SKumar Gala 
43d2b194edSKumar Gala 	__FP_PACK_DS(frD, R);
44d2b194edSKumar Gala 
45d2b194edSKumar Gala 	return FP_CUR_EXCEPTIONS;
465cd27208SKumar Gala }
47