Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
specialize.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat.h"
Include dependency graph for specialize.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  commonNaN
 

Macros

#define init_detectTininess   softfloat_tininess_beforeRounding
 
#define ui32_fromPosOverflow   0xFFFFFFFF
 
#define ui32_fromNegOverflow   0
 
#define ui32_fromNaN   0
 
#define i32_fromPosOverflow   0x7FFFFFFF
 
#define i32_fromNegOverflow   (-0x7FFFFFFF - 1)
 
#define i32_fromNaN   0
 
#define ui64_fromPosOverflow   UINT64_C( 0xFFFFFFFFFFFFFFFF )
 
#define ui64_fromNegOverflow   0
 
#define ui64_fromNaN   0
 
#define i64_fromPosOverflow   INT64_C( 0x7FFFFFFFFFFFFFFF )
 
#define i64_fromNegOverflow   (-INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1)
 
#define i64_fromNaN   0
 
#define defaultNaNF16UI   0x7E00
 
#define softfloat_isSigNaNF16UI(uiA)
 
#define defaultNaNF32UI   0x7FC00000
 
#define softfloat_isSigNaNF32UI(uiA)
 
#define defaultNaNF64UI   UINT64_C( 0x7FF8000000000000 )
 
#define softfloat_isSigNaNF64UI(uiA)
 
#define defaultNaNExtF80UI64   0x7FFF
 
#define defaultNaNExtF80UI0   UINT64_C( 0xC000000000000000 )
 
#define softfloat_isSigNaNExtF80UI(uiA64, uiA0)
 
#define defaultNaNF128UI96   0x7FFF8000
 
#define defaultNaNF128UI64   0
 
#define defaultNaNF128UI32   0
 
#define defaultNaNF128UI0   0
 

Functions

void softfloat_f16UIToCommonNaN (uint_fast16_t uiA, struct commonNaN *zPtr)
 
uint_fast16_t softfloat_commonNaNToF16UI (const struct commonNaN *aPtr)
 
uint_fast16_t softfloat_propagateNaNF16UI (uint_fast16_t uiA, uint_fast16_t uiB)
 
void softfloat_f32UIToCommonNaN (uint_fast32_t uiA, struct commonNaN *zPtr)
 
uint_fast32_t softfloat_commonNaNToF32UI (const struct commonNaN *aPtr)
 
uint_fast32_t softfloat_propagateNaNF32UI (uint_fast32_t uiA, uint_fast32_t uiB)
 
void softfloat_f64UIToCommonNaN (uint_fast64_t uiA, struct commonNaN *zPtr)
 
uint_fast64_t softfloat_commonNaNToF64UI (const struct commonNaN *aPtr)
 
uint_fast64_t softfloat_propagateNaNF64UI (uint_fast64_t uiA, uint_fast64_t uiB)
 
void softfloat_extF80MToCommonNaN (const struct extFloat80M *aSPtr, struct commonNaN *zPtr)
 
void softfloat_commonNaNToExtF80M (const struct commonNaN *aPtr, struct extFloat80M *zSPtr)
 
void softfloat_propagateNaNExtF80M (const struct extFloat80M *aSPtr, const struct extFloat80M *bSPtr, struct extFloat80M *zSPtr)
 
void softfloat_f128MToCommonNaN (const uint32_t *aWPtr, struct commonNaN *zPtr)
 
void softfloat_commonNaNToF128M (const struct commonNaN *aPtr, uint32_t *zWPtr)
 
void softfloat_propagateNaNF128M (const uint32_t *aWPtr, const uint32_t *bWPtr, uint32_t *zWPtr)
 

Macro Definition Documentation

◆ defaultNaNExtF80UI0

#define defaultNaNExtF80UI0   UINT64_C( 0xC000000000000000 )

Definition at line 194 of file specialize.h.

◆ defaultNaNExtF80UI64

#define defaultNaNExtF80UI64   0x7FFF

Definition at line 193 of file specialize.h.

◆ defaultNaNF128UI0

#define defaultNaNF128UI0   0

