soft-fp: Move to ../libgcc.
[gcc.git] / libgcc / config / c6x / sfp-machine.h
1 /* Soft-FP definitions for TI C6X.
2 Copyright (C) 2010, 2011 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
54 /* Someone please check this. */
55 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
56 do { \
57 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
58 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
59 { \
60 R##_s = Y##_s; \
61 _FP_FRAC_COPY_##wc(R,Y); \
62 } \
63 else \
64 { \
65 R##_s = X##_s; \
66 _FP_FRAC_COPY_##wc(R,X); \
67 } \
68 R##_c = FP_CLS_NAN; \
69 } while (0)
70
71 #define __LITTLE_ENDIAN 1234
72 #define __BIG_ENDIAN 4321
73
74 #if defined _BIG_ENDIAN
75 # define __BYTE_ORDER __BIG_ENDIAN
76 #else
77 # define __BYTE_ORDER __LITTLE_ENDIAN
78 #endif
79
80
81 /* Define ALIASNAME as a strong alias for NAME. */
82 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
83 # define _strong_alias(name, aliasname) \
84 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
85
86 /* Rename helper functions to the names specified in the C6000 ELF ABI. */
87 #define __fixdfsi __c6xabi_fixdi
88 #define __fixsfsi __c6xabi_fixfi
89 #define __floatsidf __c6xabi_fltid
90 #define __floatunsidf __c6xabi_fltud
91 #define __floatsisf __c6xabi_fltif
92 #define __floatunsisf __c6xabi_fltuf
93 #define __truncdfsf2 __c6xabi_cvtdf
94 #define __extendsfdf2 __c6xabi_cvtfd
95 #define __adddf3 __c6xabi_addd
96 #define __subdf3 __c6xabi_subd
97 #define __muldf3 __c6xabi_mpyd
98 #define __divdf3 __c6xabi_divd
99 #define __negdf2 __c6xabi_negd
100 #define __absdf2 __c6xabi_absd
101 #define __addsf3 __c6xabi_addf
102 #define __subsf3 __c6xabi_subf
103 #define __mulsf3 __c6xabi_mpyf
104 #define __divsf3 __c6xabi_divf
105 #define __negsf2 __c6xabi_negf
106 #define __abssf2 __c6xabi_absf
107 #define __lesf2 __c6xabi_cmpf
108 #define __ledf2 __c6xabi_cmpd
109 #define __ltsf2 __gnu_ltsf2
110 #define __ltdf2 __gnu_ltdf2
111 #define __gesf2 __gnu_gesf2
112 #define __gedf2 __gnu_gedf2
113 #define __gtsf2 __gnu_gtsf2
114 #define __gtdf2 __gnu_gtdf2
115 #define __eqsf2 __gnu_eqsf2
116 #define __eqdf2 __gnu_eqdf2
117 #define __nesf2 __c6xabi_neqf
118 #define __nedf2 __c6xabi_neqd
119 #define __unordsf2 __c6xabi_unordf
120 #define __unorddf2 __c6xabi_unordd