1 /* $NetBSD: softfloat-for-gcc.h,v 1.12 2013/08/01 23:21:19 matt Exp $ */
2 
3 /*
4  * Move private identifiers with external linkage into implementation
5  * namespace.  -- Klaus Klein <kleink@NetBSD.org>, May 5, 1999
6  */
7 #define float_exception_flags _softfloat_float_exception_flags
8 #define float_exception_mask  _softfloat_float_exception_mask
9 #define float_rounding_mode   _softfloat_float_rounding_mode
10 #define float_raise           _softfloat_float_raise
11 
12 /* The following batch are called by GCC through wrappers */
13 #define float32_eq            _softfloat_float32_eq
14 #define float32_le            _softfloat_float32_le
15 #define float32_lt            _softfloat_float32_lt
16 #define float64_eq            _softfloat_float64_eq
17 #define float64_le            _softfloat_float64_le
18 #define float64_lt            _softfloat_float64_lt
19 #define float128_eq           _softfloat_float128_eq
20 #define float128_le           _softfloat_float128_le
21 #define float128_lt           _softfloat_float128_lt
22 
23 /*
24  * Macros to define functions with the GCC expected names
25  */
26 
27 #define float32_add                     __addsf3
28 #define float64_add                     __adddf3
29 #define floatx80_add                              __addxf3
30 #define float128_add                              __addtf3
31 
32 #define float32_sub                     __subsf3
33 #define float64_sub                     __subdf3
34 #define floatx80_sub                              __subxf3
35 #define float128_sub                              __subtf3
36 
37 #define float32_mul                     __mulsf3
38 #define float64_mul                     __muldf3
39 #define floatx80_mul                              __mulxf3
40 #define float128_mul                              __multf3
41 
42 #define float32_div                     __divsf3
43 #define float64_div                     __divdf3
44 #define floatx80_div                              __divxf3
45 #define float128_div                              __divtf3
46 
47 #if 0
48 #define float32_neg                     __negsf2
49 #define float64_neg                     __negdf2
50 #define floatx80_neg                              __negxf2
51 #define float128_neg                              __negtf2
52 #endif
53 
54 #define int32_to_float32                __floatsisf
55 #define int32_to_float64                __floatsidf
56 #define int32_to_floatx80               __floatsixf
57 #define int32_to_float128               __floatsitf
58 
59 #define int64_to_float32                __floatdisf
60 #define int64_to_float64                __floatdidf
61 #define int64_to_floatx80               __floatdixf
62 #define int64_to_float128               __floatditf
63 
64 #define int128_to_float32               __floattisf
65 #define int128_to_float64               __floattidf
66 #define int128_to_floatx80              __floattixf
67 #define int128_to_float128              __floattitf
68 
69 #define uint32_to_float32               __floatunsisf
70 #define uint32_to_float64               __floatunsidf
71 #define uint32_to_floatx80              __floatunsixf
72 #define uint32_to_float128              __floatunsitf
73 
74 #define uint64_to_float32               __floatundisf
75 #define uint64_to_float64               __floatundidf
76 #define uint64_to_floatx80              __floatundixf
77 #define uint64_to_float128              __floatunditf
78 
79 #define uint128_to_float32              __floatuntisf
80 #define uint128_to_float64              __floatuntidf
81 #define uint128_to_floatx80             __floatuntixf
82 #define uint128_to_float128             __floatuntitf
83 
84 #define float32_to_int32_round_to_zero  __fixsfsi
85 #define float64_to_int32_round_to_zero  __fixdfsi
86 #define floatx80_to_int32_round_to_zero __fixxfsi
87 #define float128_to_int32_round_to_zero __fixtfsi
88 
89 #define float32_to_int64_round_to_zero  __fixsfdi
90 #define float64_to_int64_round_to_zero  __fixdfdi
91 #define floatx80_to_int64_round_to_zero __fixxfdi
92 #define float128_to_int64_round_to_zero __fixtfdi
93 
94 #define float32_to_int128_round_to_zero __fixsfti
95 #define float64_to_int128_round_to_zero __fixdfti
96 #define floatx80_to_int128_round_to_zero __fixxfti
97 #define float128_to_int128_round_to_zero __fixtfti
98 
99 #define float32_to_uint32_round_to_zero __fixunssfsi
100 #define float64_to_uint32_round_to_zero __fixunsdfsi
101 #define floatx80_to_uint32_round_to_zero          __fixunsxfsi
102 #define float128_to_uint32_round_to_zero          __fixunstfsi
103 
104 #define float32_to_uint64_round_to_zero __fixunssfdi
105 #define float64_to_uint64_round_to_zero __fixunsdfdi
106 #define floatx80_to_uint64_round_to_zero          __fixunsxfdi
107 #define float128_to_uint64_round_to_zero          __fixunstfdi
108 
109 #define float32_to_uint128_round_to_zero          __fixunssfti
110 #define float64_to_uint128_round_to_zero          __fixunsdfti
111 #define floatx80_to_uint128_round_to_zero         __fixunsxfti
112 #define float128_to_uint128_round_to_zero         __fixunstfti
113 
114 #define float32_to_float64              __extendsfdf2
115 #define float32_to_floatx80             __extendsfxf2
116 #define float32_to_float128             __extendsftf2
117 #define float64_to_floatx80             __extenddfxf2
118 #define float64_to_float128             __extenddftf2
119 
120 #define float128_to_float64             __trunctfdf2
121 #define floatx80_to_float64             __truncxfdf2
122 #define float128_to_float32             __trunctfsf2
123 #define floatx80_to_float32             __truncxfsf2
124 #define float64_to_float32              __truncdfsf2
125 
126 #if 0
127 #define float32_cmp                     __cmpsf2
128 #define float32_unord                             __unordsf2
129 #define float32_eq                      __eqsf2
130 #define float32_ne                      __nesf2
131 #define float32_ge                      __gesf2
132 #define float32_lt                      __ltsf2
133 #define float32_le                      __lesf2
134 #define float32_gt                      __gtsf2
135 #endif
136 
137 #if 0
138 #define float64_cmp                     __cmpdf2
139 #define float64_unord                             __unorddf2
140 #define float64_eq                      __eqdf2
141 #define float64_ne                      __nedf2
142 #define float64_ge                      __gedf2
143 #define float64_lt                      __ltdf2
144 #define float64_le                      __ledf2
145 #define float64_gt                      __gtdf2
146 #endif
147 
148 /* XXX not in libgcc */
149 #if 1
150 #define floatx80_cmp                              __cmpxf2
151 #define floatx80_unord                            __unordxf2
152 #define floatx80_eq                     __eqxf2
153 #define floatx80_ne                     __nexf2
154 #define floatx80_ge                     __gexf2
155 #define floatx80_lt                     __ltxf2
156 #define floatx80_le                     __lexf2
157 #define floatx80_gt                     __gtxf2
158 #endif
159 
160 #if 0
161 #define float128_cmp                              __cmptf2
162 #define float128_unord                            __unordtf2
163 #define float128_eq                     __eqtf2
164 #define float128_ne                     __netf2
165 #define float128_ge                     __getf2
166 #define float128_lt                     __lttf2
167 #define float128_le                     __letf2
168 #define float128_gt                     __gttf2
169 #endif
170 
171 #ifdef __ARM_EABI__
172 #ifdef __ARM_PCS_VFP
173 #include <arm/aeabi.h>
174 #endif
175 #define __addsf3                        __aeabi_fadd
176 #define __adddf3                        __aeabi_dadd
177 
178 #define __subsf3                        __aeabi_fsub
179 #define __subdf3                        __aeabi_dsub
180 
181 #define __mulsf3                        __aeabi_fmul
182 #define __muldf3                        __aeabi_dmul
183 
184 #define __divsf3                        __aeabi_fdiv
185 #define __divdf3                        __aeabi_ddiv
186 
187 #define __floatsisf                     __aeabi_i2f
188 #define __floatsidf                     __aeabi_i2d
189 
190 #define __floatdisf                     __aeabi_l2f
191 #define __floatdidf                     __aeabi_l2d
192 
193 #define __floatunsisf                             __aeabi_ui2f
194 #define __floatunsidf                             __aeabi_ui2d
195 
196 #define __floatundisf                             __aeabi_ul2f
197 #define __floatundidf                             __aeabi_ul2d
198 
199 #define __fixsfsi                       __aeabi_f2iz
200 #define __fixdfsi                       __aeabi_d2iz
201 
202 #define __fixsfdi                       __aeabi_f2lz
203 #define __fixdfdi                       __aeabi_d2lz
204 
205 #define __fixunssfsi                              __aeabi_f2uiz
206 #define __fixunsdfsi                              __aeabi_d2uiz
207 
208 #define __fixunssfdi                              __aeabi_f2ulz
209 #define __fixunsdfdi                              __aeabi_d2ulz
210 
211 #define __extendsfdf2                             __aeabi_f2d
212 #define __truncdfsf2                              __aeabi_d2f
213 
214 #endif /* __ARM_EABI__ */
215