Definition at line 339 of file specialize.h.

◆ defaultNaNF128UI32

#define defaultNaNF128UI32   0

Definition at line 338 of file specialize.h.

◆ defaultNaNF128UI64

#define defaultNaNF128UI64   0

Definition at line 337 of file specialize.h.

◆ defaultNaNF128UI96

#define defaultNaNF128UI96   0x7FFF8000

Definition at line 336 of file specialize.h.

◆ defaultNaNF16UI

#define defaultNaNF16UI   0x7E00

Definition at line 88 of file specialize.h.

◆ defaultNaNF32UI

#define defaultNaNF32UI   0x7FC00000

Definition at line 123 of file specialize.h.

◆ defaultNaNF64UI

#define defaultNaNF64UI   UINT64_C( 0x7FF8000000000000 )

Definition at line 158 of file specialize.h.

◆ i32_fromNaN

#define i32_fromNaN   0

Definition at line 59 of file specialize.h.

◆ i32_fromNegOverflow

#define i32_fromNegOverflow   (-0x7FFFFFFF - 1)

Definition at line 58 of file specialize.h.

◆ i32_fromPosOverflow

#define i32_fromPosOverflow   0x7FFFFFFF

Definition at line 57 of file specialize.h.

◆ i64_fromNaN

#define i64_fromNaN   0

Definition at line 70 of file specialize.h.

◆ i64_fromNegOverflow

#define i64_fromNegOverflow   (-INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1)

Definition at line 69 of file specialize.h.

◆ i64_fromPosOverflow

#define i64_fromPosOverflow   INT64_C( 0x7FFFFFFFFFFFFFFF )

Definition at line 68 of file specialize.h.

◆ init_detectTininess

#define init_detectTininess   softfloat_tininess_beforeRounding

Definition at line 48 of file specialize.h.

◆ softfloat_isSigNaNExtF80UI

#define softfloat_isSigNaNExtF80UI ( uiA64,
uiA0 )
Value:
((((uiA64) & 0x7FFF) == 0x7FFF) && ! ((uiA0) & UINT64_C( 0x4000000000000000 )) && ((uiA0) & UINT64_C( 0x3FFFFFFFFFFFFFFF )))
#define UINT64_C(val)
Definition stdint.h:284

Definition at line 202 of file specialize.h.

◆ softfloat_isSigNaNF16UI

#define softfloat_isSigNaNF16UI ( uiA)
Value:
((((uiA) & 0x7E00) == 0x7C00) && ((uiA) & 0x01FF))

Definition at line 95 of file specialize.h.

◆ softfloat_isSigNaNF32UI

#define softfloat_isSigNaNF32UI ( uiA)
Value:
((((uiA) & 0x7FC00000) == 0x7F800000) && ((uiA) & 0x003FFFFF))

Definition at line 130 of file specialize.h.

◆ softfloat_isSigNaNF64UI

#define softfloat_isSigNaNF64UI ( uiA)
Value:
((((uiA) & UINT64_C( 0x7FF8000000000000 )) == UINT64_C( 0x7FF0000000000000 )) && ((uiA) & UINT64_C( 0x0007FFFFFFFFFFFF )))

Definition at line 165 of file specialize.h.

◆ ui32_fromNaN

#define ui32_fromNaN   0

Definition at line 56 of file specialize.h.

◆ ui32_fromNegOverflow

#define ui32_fromNegOverflow   0

Definition at line 55 of file specialize.h.

◆ ui32_fromPosOverflow

#define ui32_fromPosOverflow   0xFFFFFFFF

Definition at line 54 of file specialize.h.

◆ ui64_fromNaN

#define ui64_fromNaN   0

Definition at line 67 of file specialize.h.

◆ ui64_fromNegOverflow

#define ui64_fromNegOverflow   0

Definition at line 66 of file specialize.h.

◆ ui64_fromPosOverflow

#define ui64_fromPosOverflow   UINT64_C( 0xFFFFFFFFFFFFFFFF )

Definition at line 65 of file specialize.h.

Function Documentation

◆ softfloat_commonNaNToExtF80M()

