aboutsummaryrefslogtreecommitdiff
path: root/fpu/softfloat.c
diff options
context:
space:
mode:
authorLucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>2022-08-05 11:15:21 -0300
committerDaniel Henrique Barboza <danielhb413@gmail.com>2022-08-31 14:08:05 -0300
commitc40da5c6fb6dd243e906900de1d22cf20e32a8cd (patch)
tree8cb7144ea5d9f025bcc0fb5d574abf5a544046f9 /fpu/softfloat.c
parent0bf4d77e5922128506a3495d72ee9f432726c085 (diff)
fpu: Add rebias bool, value and operation
Added the possibility of recalculating a result if it overflows or underflows, if the result overflow and the rebias bool is true then the intermediate result should have 3/4 of the total range subtracted from the exponent. The same for underflow but it should be added to the exponent of the intermediate number instead. Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220805141522.412864-2-lucas.araujo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'fpu/softfloat.c')
-rw-r--r--fpu/softfloat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 4a871ef2a1..c7454c3eb1 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -521,6 +521,7 @@ typedef struct {
typedef struct {
int exp_size;
int exp_bias;
+ int exp_re_bias;
int exp_max;
int frac_size;
int frac_shift;
@@ -532,6 +533,7 @@ typedef struct {
#define FLOAT_PARAMS_(E) \
.exp_size = E, \
.exp_bias = ((1 << E) - 1) >> 1, \
+ .exp_re_bias = (1 << (E - 1)) + (1 << (E - 2)), \
.exp_max = (1 << E) - 1
#define FLOAT_PARAMS(E, F) \