xref: /openbmc/linux/arch/alpha/math-emu/sfp-util.h (revision f3539c12)
1 #include <linux/kernel.h>
2 #include <linux/sched.h>
3 #include <linux/types.h>
4 #include <asm/byteorder.h>
5 #include <asm/fpu.h>
6 
7 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
8   ((sl) = (al) + (bl), (sh) = (ah) + (bh) + ((sl) < (al)))
9 
10 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
11   ((sl) = (al) - (bl), (sh) = (ah) - (bh) - ((al) < (bl)))
12 
13 #define umul_ppmm(wh, wl, u, v)			\
14   __asm__ ("mulq %2,%3,%1; umulh %2,%3,%0"	\
15 	   : "=r" ((UDItype)(wh)),		\
16 	     "=&r" ((UDItype)(wl))		\
17 	   : "r" ((UDItype)(u)),		\
18 	     "r" ((UDItype)(v)))
19 
20 #define udiv_qrnnd(q, r, n1, n0, d)				\
21   do { unsigned long __r;					\
22     (q) = __udiv_qrnnd (&__r, (n1), (n0), (d));			\
23     (r) = __r;							\
24   } while (0)
25 extern unsigned long __udiv_qrnnd (unsigned long *, unsigned long,
26 				   unsigned long , unsigned long);
27 
28 #define UDIV_NEEDS_NORMALIZATION 1
29 
30 #define abort()			goto bad_insn
31 
32 #ifndef __LITTLE_ENDIAN
33 #define __LITTLE_ENDIAN -1
34 #endif
35 #define __BYTE_ORDER __LITTLE_ENDIAN
36