void softfloat_commonNaNToExtF80M ( const struct commonNaN * aPtr,
struct extFloat80M * zSPtr )

Definition at line 48 of file s_commonNaNToExtF80M.c.

50{
51
52 zSPtr->signExp = packToExtF80UI64( aPtr->sign, 0x7FFF );
53 zSPtr->signif = UINT64_C( 0xC000000000000000 ) | aPtr->v64>>1;
54
55}
#define packToExtF80UI64(sign, exp)
Definition internals.h:148
uint64_t v64
Definition specialize.h:81
bool sign
Definition specialize.h:77
uint64_t signif
uint16_t signExp

◆ softfloat_commonNaNToF128M()

void softfloat_commonNaNToF128M ( const struct commonNaN * aPtr,
uint32_t * zWPtr )

Definition at line 49 of file s_commonNaNToF128M.c.

50{
51
52 softfloat_shortShiftRight128M( (const uint32_t *) &aPtr->v0, 16, zWPtr );
53 zWPtr[indexWordHi( 4 )] |= (uint32_t) aPtr->sign<<31 | 0x7FFF8000;
54
55}
#define indexWordHi(total)
#define softfloat_shortShiftRight128M(aPtr, dist, zPtr)
Definition primitives.h:782
unsigned int uint32_t
Definition stdint.h:126
uint64_t v0
Definition specialize.h:81

◆ softfloat_commonNaNToF16UI()

uint_fast16_t softfloat_commonNaNToF16UI ( const struct commonNaN * aPtr)

Definition at line 45 of file s_commonNaNToF16UI.c.

46{
47
48 return (uint_fast16_t) aPtr->sign<<15 | 0x7E00 | aPtr->v64>>54;
49
50}
uint16_t uint_fast16_t
Definition stdint.h:155

◆ softfloat_commonNaNToF32UI()

uint_fast32_t softfloat_commonNaNToF32UI ( const struct commonNaN * aPtr)

Definition at line 45 of file s_commonNaNToF32UI.c.

46{
47
48 return (uint_fast32_t) aPtr->sign<<31 | 0x7FC00000 | aPtr->v64>>41;
49
50}
uint32_t uint_fast32_t
Definition stdint.h:156

◆ softfloat_commonNaNToF64UI()

uint_fast64_t softfloat_commonNaNToF64UI ( const struct commonNaN * aPtr)

Definition at line 45 of file s_commonNaNToF64UI.c.

46{
47
48 return
49 (uint_fast64_t) aPtr->sign<<63 | UINT64_C( 0x7FF8000000000000 )
50 | aPtr->v64>>12;
51
52}
uint64_t uint_fast64_t
Definition stdint.h:157

◆ softfloat_extF80MToCommonNaN()

void softfloat_extF80MToCommonNaN ( const struct extFloat80M * aSPtr,
struct commonNaN * zPtr )

Definition at line 50 of file s_extF80MToCommonNaN.c.

52{
53
54 if ( extF80M_isSignalingNaN( (const extFloat80_t *) aSPtr ) ) {
56 }
57 zPtr->sign = signExtF80UI64( aSPtr->signExp );
58 zPtr->v64 = aSPtr->signif<<1;
59 zPtr->v0 = 0;
60
61}
bool extF80M_isSignalingNaN(const extFloat80_t *aPtr)
void softfloat_raiseFlags(uint_fast8_t flags)
#define signExtF80UI64(a64)
Definition internals.h:146
@ softfloat_flag_invalid
Definition softfloat.h:89

◆ softfloat_f128MToCommonNaN()

void softfloat_f128MToCommonNaN ( const uint32_t * aWPtr,
struct commonNaN * zPtr )

Definition at line 52 of file s_f128MToCommonNaN.c.

53{
54
55 if ( f128M_isSignalingNaN( (const float128_t *) aWPtr ) ) {
57 }
58 zPtr->sign = aWPtr[indexWordHi( 4 )]>>31;
59 softfloat_shortShiftLeft128M( aWPtr, 16, (uint32_t *) &zPtr->v0 );
60
61}
bool f128M_isSignalingNaN(const float128_t *aPtr)
#define softfloat_shortShiftLeft128M(aPtr, dist, zPtr)
Definition primitives.h:703

