Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
internals.h
Go to the documentation of this file.
1
2/*============================================================================
3
4This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
5Package, Release 3e, by John R. Hauser.
6
7Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the
8University of California. All rights reserved.
9
10Redistribution and use in source and binary forms, with or without
11modification, 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
24THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
25EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
27DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
28DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31ON 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
33SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35=============================================================================*/
36
37#ifndef internals_h
38#define internals_h 1
39
40#include <stdbool.h>
41#include <stdint.h>
42#include "primitives.h"
43#include "softfloat_types.h"
44
48
49#ifdef SOFTFLOAT_FAST_INT64
50union extF80M_extF80 { struct extFloat80M fM; extFloat80_t f; };
51union ui128_f128 { struct uint128 ui; float128_t f; };
52#endif
53
54enum {
57};
58
59/*----------------------------------------------------------------------------
60*----------------------------------------------------------------------------*/
62
63#ifdef SOFTFLOAT_FAST_INT64
67#else
69#endif
70
72
73#ifdef SOFTFLOAT_FAST_INT64
77#else
79#endif
80
81/*----------------------------------------------------------------------------
82*----------------------------------------------------------------------------*/
83#define signF16UI( a ) ((bool) ((uint16_t) (a)>>15))
84#define expF16UI( a ) ((int_fast8_t) ((a)>>10) & 0x1F)
85#define fracF16UI( a ) ((a) & 0x03FF)
86#define packToF16UI( sign, exp, sig ) (((uint16_t) (sign)<<15) + ((uint16_t) (exp)<<10) + (sig))
87
88#define isNaNF16UI( a ) (((~(a) & 0x7C00) == 0) && ((a) & 0x03FF))
89
92
95
101
102/*----------------------------------------------------------------------------
103*----------------------------------------------------------------------------*/
104#define signF32UI( a ) ((bool) ((uint32_t) (a)>>31))
105#define expF32UI( a ) ((int_fast16_t) ((a)>>23) & 0xFF)
106#define fracF32UI( a ) ((a) & 0x007FFFFF)
107#define packToF32UI( sign, exp, sig ) (((uint32_t) (sign)<<31) + ((uint32_t) (exp)<<23) + (sig))
108
109#define isNaNF32UI( a ) (((~(a) & 0x7F800000) == 0) && ((a) & 0x007FFFFF))
110
113
116
122
123/*----------------------------------------------------------------------------
124*----------------------------------------------------------------------------*/
125#define signF64UI( a ) ((bool) ((uint64_t) (a)>>63))
126#define expF64UI( a ) ((int_fast16_t) ((a)>>52) & 0x7FF)
127#define fracF64UI( a ) ((a) & UINT64_C( 0x000FFFFFFFFFFFFF ))
128#define packToF64UI( sign, exp, sig ) ((uint64_t) (((uint_fast64_t) (sign)<<63) + ((uint_fast64_t) (exp)<<52) + (sig)))
129
130#define isNaNF64UI( a ) (((~(a) & UINT64_C( 0x7FF0000000000000 )) == 0) && ((a) & UINT64_C( 0x000FFFFFFFFFFFFF )))
131
134
137
143
144/*----------------------------------------------------------------------------
145*----------------------------------------------------------------------------*/
146#define signExtF80UI64( a64 ) ((bool) ((uint16_t) (a64)>>15))
147#define expExtF80UI64( a64 ) ((a64) & 0x7FFF)
148#define packToExtF80UI64( sign, exp ) ((uint_fast16_t) (sign)<<15 | (exp))
149
150#define isNaNExtF80UI( a64, a0 ) ((((a64) & 0x7FFF) == 0x7FFF) && ((a0) & UINT64_C( 0x7FFFFFFFFFFFFFFF )))
151
152#ifdef SOFTFLOAT_FAST_INT64
153
154/*----------------------------------------------------------------------------
155*----------------------------------------------------------------------------*/
156
157struct exp32_sig64 { int_fast32_t exp; uint64_t sig; };
159
166
173
174/*----------------------------------------------------------------------------
175*----------------------------------------------------------------------------*/
176#define signF128UI64( a64 ) ((bool) ((uint64_t) (a64)>>63))
177#define expF128UI64( a64 ) ((int_fast32_t) ((a64)>>48) & 0x7FFF)
178#define fracF128UI64( a64 ) ((a64) & UINT64_C( 0x0000FFFFFFFFFFFF ))
179#define packToF128UI64( sign, exp, sig64 ) (((uint_fast64_t) (sign)<<63) + ((uint_fast64_t) (exp)<<48) + (sig64))
180
181#define isNaNF128UI( a64, a0 ) (((~(a64) & UINT64_C( 0x7FFF000000000000 )) == 0) && (a0 || ((a64) & UINT64_C( 0x0000FFFFFFFFFFFF ))))
182
183struct exp32_sig128 { int_fast32_t exp; struct uint128 sig; };
184struct exp32_sig128
186
193
209 );
210
211#else
212
213/*----------------------------------------------------------------------------
214*----------------------------------------------------------------------------*/
215
216bool
218 const struct extFloat80M *,
219 const struct extFloat80M *,
220 struct extFloat80M *
221 );
223
225
226void
228 bool, int32_t, uint32_t *, uint_fast8_t, struct extFloat80M * );
229void
231 bool, int32_t, uint32_t *, uint_fast8_t, struct extFloat80M * );
232
233void
235 const struct extFloat80M *,
236 const struct extFloat80M *,
237 struct extFloat80M *,
238 bool
239 );
240
241int
243 const struct extFloat80M *, const struct extFloat80M * );
244
245/*----------------------------------------------------------------------------
246*----------------------------------------------------------------------------*/
247#define signF128UI96( a96 ) ((bool) ((uint32_t) (a96)>>31))
248#define expF128UI96( a96 ) ((int32_t) ((a96)>>16) & 0x7FFF)
249#define fracF128UI96( a96 ) ((a96) & 0x0000FFFF)
250#define packToF128UI96( sign, exp, sig96 ) (((uint32_t) (sign)<<31) + ((uint32_t) (exp)<<16) + (sig96))
251
252bool softfloat_isNaNF128M( const uint32_t * );
253
254bool
256 const uint32_t *, const uint32_t *, uint32_t * );
258
260
263
264void
265 softfloat_addF128M( const uint32_t *, const uint32_t *, uint32_t *, bool );
266void
268 const uint32_t *,
269 const uint32_t *,
270 const uint32_t *,
271 uint32_t *,
273 );
274
275#endif
276
277#endif
278
void softfloat_invalidF128M(uint32_t *)
int softfloat_compareNonnormExtF80M(const struct extFloat80M *, const struct extFloat80M *)
void softfloat_normRoundPackMToF128M(bool, int32_t, uint32_t *, uint32_t *)
float64_t softfloat_mulAddF64(uint_fast64_t, uint_fast64_t, uint_fast64_t, uint_fast8_t)
float32_t softfloat_addMagsF32(uint_fast32_t, uint_fast32_t)
bool softfloat_isNaNF128M(const uint32_t *)
void softfloat_roundPackMToF128M(bool, int32_t, uint32_t *, uint32_t *)
float64_t softfloat_roundPackToF64(bool, int_fast16_t, uint_fast64_t)
void softfloat_mulAddF128M(const uint32_t *, const uint32_t *, const uint32_t *, uint32_t *, uint_fast8_t)
int softfloat_shiftNormSigF128M(const uint32_t *, uint_fast8_t, uint32_t *)
void softfloat_normRoundPackMToExtF80M(bool, int32_t, uint32_t *, uint_fast8_t, struct extFloat80M *)
float16_t softfloat_roundPackToF16(bool, int_fast16_t, uint_fast16_t)
float64_t softfloat_subMagsF64(uint_fast64_t, uint_fast64_t, bool)
struct exp16_sig64 softfloat_normSubnormalF64Sig(uint_fast64_t)
float32_t softfloat_mulAddF32(uint_fast32_t, uint_fast32_t, uint_fast32_t, uint_fast8_t)
Definition s_mulAddF32.c:45
uint_fast64_t softfloat_roundMToUI64(bool, uint32_t *, uint_fast8_t, bool)
float64_t softfloat_addMagsF64(uint_fast64_t, uint_fast64_t, bool)
void softfloat_addF128M(const uint32_t *, const uint32_t *, uint32_t *, bool)
Definition s_addF128M.c:45
float32_t softfloat_roundPackToF32(bool, int_fast16_t, uint_fast32_t)
struct exp8_sig16 softfloat_normSubnormalF16Sig(uint_fast16_t)
struct exp16_sig32 softfloat_normSubnormalF32Sig(uint_fast32_t)
float64_t softfloat_normRoundPackToF64(bool, int_fast16_t, uint_fast64_t)
float16_t softfloat_subMagsF16(uint_fast16_t, uint_fast16_t)
bool softfloat_tryPropagateNaNF128M(const uint32_t *, const uint32_t *, uint32_t *)
void softfloat_invalidExtF80M(struct extFloat80M *)
float16_t softfloat_normRoundPackToF16(bool, int_fast16_t, uint_fast16_t)
void softfloat_roundPackMToExtF80M(bool, int32_t, uint32_t *, uint_fast8_t, struct extFloat80M *)
float32_t softfloat_normRoundPackToF32(bool, int_fast16_t, uint_fast32_t)
float32_t softfloat_subMagsF32(uint_fast32_t, uint_fast32_t)
uint_fast32_t softfloat_roundToUI32(bool, uint_fast64_t, uint_fast8_t, bool)
int_fast64_t softfloat_roundMToI64(bool, uint32_t *, uint_fast8_t, bool)
void softfloat_addExtF80M(const struct extFloat80M *, const struct extFloat80M *, struct extFloat80M *, bool)
bool softfloat_tryPropagateNaNExtF80M(const struct extFloat80M *, const struct extFloat80M *, struct extFloat80M *)
@ softfloat_mulAdd_subProd
Definition internals.h:56
@ softfloat_mulAdd_subC
Definition internals.h:55
int_fast32_t softfloat_roundToI32(bool, uint_fast64_t, uint_fast8_t, bool)
float16_t softfloat_addMagsF16(uint_fast16_t, uint_fast16_t)
float16_t softfloat_mulAddF16(uint_fast16_t, uint_fast16_t, uint_fast16_t, uint_fast8_t)
Definition s_mulAddF16.c:45
int softfloat_normExtF80SigM(uint64_t *)
extFloat80_t softfloat_addMagsExtF80(uint_fast16_t uiA64, uint_fast64_t uiA0, uint_fast16_t uiB64, uint_fast64_t uiB0, bool signZ)
float128_t softfloat_addMagsF128(uint_fast64_t uiA64, uint_fast64_t uiA0, uint_fast64_t uiB64, uint_fast64_t uiB0, bool signZ)
float128_t softfloat_mulAddF128(uint_fast64_t uiA64, uint_fast64_t uiA0, uint_fast64_t uiB64, uint_fast64_t uiB0, uint_fast64_t uiC64, uint_fast64_t uiC0, uint_fast8_t op)
extFloat80_t softfloat_normRoundPackToExtF80(bool sign, int_fast32_t exp, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingPrecision)
float128_t softfloat_normRoundPackToF128(bool sign, int_fast32_t exp, uint_fast64_t sig64, uint_fast64_t sig0)
struct exp32_sig64 softfloat_normSubnormalExtF80Sig(uint_fast64_t sig)
struct exp32_sig128 softfloat_normSubnormalF128Sig(uint_fast64_t sig64, uint_fast64_t sig0)
extFloat80_t softfloat_roundPackToExtF80(bool sign, int_fast32_t exp, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingPrecision)
float128_t softfloat_roundPackToF128(bool sign, int_fast32_t exp, uint_fast64_t sig64, uint_fast64_t sig0, uint_fast64_t sigExtra)
int_fast64_t softfloat_roundToI64(bool sign, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingMode, bool exact)
uint_fast64_t softfloat_roundToUI64(bool sign, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingMode, bool exact)
extFloat80_t softfloat_subMagsExtF80(uint_fast16_t uiA64, uint_fast64_t uiA0, uint_fast16_t uiB64, uint_fast64_t uiB0, bool signZ)
float128_t softfloat_subMagsF128(uint_fast64_t uiA64, uint_fast64_t uiA0, uint_fast64_t uiB64, uint_fast64_t uiB0, bool signZ)
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
uint32_t uint_fast32_t
Definition stdint.h:156
int32_t int_fast32_t
Definition stdint.h:152
int16_t int_fast16_t
Definition stdint.h:151
signed int int32_t
Definition stdint.h:123
uint8_t uint_fast8_t
Definition stdint.h:154
unsigned __int64 uint64_t
Definition stdint.h:136
int64_t int_fast64_t
Definition stdint.h:153
uint_fast32_t sig
Definition internals.h:111
int_fast16_t exp
Definition internals.h:111
int_fast16_t exp
Definition internals.h:132
uint_fast64_t sig
Definition internals.h:132
int_fast8_t exp
Definition internals.h:90
uint_fast16_t sig
Definition internals.h:90
uint16_t ui
Definition internals.h:45
float16_t f
Definition internals.h:45
uint32_t ui
Definition internals.h:46
float32_t f
Definition internals.h:46
float64_t f
Definition internals.h:47
uint64_t ui
Definition internals.h:47