| 1 |
/* Soft-FP definitions for TI PRU. |
| 2 |
Copyright (C) 2010-2025 Free Software Foundation, Inc. |
| 3 |
Based on C6X soft-fp header. |
| 4 |
|
| 5 |
This files 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 |
In addition to the permissions in the GNU Lesser General Public |
| 11 |
License, the Free Software Foundation gives you unlimited |
| 12 |
permission to link the compiled version of this file into |
| 13 |
combinations with other programs, and to distribute those |
| 14 |
combinations without any restriction coming from the use of this |
| 15 |
file. (The Lesser General Public License restrictions do apply in |
| 16 |
other respects; for example, they cover modification of the file, |
| 17 |
and distribution when not linked into a combine executable.) |
| 18 |
|
| 19 |
This file is distributed in the hope that it will be useful, |
| 20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 |
Lesser General Public License for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU Lesser General Public |
| 25 |
License along with GCC; see the file COPYING.LIB. If not see |
| 26 |
<http://www.gnu.org/licenses/>. */ |
| 27 |
|
| 28 |
#define _FP_W_TYPE_SIZE 32 |
| 29 |
#define _FP_W_TYPE unsigned long |
| 30 |
#define _FP_WS_TYPE signed long |
| 31 |
#define _FP_I_TYPE long |
| 32 |
|
| 33 |
#define _FP_MUL_MEAT_S(R,X,Y) \ |
| 34 |
_FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) |
| 35 |
#define _FP_MUL_MEAT_D(R,X,Y) \ |
| 36 |
_FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) |
| 37 |
#define _FP_MUL_MEAT_Q(R,X,Y) \ |
| 38 |
_FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) |
| 39 |
|
| 40 |
#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y) |
| 41 |
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) |
| 42 |
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) |
| 43 |
|
| 44 |
#define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1) |
| 45 |
#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) |
| 46 |
#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 |
| 47 |
#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 |
| 48 |
#define _FP_NANSIGN_H 0 |
| 49 |
#define _FP_NANSIGN_S 0 |
| 50 |
#define _FP_NANSIGN_D 0 |
| 51 |
#define _FP_NANSIGN_Q 0 |
| 52 |
|
| 53 |
#define _FP_KEEPNANFRACP 1 |
| 54 |
#define _FP_QNANNEGATEDP 0 |
| 55 |
|
| 56 |
/* Someone please check this. */ |
| 57 |
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ |
| 58 |
do { \ |
| 59 |
if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ |
| 60 |
&& !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ |
| 61 |
{ \ |
| 62 |
R##_s = Y##_s; \ |
| 63 |
_FP_FRAC_COPY_##wc(R,Y); \ |
| 64 |
} \ |
| 65 |
else \ |
| 66 |
{ \ |
| 67 |
R##_s = X##_s; \ |
| 68 |
_FP_FRAC_COPY_##wc(R,X); \ |
| 69 |
} \ |
| 70 |
R##_c = FP_CLS_NAN; \ |
| 71 |
} while (0) |
| 72 |
|
| 73 |
#define __LITTLE_ENDIAN 1234 |
| 74 |
#define __BIG_ENDIAN 4321 |
| 75 |
|
| 76 |
#if defined _BIG_ENDIAN |
| 77 |
# define __BYTE_ORDER __BIG_ENDIAN |
| 78 |
#else |
| 79 |
# define __BYTE_ORDER __LITTLE_ENDIAN |
| 80 |
#endif |
| 81 |
|
| 82 |
/* Not checked. */ |
| 83 |
#define _FP_TININESS_AFTER_ROUNDING 0 |
| 84 |
|
| 85 |
|
| 86 |
/* Define ALIASNAME as a strong alias for NAME. */ |
| 87 |
# define strong_alias(name, aliasname) _strong_alias(name, aliasname) |
| 88 |
# define _strong_alias(name, aliasname) \ |
| 89 |
extern __typeof (name) aliasname __attribute__ ((alias (#name))); |
| 90 |
|
| 91 |
/* Rename helper functions to the names specified in the PRU ELF ABI. */ |
| 92 |
#define __fixdfsi __pruabi_fixdi |
| 93 |
#define __fixsfsi __pruabi_fixfi |
| 94 |
#define __floatsidf __pruabi_fltid |
| 95 |
#define __floatunsidf __pruabi_fltud |
| 96 |
#define __floatsisf __pruabi_fltif |
| 97 |
#define __floatunsisf __pruabi_fltuf |
| 98 |
#define __truncdfsf2 __pruabi_cvtdf |
| 99 |
#define __extendsfdf2 __pruabi_cvtfd |
| 100 |
#define __adddf3 __pruabi_addd |
| 101 |
#define __subdf3 __pruabi_subd |
| 102 |
#define __muldf3 __pruabi_mpyd |
| 103 |
#define __divdf3 __pruabi_divd |
| 104 |
#define __negdf2 __pruabi_negd |
| 105 |
#define __absdf2 __pruabi_absd |
| 106 |
#define __addsf3 __pruabi_addf |
| 107 |
#define __subsf3 __pruabi_subf |
| 108 |
#define __mulsf3 __pruabi_mpyf |
| 109 |
#define __divsf3 __pruabi_divf |
| 110 |
#define __negsf2 __pruabi_negf |
| 111 |
#define __abssf2 __pruabi_absf |
| 112 |
#define __lesf2 __pruabi_cmpf |
| 113 |
#define __ledf2 __pruabi_cmpd |
| 114 |
#define __ltsf2 __gnu_ltsf2 |
| 115 |
#define __ltdf2 __gnu_ltdf2 |
| 116 |
#define __gesf2 __gnu_gesf2 |
| 117 |
#define __gedf2 __gnu_gedf2 |
| 118 |
#define __gtsf2 __gnu_gtsf2 |
| 119 |
#define __gtdf2 __gnu_gtdf2 |
| 120 |
#define __eqsf2 __gnu_eqsf2 |
| 121 |
#define __eqdf2 __gnu_eqdf2 |
| 122 |
#define __nesf2 __pruabi_neqf |
| 123 |
#define __nedf2 __pruabi_neqd |
| 124 |
#define __unordsf2 __pruabi_unordf |
| 125 |
#define __unorddf2 __pruabi_unordd |