◆ softfloat_f16UIToCommonNaN()

void softfloat_f16UIToCommonNaN ( uint_fast16_t uiA,
struct commonNaN * zPtr )

Definition at line 48 of file s_f16UIToCommonNaN.c.

49{
50
51 if ( softfloat_isSigNaNF16UI( uiA ) ) {
53 }
54 zPtr->sign = uiA>>15;
55 zPtr->v64 = (uint_fast64_t) uiA<<54;
56 zPtr->v0 = 0;
57
58}
#define softfloat_isSigNaNF16UI(uiA)
Definition specialize.h:95

◆ softfloat_f32UIToCommonNaN()

void softfloat_f32UIToCommonNaN ( uint_fast32_t uiA,
struct commonNaN * zPtr )

Definition at line 48 of file s_f32UIToCommonNaN.c.

49{
50
51 if ( softfloat_isSigNaNF32UI( uiA ) ) {
53 }
54 zPtr->sign = uiA>>31;
55 zPtr->v64 = (uint_fast64_t) uiA<<41;
56 zPtr->v0 = 0;
57
58}
#define softfloat_isSigNaNF32UI(uiA)
Definition specialize.h:130

◆ softfloat_f64UIToCommonNaN()

void softfloat_f64UIToCommonNaN ( uint_fast64_t uiA,
struct commonNaN * zPtr )

Definition at line 48 of file s_f64UIToCommonNaN.c.

49{
50
51 if ( softfloat_isSigNaNF64UI( uiA ) ) {
53 }
54 zPtr->sign = uiA>>63;
55 zPtr->v64 = uiA<<12;
56 zPtr->v0 = 0;
57
58}
#define softfloat_isSigNaNF64UI(uiA)
Definition specialize.h:165

◆ softfloat_propagateNaNExtF80M()

void softfloat_propagateNaNExtF80M ( const struct extFloat80M * aSPtr,
const struct extFloat80M * bSPtr,
struct extFloat80M * zSPtr )

Definition at line 51 of file s_propagateNaNExtF80M.c.

56{
57 bool isSigNaNA;
58 const struct extFloat80M *sPtr;
59 bool isSigNaNB;
60 uint_fast16_t uiB64;
61 uint64_t uiB0;
62 uint_fast16_t uiA64;
63 uint64_t uiA0;
64 uint_fast16_t uiMagA64, uiMagB64;
65
66 isSigNaNA = extF80M_isSignalingNaN( (const extFloat80_t *) aSPtr );
67 sPtr = aSPtr;
68 if ( ! bSPtr ) {
70 goto copy;
71 }
72 isSigNaNB = extF80M_isSignalingNaN( (const extFloat80_t *) bSPtr );
73 if ( isSigNaNA | isSigNaNB ) {
75 if ( isSigNaNA ) {
76 uiB64 = bSPtr->signExp;
77 if ( isSigNaNB ) goto returnLargerUIMag;
78 uiB0 = bSPtr->signif;
79 if ( isNaNExtF80UI( uiB64, uiB0 ) ) goto copyB;
80 goto copy;
81 } else {
82 uiA64 = aSPtr->signExp;
83 uiA0 = aSPtr->signif;
84 if ( isNaNExtF80UI( uiA64, uiA0 ) ) goto copy;
85 goto copyB;
86 }
87 }
88 uiB64 = bSPtr->signExp;
89 returnLargerUIMag:
90 uiA64 = aSPtr->signExp;
91 uiMagA64 = uiA64 & 0x7FFF;
92 uiMagB64 = uiB64 & 0x7FFF;
93 if ( uiMagA64 < uiMagB64 ) goto copyB;
94 if ( uiMagB64 < uiMagA64 ) goto copy;
95 uiA0 = aSPtr->signif;
96 uiB0 = bSPtr->signif;
97 if ( uiA0 < uiB0 ) goto copyB;
98 if ( uiB0 < uiA0 ) goto copy;
99 if ( uiA64 < uiB64 ) goto copy;
100 copyB:
101 sPtr = bSPtr;
102 copy:
103 zSPtr->signExp = sPtr->signExp;
104 zSPtr->signif = sPtr->signif | UINT64_C( 0xC000000000000000 );
105
106}
void copy(const path &from, const path &to)
#define isNaNExtF80UI(a64, a0)
Definition internals.h:150
unsigned __int64 uint64_t
Definition stdint.h:136

