xref: /linux/arch/powerpc/math-emu/fmuls.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 #include "single.h"
85cd27208SKumar Gala 
95cd27208SKumar Gala int
105cd27208SKumar Gala fmuls(void *frD, void *frA, void *frB)
115cd27208SKumar Gala {
125cd27208SKumar Gala 	FP_DECL_D(A);
135cd27208SKumar Gala 	FP_DECL_D(B);
145cd27208SKumar Gala 	FP_DECL_D(R);
155cd27208SKumar Gala 	int ret = 0;
165cd27208SKumar Gala 
175cd27208SKumar Gala #ifdef DEBUG
18*e48b1b45SHarvey Harrison 	printk("%s: %p %p %p\n", __func__, frD, frA, frB);
195cd27208SKumar Gala #endif
205cd27208SKumar Gala 
215cd27208SKumar Gala 	__FP_UNPACK_D(A, frA);
225cd27208SKumar Gala 	__FP_UNPACK_D(B, frB);
235cd27208SKumar Gala 
245cd27208SKumar Gala #ifdef DEBUG
255cd27208SKumar Gala 	printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
265cd27208SKumar Gala 	       A_s, A_f1, A_f0, A_e, A_c, A_f1, A_f0, A_e + 1023);
275cd27208SKumar Gala 	printk("B: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
285cd27208SKumar Gala 	       B_s, B_f1, B_f0, B_e, B_c, B_f1, B_f0, B_e + 1023);
295cd27208SKumar Gala #endif
305cd27208SKumar Gala 
315cd27208SKumar Gala 	if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
325cd27208SKumar Gala 	    (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
335cd27208SKumar Gala 		ret |= EFLAG_VXIMZ;
345cd27208SKumar Gala 
355cd27208SKumar Gala 	FP_MUL_D(R, A, B);
365cd27208SKumar Gala 
375cd27208SKumar Gala #ifdef DEBUG
385cd27208SKumar Gala 	printk("D: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
395cd27208SKumar Gala 	       R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
405cd27208SKumar Gala #endif
415cd27208SKumar Gala 
425cd27208SKumar Gala 	return (ret | __FP_PACK_DS(frD, R));
435cd27208SKumar Gala }
44