1 /* Soft-FP definitions for TI C6X. 2 Copyright (C) 2010-2020 Free Software Foundation, Inc. 3 4 This files is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 In addition to the permissions in the GNU Lesser General Public 10 License, the Free Software Foundation gives you unlimited 11 permission to link the compiled version of this file into 12 combinations with other programs, and to distribute those 13 combinations without any restriction coming from the use of this 14 file. (The Lesser General Public License restrictions do apply in 15 other respects; for example, they cover modification of the file, 16 and distribution when not linked into a combine executable.) 17 18 This file is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 Lesser General Public License for more details. 22 23 You should have received a copy of the GNU Lesser General Public 24 License along with GCC; see the file COPYING.LIB. If not see 25 <http://www.gnu.org/licenses/>. */ 26 27 #define _FP_W_TYPE_SIZE 32 28 #define _FP_W_TYPE unsigned long 29 #define _FP_WS_TYPE signed long 30 #define _FP_I_TYPE long 31 32 #define _FP_MUL_MEAT_S(R,X,Y) \ 33 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) 34 #define _FP_MUL_MEAT_D(R,X,Y) \ 35 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) 36 #define _FP_MUL_MEAT_Q(R,X,Y) \ 37 _FP_MUL_MEAT_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_H ((_FP_QNANBIT_H << 1) - 1) 44 #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) 45 #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 46 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 47 #define _FP_NANSIGN_H 0 48 #define _FP_NANSIGN_S 0 49 #define _FP_NANSIGN_D 0 50 #define _FP_NANSIGN_Q 0 51 52 #define _FP_KEEPNANFRACP 1 53 #define _FP_QNANNEGATEDP 0 54 55 /* Someone please check this. */ 56 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ 57 do { \ 58 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ 59 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ 60 { \ 61 R##_s = Y##_s; \ 62 _FP_FRAC_COPY_##wc(R,Y); \ 63 } \ 64 else \ 65 { \ 66 R##_s = X##_s; \ 67 _FP_FRAC_COPY_##wc(R,X); \ 68 } \ 69 R##_c = FP_CLS_NAN; \ 70 } while (0) 71 72 #define __LITTLE_ENDIAN 1234 73 #define __BIG_ENDIAN 4321 74 75 #if defined _BIG_ENDIAN 76 # define __BYTE_ORDER __BIG_ENDIAN 77 #else 78 # define __BYTE_ORDER __LITTLE_ENDIAN 79 #endif 80 81 /* Not checked. */ 82 #define _FP_TININESS_AFTER_ROUNDING 0 83 84 85 /* Define ALIASNAME as a strong alias for NAME. */ 86 # define strong_alias(name, aliasname) _strong_alias(name, aliasname) 87 # define _strong_alias(name, aliasname) \ 88 extern __typeof (name) aliasname __attribute__ ((alias (#name))); 89 90 /* Rename helper functions to the names specified in the C6000 ELF ABI. */ 91 #define __fixdfsi __c6xabi_fixdi 92 #define __fixsfsi __c6xabi_fixfi 93 #define __floatsidf __c6xabi_fltid 94 #define __floatunsidf __c6xabi_fltud 95 #define __floatsisf __c6xabi_fltif 96 #define __floatunsisf __c6xabi_fltuf 97 #define __truncdfsf2 __c6xabi_cvtdf 98 #define __extendsfdf2 __c6xabi_cvtfd 99 #define __adddf3 __c6xabi_addd 100 #define __subdf3 __c6xabi_subd 101 #define __muldf3 __c6xabi_mpyd 102 #define __divdf3 __c6xabi_divd 103 #define __negdf2 __c6xabi_negd 104 #define __absdf2 __c6xabi_absd 105 #define __addsf3 __c6xabi_addf 106 #define __subsf3 __c6xabi_subf 107 #define __mulsf3 __c6xabi_mpyf 108 #define __divsf3 __c6xabi_divf 109 #define __negsf2 __c6xabi_negf 110 #define __abssf2 __c6xabi_absf 111 #define __lesf2 __c6xabi_cmpf 112 #define __ledf2 __c6xabi_cmpd 113 #define __ltsf2 __gnu_ltsf2 114 #define __ltdf2 __gnu_ltdf2 115 #define __gesf2 __gnu_gesf2 116 #define __gedf2 __gnu_gedf2 117 #define __gtsf2 __gnu_gtsf2 118 #define __gtdf2 __gnu_gtdf2 119 #define __eqsf2 __gnu_eqsf2 120 #define __eqdf2 __gnu_eqdf2 121 #define __nesf2 __c6xabi_neqf 122 #define __nedf2 __c6xabi_neqd 123 #define __unordsf2 __c6xabi_unordf 124 #define __unorddf2 __c6xabi_unordd 125