◆ softfloat_propagateNaNF128M()

void softfloat_propagateNaNF128M ( const uint32_t * aWPtr,
const uint32_t * bWPtr,
uint32_t * zWPtr )

Definition at line 53 of file s_propagateNaNF128M.c.

55{
56 bool isSigNaNA;
57 const uint32_t *ptr;
58
59 ptr = aWPtr;
60 isSigNaNA = f128M_isSignalingNaN( (const float128_t *) aWPtr );
61 if (
62 isSigNaNA
63 || (bWPtr && f128M_isSignalingNaN( (const float128_t *) bWPtr ))
64 ) {
66 if ( isSigNaNA ) goto copy;
67 }
68 if ( ! softfloat_isNaNF128M( aWPtr ) ) ptr = bWPtr;
69 copy:
70 zWPtr[indexWordHi( 4 )] = ptr[indexWordHi( 4 )] | 0x00008000;
71 zWPtr[indexWord( 4, 2 )] = ptr[indexWord( 4, 2 )];
72 zWPtr[indexWord( 4, 1 )] = ptr[indexWord( 4, 1 )];
73 zWPtr[indexWord( 4, 0 )] = ptr[indexWord( 4, 0 )];
74
75}
bool softfloat_isNaNF128M(const uint32_t *)
#define indexWord(total, n)

◆ softfloat_propagateNaNF16UI()

uint_fast16_t softfloat_propagateNaNF16UI ( uint_fast16_t uiA,
uint_fast16_t uiB )

Definition at line 51 of file s_propagateNaNF16UI.c.

52{
53 bool isSigNaNA;
54
55 isSigNaNA = softfloat_isSigNaNF16UI( uiA );
56 if ( isSigNaNA || softfloat_isSigNaNF16UI( uiB ) ) {
58 if ( isSigNaNA ) return uiA | 0x0200;
59 }
60 return (isNaNF16UI( uiA ) ? uiA : uiB) | 0x0200;
61
62}
#define isNaNF16UI(a)
Definition internals.h:88

◆ softfloat_propagateNaNF32UI()

uint_fast32_t softfloat_propagateNaNF32UI ( uint_fast32_t uiA,
uint_fast32_t uiB )

Definition at line 51 of file s_propagateNaNF32UI.c.

52{
53 bool isSigNaNA;
54
55 isSigNaNA = softfloat_isSigNaNF32UI( uiA );
56 if ( isSigNaNA || softfloat_isSigNaNF32UI( uiB ) ) {
58 if ( isSigNaNA ) return uiA | 0x00400000;
59 }
60 return (isNaNF32UI( uiA ) ? uiA : uiB) | 0x00400000;
61
62}
#define isNaNF32UI(a)
Definition internals.h:109

◆ softfloat_propagateNaNF64UI()

uint_fast64_t softfloat_propagateNaNF64UI ( uint_fast64_t uiA,
uint_fast64_t uiB )

Definition at line 51 of file s_propagateNaNF64UI.c.

52{
53 bool isSigNaNA;
54
55 isSigNaNA = softfloat_isSigNaNF64UI( uiA );
56 if ( isSigNaNA || softfloat_isSigNaNF64UI( uiB ) ) {
58 if ( isSigNaNA ) return uiA | UINT64_C( 0x0008000000000000 );
59 }
60 return (isNaNF64UI( uiA ) ? uiA : uiB) | UINT64_C( 0x0008000000000000 );
61
62}
#define isNaNF64UI(a)
Definition internals.h:130