diff options
author | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2022-02-02 11:17:23 +0100 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-02-04 19:37:25 -0500 |
commit | b6af5f3a74d9ed8d78e2467a895d5ae0b732f114 (patch) | |
tree | 59400b169106b1e869e46b9cf77d58b967ffc664 /sim/common/sim-fpu.h | |
parent | bf484e93483776072291c5cad2e289567d74c818 (diff) | |
download | gdb-b6af5f3a74d9ed8d78e2467a895d5ae0b732f114.zip gdb-b6af5f3a74d9ed8d78e2467a895d5ae0b732f114.tar.gz gdb-b6af5f3a74d9ed8d78e2467a895d5ae0b732f114.tar.bz2 |
sim: Factor out NaN handling in floating point operations
2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com>
sim/common/ChangeLog:
* sim-fpu.c (sim_fpu_op_nan): New.
(sim_fpu_add): Factor out NaN operand handling with
a call to sim_fpu_op_nan.
(sim_fpu_sub, sim_fpu_mul, sim_fpu_div): Likewise.
(sim_fpu_rem, sim_fpu_max, sim_fpu_min): Likewise.
* sim-fpu.h (sim_fpu_op_nan): New declaration.
Diffstat (limited to 'sim/common/sim-fpu.h')
-rw-r--r-- | sim/common/sim-fpu.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sim/common/sim-fpu.h b/sim/common/sim-fpu.h index b0b318c..2a14198 100644 --- a/sim/common/sim-fpu.h +++ b/sim/common/sim-fpu.h @@ -261,6 +261,16 @@ INLINE_SIM_FPU (int) sim_fpu_sqrt (sim_fpu *f, +/* NaN handling. + + Assuming that at least one of the inputs is NAN choose the correct + NAN result for the binary operation. */ + +INLINE_SIM_FPU (int) sim_fpu_op_nan (sim_fpu *f, + const sim_fpu *l, const sim_fpu *r); + + + /* Conversion of integer <-> floating point. */ INLINE_SIM_FPU (int) sim_fpu_i32to (sim_fpu *f, int32_t i, |