1 /* Machine settings for software floating-point emulation
2 of Andes NDS32 cpu for GNU compiler
3 Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 Contributed by Andes Technology Corporation.
6 This file is part of GNU C Library.
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
13 In addition to the permissions in the GNU Lesser General Public
14 License, the Free Software Foundation gives you unlimited
15 permission to link the compiled version of this file into
16 combinations with other programs, and to distribute those
17 combinations without any restriction coming from the use of this
18 file. (The Lesser General Public License restrictions do apply in
19 other respects; for example, they cover modification of the file,
20 and distribution when not linked into a combine executable.)
22 The GNU C Library is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 Lesser General Public License for more details.
27 You should have received a copy of the GNU Lesser General Public
28 License along with the GNU C Library; if not, see
29 <http://www.gnu.org/licenses/>. */
31 #define _FP_W_TYPE_SIZE 32
32 #define _FP_W_TYPE unsigned long
33 #define _FP_WS_TYPE signed long
34 #define _FP_I_TYPE long
36 /* The type of the result of a floating point comparison. This must
37 match `__libgcc_cmp_return__' in GCC for the target. */
38 typedef int __gcc_CMPtype
__attribute__ ((mode (__libgcc_cmp_return__
)));
39 #define CMPtype __gcc_CMPtype
41 #define _FP_MUL_MEAT_S(R,X,Y) \
42 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
43 #define _FP_MUL_MEAT_D(R,X,Y) \
44 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
45 #define _FP_MUL_MEAT_Q(R,X,Y) \
46 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
48 #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
49 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
50 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
52 #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
53 #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
54 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
55 #define _FP_NANSIGN_S 0
56 #define _FP_NANSIGN_D 0
57 #define _FP_NANSIGN_Q 0
59 #define _FP_KEEPNANFRACP 1
60 #define _FP_QNANNEGATEDP 0
62 /* Someone please check this. */
63 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
65 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
66 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
69 _FP_FRAC_COPY_##wc(R,Y); \
74 _FP_FRAC_COPY_##wc(R,X); \
79 #ifdef NDS32_ABI_2FP_PLUS
80 #define FP_RND_NEAREST 0x0
81 #define FP_RND_PINF 0x1
82 #define FP_RND_MINF 0x2
83 #define FP_RND_ZERO 0x3
84 #define FP_RND_MASK 0x3
87 unsigned long int _fcsr __attribute__ ((unused)) = FP_RND_NEAREST
89 #define FP_INIT_ROUNDMODE \
91 _fcsr = __builtin_nds32_fmfcsr (); \
94 #define FP_ROUNDMODE (_fcsr & FP_RND_MASK)
99 #define _FP_TININESS_AFTER_ROUNDING 0
101 #define __LITTLE_ENDIAN 1234
102 #define __BIG_ENDIAN 4321
104 #if defined __big_endian__
105 # define __BYTE_ORDER __BIG_ENDIAN
107 # define __BYTE_ORDER __LITTLE_ENDIAN
110 /* Define ALIASNAME as a strong alias for NAME. */
111 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
112 # define _strong_alias(name, aliasname) \
113 extern __typeof (name) aliasname __attribute__ ((alias (#name)));