1 /* Machine-dependent software floating-point definitions.  ARC version.
2    Copyright (C) 2020-2022 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 
20 #define _FP_W_TYPE_SIZE		32
21 #define _FP_W_TYPE		unsigned long
22 #define _FP_WS_TYPE		signed long
23 #define _FP_I_TYPE		long
24 
25 #define _FP_MUL_MEAT_S(R,X,Y)				\
26   _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
27 #define _FP_MUL_MEAT_D(R,X,Y)				\
28   _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
29 #define _FP_MUL_MEAT_Q(R,X,Y)				\
30   _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
31 
32 #define _FP_MUL_MEAT_DW_S(R,X,Y)				\
33   _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
34 #define _FP_MUL_MEAT_DW_D(R,X,Y)				\
35   _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
36 #define _FP_MUL_MEAT_DW_Q(R,X,Y)				\
37   _FP_MUL_MEAT_DW_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
38 
39 #define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_loop(S,R,X,Y)
40 #define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
41 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
42 
43 #define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
44 #define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
45 #define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
46 #define _FP_NANSIGN_S		0
47 #define _FP_NANSIGN_D		0
48 #define _FP_NANSIGN_Q		0
49 
50 #define _FP_KEEPNANFRACP 1
51 #define _FP_QNANNEGATEDP 0
52 
53 /* This is arbitrarily taken from the PowerPC version.  */
54 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
55   do {								\
56     if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)		\
57 	&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs))	\
58       {								\
59 	R##_s = Y##_s;						\
60 	_FP_FRAC_COPY_##wc(R,Y);				\
61       }								\
62     else							\
63       {								\
64 	R##_s = X##_s;						\
65 	_FP_FRAC_COPY_##wc(R,X);				\
66       }								\
67     R##_c = FP_CLS_NAN;						\
68   } while (0)
69 
70 #define _FP_TININESS_AFTER_ROUNDING 1
71