Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_addMagsExtF80.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
#include "softfloat.h"
Include dependency graph for s_addMagsExtF80.c:

Go to the source code of this file.

Functions

extFloat80_t softfloat_addMagsExtF80 (uint_fast16_t uiA64, uint_fast64_t uiA0, uint_fast16_t uiB64, uint_fast64_t uiB0, bool signZ)
 

Function Documentation

◆ softfloat_addMagsExtF80()

extFloat80_t softfloat_addMagsExtF80 ( uint_fast16_t uiA64,
uint_fast64_t uiA0,
uint_fast16_t uiB64,
uint_fast64_t uiB0,
bool signZ )

Definition at line 45 of file s_addMagsExtF80.c.

52{
53 int_fast32_t expA;
54 uint_fast64_t sigA;
55 int_fast32_t expB;
56 uint_fast64_t sigB;
57 int_fast32_t expDiff;
58 uint_fast16_t uiZ64;
59 uint_fast64_t uiZ0, sigZ, sigZExtra;
60 struct exp32_sig64 normExpSig;
61 int_fast32_t expZ;
62 struct uint64_extra sig64Extra;
63 struct uint128 uiZ;
64 union { struct extFloat80M s; extFloat80_t f; } uZ;
65
66 /*------------------------------------------------------------------------
67 *------------------------------------------------------------------------*/
68 expA = expExtF80UI64( uiA64 );
69 sigA = uiA0;
70 expB = expExtF80UI64( uiB64 );
71 sigB = uiB0;
72 /*------------------------------------------------------------------------
73 *------------------------------------------------------------------------*/
74 expDiff = expA - expB;
75 if ( ! expDiff ) {
76 if ( expA == 0x7FFF ) {
77 if ( (sigA | sigB) & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) {
78 goto propagateNaN;
79 }
80 uiZ64 = uiA64;
81 uiZ0 = uiA0;
82 goto uiZ;
83 }
84 sigZ = sigA + sigB;
85 sigZExtra = 0;
86 if ( ! expA ) {
87 normExpSig = softfloat_normSubnormalExtF80Sig( sigZ );
88 expZ = normExpSig.exp + 1;
89 sigZ = normExpSig.sig;
90 goto roundAndPack;
91 }
92 expZ = expA;
93 goto shiftRight1;
94 }
95 /*------------------------------------------------------------------------
96 *------------------------------------------------------------------------*/
97 if ( expDiff < 0 ) {
98 if ( expB == 0x7FFF ) {
99 if ( sigB & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) goto propagateNaN;
100 uiZ64 = packToExtF80UI64( signZ, 0x7FFF );
101 uiZ0 = uiB0;
102 goto uiZ;
103 }
104 expZ = expB;
105 if ( ! expA ) {
106 ++expDiff;
107 sigZExtra = 0;
108 if ( ! expDiff ) goto newlyAligned;
109 }
110 sig64Extra = softfloat_shiftRightJam64Extra( sigA, 0, -expDiff );
111 sigA = sig64Extra.v;
112 sigZExtra = sig64Extra.extra;
113 } else {
114 if ( expA == 0x7FFF ) {
115 if ( sigA & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) goto propagateNaN;
116 uiZ64 = uiA64;
117 uiZ0 = uiA0;
118 goto uiZ;
119 }
120 expZ = expA;
121 if ( ! expB ) {
122 --expDiff;
123 sigZExtra = 0;
124 if ( ! expDiff ) goto newlyAligned;
125 }
126 sig64Extra = softfloat_shiftRightJam64Extra( sigB, 0, expDiff );
127 sigB = sig64Extra.v;
128 sigZExtra = sig64Extra.extra;
129 }
130 newlyAligned:
131 sigZ = sigA + sigB;
132 if ( sigZ & UINT64_C( 0x8000000000000000 ) ) goto roundAndPack;
133 /*------------------------------------------------------------------------
134 *------------------------------------------------------------------------*/
135 shiftRight1:
136 sig64Extra = softfloat_shortShiftRightJam64Extra( sigZ, sigZExtra, 1 );
137 sigZ = sig64Extra.v | UINT64_C( 0x8000000000000000 );
138 sigZExtra = sig64Extra.extra;
139 ++expZ;
140 roundAndPack:
141 return
143 signZ, expZ, sigZ, sigZExtra, extF80_roundingPrecision );
144 /*------------------------------------------------------------------------
145 *------------------------------------------------------------------------*/
146 propagateNaN:
147 uiZ = softfloat_propagateNaNExtF80UI( uiA64, uiA0, uiB64, uiB0 );
148 uiZ64 = uiZ.v64;
149 uiZ0 = uiZ.v0;
150 uiZ:
151 uZ.s.signExp = uiZ64;
152 uZ.s.signif = uiZ0;
153 return uZ.f;
154
155}
struct uint128 softfloat_propagateNaNExtF80UI(uint_fast16_t uiA64, uint_fast64_t uiA0, uint_fast16_t uiB64, uint_fast64_t uiB0)
#define packToExtF80UI64(sign, exp)
Definition internals.h:148
#define expExtF80UI64(a64)
Definition internals.h:147
THREAD_LOCAL uint_fast8_t extF80_roundingPrecision
struct exp32_sig64 softfloat_normSubnormalExtF80Sig(uint_fast64_t sig)
extFloat80_t softfloat_roundPackToExtF80(bool sign, int_fast32_t exp, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingPrecision)
struct uint64_extra softfloat_shiftRightJam64Extra(uint64_t a, uint64_t extra, uint_fast32_t dist)
struct uint64_extra softfloat_shortShiftRightJam64Extra(uint64_t a, uint64_t extra, uint_fast8_t dist)
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
#define UINT64_C(val)
Definition stdint.h:284
int32_t int_fast32_t
Definition stdint.h:152
char * s
Here is the call graph for this function:
Here is the caller graph for this function: