1 |
|
---|
2 | /*============================================================================
|
---|
3 |
|
---|
4 | This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
---|
5 | Package, Release 3e, by John R. Hauser.
|
---|
6 |
|
---|
7 | Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the
|
---|
8 | University of California. All rights reserved.
|
---|
9 |
|
---|
10 | Redistribution and use in source and binary forms, with or without
|
---|
11 | modification, are permitted provided that the following conditions are met:
|
---|
12 |
|
---|
13 | 1. Redistributions of source code must retain the above copyright notice,
|
---|
14 | this list of conditions, and the following disclaimer.
|
---|
15 |
|
---|
16 | 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
17 | this list of conditions, and the following disclaimer in the documentation
|
---|
18 | and/or other materials provided with the distribution.
|
---|
19 |
|
---|
20 | 3. Neither the name of the University nor the names of its contributors may
|
---|
21 | be used to endorse or promote products derived from this software without
|
---|
22 | specific prior written permission.
|
---|
23 |
|
---|
24 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
|
---|
25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
---|
26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
|
---|
27 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
---|
28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
---|
33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
34 |
|
---|
35 | =============================================================================*/
|
---|
36 |
|
---|
37 | #ifndef specialize_h
|
---|
38 | #define specialize_h 1
|
---|
39 |
|
---|
40 | #include <stdbool.h>
|
---|
41 | #include <stdint.h>
|
---|
42 | #include "primitiveTypes.h"
|
---|
43 | #include "softfloat.h"
|
---|
44 |
|
---|
45 | /*----------------------------------------------------------------------------
|
---|
46 | | Default value for 'softfloat_detectTininess'.
|
---|
47 | *----------------------------------------------------------------------------*/
|
---|
48 | #define init_detectTininess softfloat_tininess_beforeRounding
|
---|
49 |
|
---|
50 | /*----------------------------------------------------------------------------
|
---|
51 | | The values to return on conversions to 32-bit integer formats that raise an
|
---|
52 | | invalid exception.
|
---|
53 | *----------------------------------------------------------------------------*/
|
---|
54 | #define ui32_fromPosOverflow 0xFFFFFFFF
|
---|
55 | #define ui32_fromNegOverflow 0
|
---|
56 | #define ui32_fromNaN 0
|
---|
57 | #define i32_fromPosOverflow 0x7FFFFFFF
|
---|
58 | #define i32_fromNegOverflow (-0x7FFFFFFF - 1)
|
---|
59 | #define i32_fromNaN 0
|
---|
60 |
|
---|
61 | /*----------------------------------------------------------------------------
|
---|
62 | | The values to return on conversions to 64-bit integer formats that raise an
|
---|
63 | | invalid exception.
|
---|
64 | *----------------------------------------------------------------------------*/
|
---|
65 | #define ui64_fromPosOverflow UINT64_C( 0xFFFFFFFFFFFFFFFF )
|
---|
66 | #define ui64_fromNegOverflow 0
|
---|
67 | #define ui64_fromNaN 0
|
---|
68 | #define i64_fromPosOverflow INT64_C( 0x7FFFFFFFFFFFFFFF )
|
---|
69 | #define i64_fromNegOverflow (-INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1)
|
---|
70 | #define i64_fromNaN 0
|
---|
71 |
|
---|
72 | /*----------------------------------------------------------------------------
|
---|
73 | | "Common NaN" structure, used to transfer NaN representations from one format
|
---|
74 | | to another.
|
---|
75 | *----------------------------------------------------------------------------*/
|
---|
76 | struct commonNaN { char _unused; };
|
---|
77 |
|
---|
78 | /*----------------------------------------------------------------------------
|
---|
79 | | The bit pattern for a default generated 16-bit floating-point NaN.
|
---|
80 | *----------------------------------------------------------------------------*/
|
---|
81 | #define defaultNaNF16UI 0x7E00
|
---|
82 |
|
---|
83 | /*----------------------------------------------------------------------------
|
---|
84 | | Returns true when 16-bit unsigned integer 'uiA' has the bit pattern of a
|
---|
85 | | 16-bit floating-point signaling NaN.
|
---|
86 | | Note: This macro evaluates its argument more than once.
|
---|
87 | *----------------------------------------------------------------------------*/
|
---|
88 | #define softfloat_isSigNaNF16UI( uiA ) ((((uiA) & 0x7E00) == 0x7C00) && ((uiA) & 0x01FF))
|
---|
89 |
|
---|
90 | /*----------------------------------------------------------------------------
|
---|
91 | | Assuming 'uiA' has the bit pattern of a 16-bit floating-point NaN, converts
|
---|
92 | | this NaN to the common NaN form, and stores the resulting common NaN at the
|
---|
93 | | location pointed to by 'zPtr'. If the NaN is a signaling NaN, the invalid
|
---|
94 | | exception is raised.
|
---|
95 | *----------------------------------------------------------------------------*/
|
---|
96 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
97 | #define softfloat_f16UIToCommonNaN( uiA, zPtr ) if ( ! ((uiA) & 0x0200) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
98 | #else
|
---|
99 | # define softfloat_f16UIToCommonNaN( uiA, zPtr, pState ) if ( ! ((uiA) & 0x0200) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | /*----------------------------------------------------------------------------
|
---|
103 | | Converts the common NaN pointed to by 'aPtr' into a 16-bit floating-point
|
---|
104 | | NaN, and returns the bit pattern of this value as an unsigned integer.
|
---|
105 | *----------------------------------------------------------------------------*/
|
---|
106 | #define softfloat_commonNaNToF16UI( aPtr ) ((uint_fast16_t) defaultNaNF16UI)
|
---|
107 |
|
---|
108 | /*----------------------------------------------------------------------------
|
---|
109 | | Interpreting 'uiA' and 'uiB' as the bit patterns of two 16-bit floating-
|
---|
110 | | point values, at least one of which is a NaN, returns the bit pattern of
|
---|
111 | | the combined NaN result. If either 'uiA' or 'uiB' has the pattern of a
|
---|
112 | | signaling NaN, the invalid exception is raised.
|
---|
113 | *----------------------------------------------------------------------------*/
|
---|
114 | uint_fast16_t
|
---|
115 | softfloat_propagateNaNF16UI( uint_fast16_t uiA, uint_fast16_t uiB SOFTFLOAT_STATE_DECL_COMMA );
|
---|
116 |
|
---|
117 | /*----------------------------------------------------------------------------
|
---|
118 | | The bit pattern for a default generated 32-bit floating-point NaN.
|
---|
119 | *----------------------------------------------------------------------------*/
|
---|
120 | #define defaultNaNF32UI 0x7FC00000
|
---|
121 |
|
---|
122 | /*----------------------------------------------------------------------------
|
---|
123 | | Returns true when 32-bit unsigned integer 'uiA' has the bit pattern of a
|
---|
124 | | 32-bit floating-point signaling NaN.
|
---|
125 | | Note: This macro evaluates its argument more than once.
|
---|
126 | *----------------------------------------------------------------------------*/
|
---|
127 | #define softfloat_isSigNaNF32UI( uiA ) ((((uiA) & 0x7FC00000) == 0x7F800000) && ((uiA) & 0x003FFFFF))
|
---|
128 |
|
---|
129 | /*----------------------------------------------------------------------------
|
---|
130 | | Assuming 'uiA' has the bit pattern of a 32-bit floating-point NaN, converts
|
---|
131 | | this NaN to the common NaN form, and stores the resulting common NaN at the
|
---|
132 | | location pointed to by 'zPtr'. If the NaN is a signaling NaN, the invalid
|
---|
133 | | exception is raised.
|
---|
134 | *----------------------------------------------------------------------------*/
|
---|
135 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
136 | #define softfloat_f32UIToCommonNaN( uiA, zPtr ) if ( ! ((uiA) & 0x00400000) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
137 | #else
|
---|
138 | # define softfloat_f32UIToCommonNaN( uiA, zPtr, pState ) if ( ! ((uiA) & 0x00400000) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | /*----------------------------------------------------------------------------
|
---|
142 | | Converts the common NaN pointed to by 'aPtr' into a 32-bit floating-point
|
---|
143 | | NaN, and returns the bit pattern of this value as an unsigned integer.
|
---|
144 | *----------------------------------------------------------------------------*/
|
---|
145 | #define softfloat_commonNaNToF32UI( aPtr ) ((uint_fast32_t) defaultNaNF32UI)
|
---|
146 |
|
---|
147 | /*----------------------------------------------------------------------------
|
---|
148 | | Interpreting 'uiA' and 'uiB' as the bit patterns of two 32-bit floating-
|
---|
149 | | point values, at least one of which is a NaN, returns the bit pattern of
|
---|
150 | | the combined NaN result. If either 'uiA' or 'uiB' has the pattern of a
|
---|
151 | | signaling NaN, the invalid exception is raised.
|
---|
152 | *----------------------------------------------------------------------------*/
|
---|
153 | uint_fast32_t
|
---|
154 | softfloat_propagateNaNF32UI( uint_fast32_t uiA, uint_fast32_t uiB SOFTFLOAT_STATE_DECL_COMMA );
|
---|
155 |
|
---|
156 | /*----------------------------------------------------------------------------
|
---|
157 | | The bit pattern for a default generated 64-bit floating-point NaN.
|
---|
158 | *----------------------------------------------------------------------------*/
|
---|
159 | #define defaultNaNF64UI UINT64_C( 0x7FF8000000000000 )
|
---|
160 |
|
---|
161 | /*----------------------------------------------------------------------------
|
---|
162 | | Returns true when 64-bit unsigned integer 'uiA' has the bit pattern of a
|
---|
163 | | 64-bit floating-point signaling NaN.
|
---|
164 | | Note: This macro evaluates its argument more than once.
|
---|
165 | *----------------------------------------------------------------------------*/
|
---|
166 | #define softfloat_isSigNaNF64UI( uiA ) ((((uiA) & UINT64_C( 0x7FF8000000000000 )) == UINT64_C( 0x7FF0000000000000 )) && ((uiA) & UINT64_C( 0x0007FFFFFFFFFFFF )))
|
---|
167 |
|
---|
168 | /*----------------------------------------------------------------------------
|
---|
169 | | Assuming 'uiA' has the bit pattern of a 64-bit floating-point NaN, converts
|
---|
170 | | this NaN to the common NaN form, and stores the resulting common NaN at the
|
---|
171 | | location pointed to by 'zPtr'. If the NaN is a signaling NaN, the invalid
|
---|
172 | | exception is raised.
|
---|
173 | *----------------------------------------------------------------------------*/
|
---|
174 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
175 | #define softfloat_f64UIToCommonNaN( uiA, zPtr ) if ( ! ((uiA) & UINT64_C( 0x0008000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
176 | #else
|
---|
177 | # define softfloat_f64UIToCommonNaN( uiA, zPtr, pState ) if ( ! ((uiA) & UINT64_C( 0x0008000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
178 | #endif
|
---|
179 |
|
---|
180 | /*----------------------------------------------------------------------------
|
---|
181 | | Converts the common NaN pointed to by 'aPtr' into a 64-bit floating-point
|
---|
182 | | NaN, and returns the bit pattern of this value as an unsigned integer.
|
---|
183 | *----------------------------------------------------------------------------*/
|
---|
184 | #define softfloat_commonNaNToF64UI( aPtr ) ((uint_fast64_t) defaultNaNF64UI)
|
---|
185 |
|
---|
186 | /*----------------------------------------------------------------------------
|
---|
187 | | Interpreting 'uiA' and 'uiB' as the bit patterns of two 64-bit floating-
|
---|
188 | | point values, at least one of which is a NaN, returns the bit pattern of
|
---|
189 | | the combined NaN result. If either 'uiA' or 'uiB' has the pattern of a
|
---|
190 | | signaling NaN, the invalid exception is raised.
|
---|
191 | *----------------------------------------------------------------------------*/
|
---|
192 | uint_fast64_t
|
---|
193 | softfloat_propagateNaNF64UI( uint_fast64_t uiA, uint_fast64_t uiB SOFTFLOAT_STATE_DECL_COMMA );
|
---|
194 |
|
---|
195 | /*----------------------------------------------------------------------------
|
---|
196 | | The bit pattern for a default generated 80-bit extended floating-point NaN.
|
---|
197 | *----------------------------------------------------------------------------*/
|
---|
198 | #define defaultNaNExtF80UI64 0x7FFF
|
---|
199 | #define defaultNaNExtF80UI0 UINT64_C( 0xC000000000000000 )
|
---|
200 |
|
---|
201 | /*----------------------------------------------------------------------------
|
---|
202 | | Returns true when the 80-bit unsigned integer formed from concatenating
|
---|
203 | | 16-bit 'uiA64' and 64-bit 'uiA0' has the bit pattern of an 80-bit extended
|
---|
204 | | floating-point signaling NaN.
|
---|
205 | | Note: This macro evaluates its arguments more than once.
|
---|
206 | *----------------------------------------------------------------------------*/
|
---|
207 | #define softfloat_isSigNaNExtF80UI( uiA64, uiA0 ) ((((uiA64) & 0x7FFF) == 0x7FFF) && ! ((uiA0) & UINT64_C( 0x4000000000000000 )) && ((uiA0) & UINT64_C( 0x3FFFFFFFFFFFFFFF )))
|
---|
208 |
|
---|
209 | #ifdef SOFTFLOAT_FAST_INT64
|
---|
210 |
|
---|
211 | /*----------------------------------------------------------------------------
|
---|
212 | | The following functions are needed only when 'SOFTFLOAT_FAST_INT64' is
|
---|
213 | | defined.
|
---|
214 | *----------------------------------------------------------------------------*/
|
---|
215 |
|
---|
216 | /*----------------------------------------------------------------------------
|
---|
217 | | Assuming the unsigned integer formed from concatenating 'uiA64' and 'uiA0'
|
---|
218 | | has the bit pattern of an 80-bit extended floating-point NaN, converts
|
---|
219 | | this NaN to the common NaN form, and stores the resulting common NaN at the
|
---|
220 | | location pointed to by 'zPtr'. If the NaN is a signaling NaN, the invalid
|
---|
221 | | exception is raised.
|
---|
222 | *----------------------------------------------------------------------------*/
|
---|
223 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
224 | #define softfloat_extF80UIToCommonNaN( uiA64, uiA0, zPtr ) if ( ! ((uiA0) & UINT64_C( 0x4000000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
225 | #else
|
---|
226 | # define softfloat_extF80UIToCommonNaN( uiA64, uiA0, zPtr, pState ) if ( ! ((uiA0) & UINT64_C( 0x4000000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
227 | #endif
|
---|
228 |
|
---|
229 | /*----------------------------------------------------------------------------
|
---|
230 | | Converts the common NaN pointed to by 'aPtr' into an 80-bit extended
|
---|
231 | | floating-point NaN, and returns the bit pattern of this value as an unsigned
|
---|
232 | | integer.
|
---|
233 | *----------------------------------------------------------------------------*/
|
---|
234 | #if defined INLINE && ! defined softfloat_commonNaNToExtF80UI
|
---|
235 | INLINE
|
---|
236 | struct uint128 softfloat_commonNaNToExtF80UI( const struct commonNaN *aPtr )
|
---|
237 | {
|
---|
238 | struct uint128 uiZ;
|
---|
239 | uiZ.v64 = defaultNaNExtF80UI64;
|
---|
240 | uiZ.v0 = defaultNaNExtF80UI0;
|
---|
241 | return uiZ;
|
---|
242 | }
|
---|
243 | #else
|
---|
244 | struct uint128 softfloat_commonNaNToExtF80UI( const struct commonNaN *aPtr );
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | /*----------------------------------------------------------------------------
|
---|
248 | | Interpreting the unsigned integer formed from concatenating 'uiA64' and
|
---|
249 | | 'uiA0' as an 80-bit extended floating-point value, and likewise interpreting
|
---|
250 | | the unsigned integer formed from concatenating 'uiB64' and 'uiB0' as another
|
---|
251 | | 80-bit extended floating-point value, and assuming at least on of these
|
---|
252 | | floating-point values is a NaN, returns the bit pattern of the combined NaN
|
---|
253 | | result. If either original floating-point value is a signaling NaN, the
|
---|
254 | | invalid exception is raised.
|
---|
255 | *----------------------------------------------------------------------------*/
|
---|
256 | struct uint128
|
---|
257 | softfloat_propagateNaNExtF80UI(
|
---|
258 | uint_fast16_t uiA64,
|
---|
259 | uint_fast64_t uiA0,
|
---|
260 | uint_fast16_t uiB64,
|
---|
261 | uint_fast64_t uiB0
|
---|
262 | SOFTFLOAT_STATE_DECL_COMMA
|
---|
263 | );
|
---|
264 |
|
---|
265 | /*----------------------------------------------------------------------------
|
---|
266 | | The bit pattern for a default generated 128-bit floating-point NaN.
|
---|
267 | *----------------------------------------------------------------------------*/
|
---|
268 | #define defaultNaNF128UI64 UINT64_C( 0x7FFF800000000000 )
|
---|
269 | #define defaultNaNF128UI0 UINT64_C( 0 )
|
---|
270 |
|
---|
271 | /*----------------------------------------------------------------------------
|
---|
272 | | Returns true when the 128-bit unsigned integer formed from concatenating
|
---|
273 | | 64-bit 'uiA64' and 64-bit 'uiA0' has the bit pattern of a 128-bit floating-
|
---|
274 | | point signaling NaN.
|
---|
275 | | Note: This macro evaluates its arguments more than once.
|
---|
276 | *----------------------------------------------------------------------------*/
|
---|
277 | #define softfloat_isSigNaNF128UI( uiA64, uiA0 ) ((((uiA64) & UINT64_C( 0x7FFF800000000000 )) == UINT64_C( 0x7FFF000000000000 )) && ((uiA0) || ((uiA64) & UINT64_C( 0x00007FFFFFFFFFFF ))))
|
---|
278 |
|
---|
279 | /*----------------------------------------------------------------------------
|
---|
280 | | Assuming the unsigned integer formed from concatenating 'uiA64' and 'uiA0'
|
---|
281 | | has the bit pattern of a 128-bit floating-point NaN, converts this NaN to
|
---|
282 | | the common NaN form, and stores the resulting common NaN at the location
|
---|
283 | | pointed to by 'zPtr'. If the NaN is a signaling NaN, the invalid exception
|
---|
284 | | is raised.
|
---|
285 | *----------------------------------------------------------------------------*/
|
---|
286 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
287 | #define softfloat_f128UIToCommonNaN( uiA64, uiA0, zPtr ) if ( ! ((uiA64) & UINT64_C( 0x0000800000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
288 | #else
|
---|
289 | # define softfloat_f128UIToCommonNaN( uiA64, uiA0, zPtr, pState ) if ( ! ((uiA64) & UINT64_C( 0x0000800000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid, pState)
|
---|
290 | #endif
|
---|
291 |
|
---|
292 | /*----------------------------------------------------------------------------
|
---|
293 | | Converts the common NaN pointed to by 'aPtr' into a 128-bit floating-point
|
---|
294 | | NaN, and returns the bit pattern of this value as an unsigned integer.
|
---|
295 | *----------------------------------------------------------------------------*/
|
---|
296 | #if defined INLINE && ! defined softfloat_commonNaNToF128UI
|
---|
297 | INLINE
|
---|
298 | struct uint128 softfloat_commonNaNToF128UI( const struct commonNaN *aPtr )
|
---|
299 | {
|
---|
300 | struct uint128 uiZ;
|
---|
301 | uiZ.v64 = defaultNaNF128UI64;
|
---|
302 | uiZ.v0 = defaultNaNF128UI0;
|
---|
303 | return uiZ;
|
---|
304 | }
|
---|
305 | #else
|
---|
306 | struct uint128 softfloat_commonNaNToF128UI( const struct commonNaN * );
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | /*----------------------------------------------------------------------------
|
---|
310 | | Interpreting the unsigned integer formed from concatenating 'uiA64' and
|
---|
311 | | 'uiA0' as a 128-bit floating-point value, and likewise interpreting the
|
---|
312 | | unsigned integer formed from concatenating 'uiB64' and 'uiB0' as another
|
---|
313 | | 128-bit floating-point value, and assuming at least on of these floating-
|
---|
314 | | point values is a NaN, returns the bit pattern of the combined NaN result.
|
---|
315 | | If either original floating-point value is a signaling NaN, the invalid
|
---|
316 | | exception is raised.
|
---|
317 | *----------------------------------------------------------------------------*/
|
---|
318 | struct uint128
|
---|
319 | softfloat_propagateNaNF128UI(
|
---|
320 | uint_fast64_t uiA64,
|
---|
321 | uint_fast64_t uiA0,
|
---|
322 | uint_fast64_t uiB64,
|
---|
323 | uint_fast64_t uiB0
|
---|
324 | SOFTFLOAT_STATE_DECL_COMMA
|
---|
325 | );
|
---|
326 |
|
---|
327 | #else
|
---|
328 |
|
---|
329 | /*----------------------------------------------------------------------------
|
---|
330 | | The following functions are needed only when 'SOFTFLOAT_FAST_INT64' is not
|
---|
331 | | defined.
|
---|
332 | *----------------------------------------------------------------------------*/
|
---|
333 |
|
---|
334 | /*----------------------------------------------------------------------------
|
---|
335 | | Assuming the 80-bit extended floating-point value pointed to by 'aSPtr' is
|
---|
336 | | a NaN, converts this NaN to the common NaN form, and stores the resulting
|
---|
337 | | common NaN at the location pointed to by 'zPtr'. If the NaN is a signaling
|
---|
338 | | NaN, the invalid exception is raised.
|
---|
339 | *----------------------------------------------------------------------------*/
|
---|
340 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
341 | #define softfloat_extF80MToCommonNaN( aSPtr, zPtr ) if ( ! ((aSPtr)->signif & UINT64_C( 0x4000000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
342 | #else
|
---|
343 | # define softfloat_extF80MToCommonNaN( aSPtr, zPtr, pState ) if ( ! ((aSPtr)->signif & UINT64_C( 0x4000000000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
344 | #endif
|
---|
345 |
|
---|
346 | /*----------------------------------------------------------------------------
|
---|
347 | | Converts the common NaN pointed to by 'aPtr' into an 80-bit extended
|
---|
348 | | floating-point NaN, and stores this NaN at the location pointed to by
|
---|
349 | | 'zSPtr'.
|
---|
350 | *----------------------------------------------------------------------------*/
|
---|
351 | #if defined INLINE && ! defined softfloat_commonNaNToExtF80M
|
---|
352 | INLINE
|
---|
353 | void
|
---|
354 | softfloat_commonNaNToExtF80M(
|
---|
355 | const struct commonNaN *aPtr, struct extFloat80M *zSPtr )
|
---|
356 | {
|
---|
357 | zSPtr->signExp = defaultNaNExtF80UI64;
|
---|
358 | zSPtr->signif = defaultNaNExtF80UI0;
|
---|
359 | }
|
---|
360 | #else
|
---|
361 | void
|
---|
362 | softfloat_commonNaNToExtF80M(
|
---|
363 | const struct commonNaN *aPtr, struct extFloat80M *zSPtr );
|
---|
364 | #endif
|
---|
365 |
|
---|
366 | /*----------------------------------------------------------------------------
|
---|
367 | | Assuming at least one of the two 80-bit extended floating-point values
|
---|
368 | | pointed to by 'aSPtr' and 'bSPtr' is a NaN, stores the combined NaN result
|
---|
369 | | at the location pointed to by 'zSPtr'. If either original floating-point
|
---|
370 | | value is a signaling NaN, the invalid exception is raised.
|
---|
371 | *----------------------------------------------------------------------------*/
|
---|
372 | void
|
---|
373 | softfloat_propagateNaNExtF80M(
|
---|
374 | const struct extFloat80M *aSPtr,
|
---|
375 | const struct extFloat80M *bSPtr,
|
---|
376 | struct extFloat80M *zSPtr
|
---|
377 | SOFTFLOAT_STATE_DECL_COMMA
|
---|
378 | );
|
---|
379 |
|
---|
380 | /*----------------------------------------------------------------------------
|
---|
381 | | The bit pattern for a default generated 128-bit floating-point NaN.
|
---|
382 | *----------------------------------------------------------------------------*/
|
---|
383 | #define defaultNaNF128UI96 0x7FFF8000
|
---|
384 | #define defaultNaNF128UI64 0
|
---|
385 | #define defaultNaNF128UI32 0
|
---|
386 | #define defaultNaNF128UI0 0
|
---|
387 |
|
---|
388 | /*----------------------------------------------------------------------------
|
---|
389 | | Assuming the 128-bit floating-point value pointed to by 'aWPtr' is a NaN,
|
---|
390 | | converts this NaN to the common NaN form, and stores the resulting common
|
---|
391 | | NaN at the location pointed to by 'zPtr'. If the NaN is a signaling NaN,
|
---|
392 | | the invalid exception is raised. Argument 'aWPtr' points to an array of
|
---|
393 | | four 32-bit elements that concatenate in the platform's normal endian order
|
---|
394 | | to form a 128-bit floating-point value.
|
---|
395 | *----------------------------------------------------------------------------*/
|
---|
396 | #ifdef VBOX_WITHOUT_SOFTFLOAT_GLOBALS
|
---|
397 | #define softfloat_f128MToCommonNaN( aWPtr, zPtr ) if ( ! ((aWPtr)[indexWordHi( 4 )] & UINT64_C( 0x0000800000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid )
|
---|
398 | #else
|
---|
399 | # define softfloat_f128MToCommonNaN( aWPtr, zPtr ) if ( ! ((aWPtr)[indexWordHi( 4 )] & UINT64_C( 0x0000800000000000 )) ) softfloat_raiseFlags( softfloat_flag_invalid, pState )
|
---|
400 | #endif
|
---|
401 |
|
---|
402 | /*----------------------------------------------------------------------------
|
---|
403 | | Converts the common NaN pointed to by 'aPtr' into a 128-bit floating-point
|
---|
404 | | NaN, and stores this NaN at the location pointed to by 'zWPtr'. Argument
|
---|
405 | | 'zWPtr' points to an array of four 32-bit elements that concatenate in the
|
---|
406 | | platform's normal endian order to form a 128-bit floating-point value.
|
---|
407 | *----------------------------------------------------------------------------*/
|
---|
408 | #if defined INLINE && ! defined softfloat_commonNaNToF128M
|
---|
409 | INLINE
|
---|
410 | void
|
---|
411 | softfloat_commonNaNToF128M( const struct commonNaN *aPtr, uint32_t *zWPtr )
|
---|
412 | {
|
---|
413 | zWPtr[indexWord( 4, 3 )] = defaultNaNF128UI96;
|
---|
414 | zWPtr[indexWord( 4, 2 )] = defaultNaNF128UI64;
|
---|
415 | zWPtr[indexWord( 4, 1 )] = defaultNaNF128UI32;
|
---|
416 | zWPtr[indexWord( 4, 0 )] = defaultNaNF128UI0;
|
---|
417 | }
|
---|
418 | #else
|
---|
419 | void
|
---|
420 | softfloat_commonNaNToF128M( const struct commonNaN *aPtr, uint32_t *zWPtr );
|
---|
421 | #endif
|
---|
422 |
|
---|
423 | /*----------------------------------------------------------------------------
|
---|
424 | | Assuming at least one of the two 128-bit floating-point values pointed to by
|
---|
425 | | 'aWPtr' and 'bWPtr' is a NaN, stores the combined NaN result at the location
|
---|
426 | | pointed to by 'zWPtr'. If either original floating-point value is a
|
---|
427 | | signaling NaN, the invalid exception is raised. Each of 'aWPtr', 'bWPtr',
|
---|
428 | | and 'zWPtr' points to an array of four 32-bit elements that concatenate in
|
---|
429 | | the platform's normal endian order to form a 128-bit floating-point value.
|
---|
430 | *----------------------------------------------------------------------------*/
|
---|
431 | void
|
---|
432 | softfloat_propagateNaNF128M(
|
---|
433 | const uint32_t *aWPtr, const uint32_t *bWPtr, uint32_t *zWPtr SOFTFLOAT_STATE_DECL_COMMA );
|
---|
434 |
|
---|
435 | #endif
|
---|
436 |
|
---|
437 | #endif
|
---|
438 |
|
---|