xref: /linux/arch/powerpc/math-emu/fmuls.c (revision 5cd272085bbc905532869f3e1fd18a7100496b56)
1*5cd27208SKumar Gala #include <linux/types.h>
2*5cd27208SKumar Gala #include <linux/errno.h>
3*5cd27208SKumar Gala #include <asm/uaccess.h>
4*5cd27208SKumar Gala 
5*5cd27208SKumar Gala #include "soft-fp.h"
6*5cd27208SKumar Gala #include "double.h"
7*5cd27208SKumar Gala #include "single.h"
8*5cd27208SKumar Gala 
9*5cd27208SKumar Gala int
10*5cd27208SKumar Gala fmuls(void *frD, void *frA, void *frB)
11*5cd27208SKumar Gala {
12*5cd27208SKumar Gala 	FP_DECL_D(A);
13*5cd27208SKumar Gala 	FP_DECL_D(B);
14*5cd27208SKumar Gala 	FP_DECL_D(R);
15*5cd27208SKumar Gala 	int ret = 0;
16*5cd27208SKumar Gala 
17*5cd27208SKumar Gala #ifdef DEBUG
18*5cd27208SKumar Gala 	printk("%s: %p %p %p\n", __FUNCTION__, frD, frA, frB);
19*5cd27208SKumar Gala #endif
20*5cd27208SKumar Gala 
21*5cd27208SKumar Gala 	__FP_UNPACK_D(A, frA);
22*5cd27208SKumar Gala 	__FP_UNPACK_D(B, frB);
23*5cd27208SKumar Gala 
24*5cd27208SKumar Gala #ifdef DEBUG
25*5cd27208SKumar Gala 	printk("A: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
26*5cd27208SKumar Gala 	       A_s, A_f1, A_f0, A_e, A_c, A_f1, A_f0, A_e + 1023);
27*5cd27208SKumar Gala 	printk("B: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
28*5cd27208SKumar Gala 	       B_s, B_f1, B_f0, B_e, B_c, B_f1, B_f0, B_e + 1023);
29*5cd27208SKumar Gala #endif
30*5cd27208SKumar Gala 
31*5cd27208SKumar Gala 	if ((A_c == FP_CLS_INF && B_c == FP_CLS_ZERO) ||
32*5cd27208SKumar Gala 	    (A_c == FP_CLS_ZERO && B_c == FP_CLS_INF))
33*5cd27208SKumar Gala 		ret |= EFLAG_VXIMZ;
34*5cd27208SKumar Gala 
35*5cd27208SKumar Gala 	FP_MUL_D(R, A, B);
36*5cd27208SKumar Gala 
37*5cd27208SKumar Gala #ifdef DEBUG
38*5cd27208SKumar Gala 	printk("D: %ld %lu %lu %ld (%ld) [%08lx.%08lx %lx]\n",
39*5cd27208SKumar Gala 	       R_s, R_f1, R_f0, R_e, R_c, R_f1, R_f0, R_e + 1023);
40*5cd27208SKumar Gala #endif
41*5cd27208SKumar Gala 
42*5cd27208SKumar Gala 	return (ret | __FP_PACK_DS(frD, R));
43*5cd27208SKumar Gala }
44