1 /* SPDX-License-Identifier: GPL-2.0+
3 * Machine-dependent software floating-point definitions.
5 Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
6 This file is part of the GNU C Library.
7 Contributed by Richard Henderson (rth@cygnus.com),
8 Jakub Jelinek (jj@ultra.linux.cz),
9 David S. Miller (davem@redhat.com) and
10 Peter Maydell (pmaydell@chiark.greenend.org.uk).
13 #ifndef _SFP_MACHINE_H
14 #define _SFP_MACHINE_H
16 #define _FP_W_TYPE_SIZE 32
17 #define _FP_W_TYPE unsigned long
18 #define _FP_WS_TYPE signed long
19 #define _FP_I_TYPE long
21 #define _FP_MUL_MEAT_S(R,X,Y) \
22 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
23 #define _FP_MUL_MEAT_D(R,X,Y) \
24 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
25 #define _FP_MUL_MEAT_Q(R,X,Y) \
26 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
28 #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y)
29 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
30 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
32 #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
33 #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
34 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
35 #define _FP_NANSIGN_S 0
36 #define _FP_NANSIGN_D 0
37 #define _FP_NANSIGN_Q 0
39 #define _FP_KEEPNANFRACP 1
42 * If one NaN is signaling and the other is not,
43 * we choose that one, otherwise we choose X.
45 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
47 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
48 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
51 _FP_FRAC_COPY_##wc(R,Y); \
56 _FP_FRAC_COPY_##wc(R,X); \
61 //#define FP_ROUNDMODE FPSCR_RM
62 #define FP_DENORM_ZERO 1/*FPSCR_DN*/
64 /* Exception flags. */
65 #define FP_EX_INVALID (1<<4)
66 #define FP_EX_DIVZERO (1<<3)
67 #define FP_EX_OVERFLOW (1<<2)
68 #define FP_EX_UNDERFLOW (1<<1)
69 #define FP_EX_INEXACT (1<<0)