| 1 |
/* Soft-FP definitions for H8/300 |
| 2 |
Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is free software; you can redistribute it and/or modify it |
| 5 |
under the terms of the GNU General Public License as published by the |
| 6 |
Free Software Foundation; either version 3, or (at your option) any |
| 7 |
later version. |
| 8 |
|
| 9 |
This file is distributed in the hope that it will be useful, but |
| 10 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
General Public License for more details. |
| 13 |
|
| 14 |
Under Section 7 of GPL version 3, you are granted additional |
| 15 |
permissions described in the GCC Runtime Library Exception, version |
| 16 |
3.1, as published by the Free Software Foundation. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License and |
| 19 |
a copy of the GCC Runtime Library Exception along with this program; |
| 20 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 21 |
<http://www.gnu.org/licenses/>. */ |
| 22 |
|
| 23 |
#define _FP_W_TYPE_SIZE 32 |
| 24 |
#define _FP_W_TYPE unsigned long |
| 25 |
#define _FP_WS_TYPE signed long |
| 26 |
#define _FP_I_TYPE long |
| 27 |
|
| 28 |
#define _FP_MUL_MEAT_S(R,X,Y) \ |
| 29 |
_FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) |
| 30 |
#define _FP_MUL_MEAT_D(R,X,Y) \ |
| 31 |
_FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) |
| 32 |
#define _FP_MUL_MEAT_Q(R,X,Y) \ |
| 33 |
_FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) |
| 34 |
|
| 35 |
#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y) |
| 36 |
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) |
| 37 |
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) |
| 38 |
|
| 39 |
#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) |
| 40 |
#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 |
| 41 |
#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 |
| 42 |
#define _FP_NANSIGN_S 0 |
| 43 |
#define _FP_NANSIGN_D 0 |
| 44 |
#define _FP_NANSIGN_Q 0 |
| 45 |
|
| 46 |
#define _FP_KEEPNANFRACP 1 |
| 47 |
#define _FP_QNANNEGATEDP 0 |
| 48 |
|
| 49 |
/* Someone please check this. */ |
| 50 |
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ |
| 51 |
do { \ |
| 52 |
if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ |
| 53 |
&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ |
| 54 |
{ \ |
| 55 |
R##_s = Y##_s; \ |
| 56 |
_FP_FRAC_COPY_##wc(R,Y); \ |
| 57 |
} \ |
| 58 |
else \ |
| 59 |
{ \ |
| 60 |
R##_s = X##_s; \ |
| 61 |
_FP_FRAC_COPY_##wc(R,X); \ |
| 62 |
} \ |
| 63 |
R##_c = FP_CLS_NAN; \ |
| 64 |
} while (0) |
| 65 |
|
| 66 |
/* Not checked. */ |
| 67 |
#define _FP_TININESS_AFTER_ROUNDING 0 |
| 68 |
|
| 69 |
#define __BIG_ENDIAN 4321 |
| 70 |
|
| 71 |
#define __BYTE_ORDER __BIG_ENDIAN |
| 72 |
|
| 73 |
/* Define ALIASNAME as a strong alias for NAME. */ |
| 74 |
# define strong_alias(name, aliasname) _strong_alias(name, aliasname) |
| 75 |
# define _strong_alias(name, aliasname) \ |
| 76 |
extern __typeof (name) aliasname __attribute__ ((alias (#name))); |