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