aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-fpu.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-02-04sim: Add partial support for IEEE 754-2008Faraz Shahbazker1-4/+106
2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-fpu.c (sim_fpu_minmax_nan): New. (sim_fpu_max): Add variant behaviour for IEEE 754-2008. (sim_fpu_min): Likewise. (sim_fpu_is_un, sim_fpu_is_or): New. (sim_fpu_un, sim_fpu_or): New. (sim_fpu_is_ieee754_2008, sim_fpu_is_ieee754_1985): New. (sim_fpu_set_mode): New. (sim_fpu_classify): New. * sim-fpu.h (sim_fpu_minmax_nan): New declaration. (sim_fpu_un, sim_fpu_or): New declarations. (sim_fpu_is_un, sim_fpu_is_or): New declarations. (sim_fpu_mode): New enum. [sim_fpu_state](current_mode): New field. (sim_fpu_current_mode): New define. (sim_fpu_is_ieee754_2008): New declaration. (sim_fpu_is_ieee754_1985): New declaration. (sim_fpu_set_mode): New declaration. (sim_fpu_classify): New declaration.
2022-02-04sim: Factor out NaN handling in floating point operationsFaraz Shahbazker1-158/+31
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.
2022-02-04sim: Allow toggling of quiet NaN-bit semanticsFaraz Shahbazker1-15/+16
IEEE754-1985 specifies the top bit of the mantissa as an indicator of signalling vs. quiet NaN, but does not define the precise semantics. Most architectures treat this bit as indicating quiet NaN, but legacy (pre-R6) MIPS goes the other way and treats it as signalling NaN. This used to be controlled by a macro that was only defined for MIPS. This patch replaces the macro with a variable to track the current semantics of the NaN bit and allows differentiation between older (pre-R6) and and newer MIPS cores. 2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-fpu.c (_sim_fpu): New. (pack_fpu, unpack_fpu): Allow reversal of quiet NaN semantics. * sim-fpu.h (sim_fpu_state): New struct. (_sim_fpu): New extern. (sim_fpu_quiet_nan_inverted): New define. sim/mips/ChangeLog: * cp1.h (fcsr_NAN2008_mask, fcsr_NAN2008_shift): New. * mips.igen (check_fpu): Select default quiet NaN mode for legacy MIPS. * sim-main.h (SIM_QUIET_NAN_NEGATED): Remove.
2022-01-06sim: common: migrate to standard uintXX_t typesMike Frysinger1-78/+78
Drop the sim-specific unsignedXX types and move to the standard uintXX_t types that C11 provides.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-04sim: reorder header includesMike Frysinger1-2/+2
We're including system headers after local headers in a bunch of places, but this leads to conflicts when our local headers happen to define symbols that show up in the system headers. Use the more standard order of: * config.h (via defs.h) * system headers * local library headers (e.g. bfd & libiberty) * sim specific headers
2021-05-16sim: switch config.h usage to defs.hMike Frysinger1-0/+3
The defs.h header will take care of including the various config.h headers. For now, it's just config.h, but we'll add more when we integrate gnulib in. This header should be used instead of config.h, and should be the first include in every .c file. We won't rely on the old behavior where we expected files to include the port's sim-main.h which then includes the common sim-basics.h which then includes config.h. We have a ton of code that includes things before sim-main.h, and it sometimes needs to be that way. Creating a dedicated header avoids the ordering mess and implicit inclusion that shows up otherwise.
2021-01-11sim: clean up C11 header includesMike Frysinger1-2/+0
Since we require C11 now, we can assume many headers exist, and clean up all of the conditional includes. It's not like any of this code actually accounted for the headers not existing, just whether we could include them. The strings.h cleanup is a little nuanced: it isn't in C11, but every use of it in the codebase will include strings.h only if string.h doesn't exist. Since we now assume the C11 string.h exists, we'll never include strings.h, so we can delete it.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-03-28sim/common: Fix warnings: "warning: implicit declaration of function..."Stafford Horne1-0/+3
During building of several cgen simulator's I notices the below warnings. Adding includes fixes these. Including config.h allows stdio.h to properly configure itself to expose asprintf(). The other warnings for abort, free, memset, strlen are trivial. Warnings: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration] if (asprintf (&name, "watch-%s-%s", ^~~~~~~~ vasprintf ../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’: ../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] char *dup = hw_zalloc (me, strlen (str) + 1); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’: ../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration] memset (&dummy, 0, sizeof dummy); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’: ../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration] free (delete); ^~~~ ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’: ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration] abort (); ^~~~~ sim/common/ChangeLog: * sim-options.c: Include "config.h". Include <stdio.h>. * sim-watch.c: Include "config.h". Include <stdio.h>. * hw-device.c: Include <string.h>. * hw-events.c: Include <string.h>. * hw-handles.c: Include <stdlib.h>. * sim-fpu.c: Include <stdlib.h>.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-12-12sim: cgen: add remainder functions (needed for OR1K lf.rem.[sd])Peter Gavin1-0/+86
* sim/common/ChangeLog: 2017-12-12 Peter Gavin <pgavin@gmail.com> Stafford Horne <shorne@gmail.com> * cgen-accfp.c (remsf, remdf): New function. (cgen_init_accurate_fpu): Add remsf and remdf. * cgen-fpu.h (cgen_fp_ops): Add remsf, remdf, remxf and remtf. * sim-fpu.c (sim_fpu_rem): New function. * sim-fpu.h (sim_fpu_status_invalid_irx): New enum. (sim_fpu_rem): New function. (sim_fpu_print_status): Add case for sim_fpu_status_invalid_irx.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-01-17Minor comment fixes in sim/common/sim-fpu.c.Joel Brobecker1-67/+67
This patch makes a fair number of fixes in the various comments of sim-fpu.c, mostly to either better conform to the GNU Coding Standards (sentences start with a capital letter, end with a period), or to fix spelling mistakes. sim/common/ChangeLog: * sim-fpu.c: Minor comment fixes throughout.
2016-01-17minor reformatting in sim/common/sim-fpu.c.Joel Brobecker1-2/+4
This patch just makes a copy of formatting changes to better conform with the GNU Coding Style. sim/common/ChangeLog: * sim-fpu.c (print_bits): Minor reformatting (no code change). (sim_fpu_map): Likewise.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-04-29Fix problems in the sim sources discovered by running the cppcheck static ↵Nick Clifton1-2/+2
analysis tool. erc32 PR 18273 * sis.c (main): Remove unreachable code. m68hc11 * gencode.c (gen_fetch_operands): Remove unreachable code. ppc * hw_htab.c (htab_map_binary): Fix overlap check. common * sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by increasing parenthesis around casts to signed values.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-2/+1
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-01-02Update the copyright header of various files...Joel Brobecker1-1/+1
... to follow the correct syntax (according to the gospel of gnulib's update-copyright). In other words: - no comma after the last year; - FSF spelled exactly "Free Software Foundation, Inc.", with the comma and the period at the end. sim/common/ChangeLog: * dv-sockser.h, sim-assert.h, sim-fpu.c: Reformat the copyright header. sim/m32c/ChangeLog: * blinky.S, gloss.S, sample.S: Reformat copyright header. sim/mn10300/ChangeLog: * sim-main.h: Reformat copyright header. sim/ppc/ChangeLog: * dp-bit.c: Reformat copyright header. gdb/ChangeLog: * gdb/common/gdb_thread_db.h, gdb/dbxread.c, gdb/environ.c, gdb/gcore.h, gdb/rs6000-tdep.h, gdb/s390-nat.c, gdb/tic6x-tdep.c: Reformat the copyright header. gdb/gdbserver/ChangeLog: * terminal.h: Reformat copyright header. gdb/testsuite/ChangeLog: * dg-extract-results.sh, gdb.arch/gcore.c, gdb.arch/gdb1558.c, gdb.arch/i386-gnu-cfi.c, gdb.base/complex.c, gdb.base/cvexpr.c, gdb.base/gcore.c, gdb.base/gdb1555-main.c, gdb.base/gdb1555.c, gdb.base/gdb1821.c, gdb.base/long_long.c, gdb.base/restore.c, gdb.base/sepdebug.c, gdb.base/type-opaque-lib.c, gdb.base/type-opaque-main.c, gdb.cp/maint.exp, gdb.cp/namespace1.cc, gdb.cp/pr9631.cc, gdb.cp/psmang1.cc, gdb.cp/psmang2.cc, gdb.cp/try_catch.cc, gdb.cp/virtfunc.cc, gdb.hp/gdb.base-hp/reg.exp, gdb.mi/basics.c, gdb.mi/mi-stack.c, gdb.mi/mi-var-child.c, gdb.mi/mi2-var-child.exp, gdb.mi/var-cmd.c, gdb.threads/thread_check.c: Reformat copyright header.
2011-03-15sim: common: trim trailing whitespaceMike Frysinger1-29/+29
2011-01-01run copyright.sh for 2011.Joel Brobecker1-1/+1
2010-04-23sim: fix fpu missing initializer warningsMike Frysinger1-2/+2
The current fpu code with externals enabled results in the warnings: common/sim-fpu.c:2437: warning: missing initializer common/sim-fpu.c:2437: warning: (near initialization for 'sim_fpu_zero.sign') common/sim-fpu.c:2440: warning: missing initializer common/sim-fpu.c:2440: warning: (near initialization for 'sim_fpu_qnan.sign') So tweak the old style initializers to avoid these. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-10sim: constify sim_fpu_print_statusMike Frysinger1-1/+1
I've committed the following patch as obvious. The local "prefix" variable is only assigned const strings, and only passed to printf() functions, so add "const" to avoid gcc warnings: common/sim-fpu.c: In function 'sim_fpu_print_status': common/sim-fpu.c:2508: warning: initialization discards qualifiers from pointer target type common/sim-fpu.c:2566: warning: assignment discards qualifiers from pointer target type Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-10sim: drop duplicate break statements in sim-fpuMike Frysinger1-6/+0
2010-01-01Update copyright notices to add year 2010.Joel Brobecker1-1/+1
2009-01-14 Update the copyright notice of some of the files I missedJoel Brobecker1-1/+2
in the previous copyright update.
2008-01-01 Updated copyright notices for most files.Daniel Jacobowitz1-1/+1
2007-08-24 Switch the license of all files explicitly copyright the FSFJoel Brobecker1-19/+10
to GPLv3.
2007-01-09Copyright updates for 2007.Daniel Jacobowitz1-1/+1
2006-08-29 * sim-fpu.c (pack_fpu): Handle QUIET_NAN correctly forThiemo Seufer1-0/+4
SIM_QUIET_NAN_NEGATED.
2005-07-08 * sim-fpu.c (sim_fpu_abs): Always clear the sign bit.Ian Lance Taylor1-8/+2
2005-07-08 * sim-fpu.c (pack_fpu): If SIM_QUIET_NAN_NEGATED is defined, use aIan Lance Taylor1-1/+12
different fraction for a quiet NaN. (unpack_fpu): Likewise.
2003-06-222003-06-22 Andrew Cagney <cagney@redhat.com>Andrew Cagney1-28/+18
From matthew green <mrg@redhat.com>: * sim-fpu.h: Update copyright. (sim_fpu_fraction, sim_fpu_guard): New prototypes. * sim-fpu.c: Update copyright. (sim_fpu_fraction, sim_fpu_guard): New inline functions.
2003-06-22Oops! Committed to much, reverting :-(Andrew Cagney1-18/+28
2003-06-22Fix changelogAndrew Cagney1-1/+17
2002-11-282002-11-27 Richard Sandiford <rsandifo@redhat.com>Chris Demetriou1-27/+1
* sim-fpu.c (sim_fpu_inv): Use sim_fpu_div.
2002-06-12002-06-09 Aldy Hernandez <aldyh@redhat.com>Aldy Hernandez1-0/+4
* sim-fpu.c (unpack_fpu): Initialize exponent for sim_fpu_class_zero. (i2fpu): Same. (sim_fpu_sqrt): Same.
2000-12-232000-12-15 Ben Elliston <bje@redhat.com>Ben Elliston1-31/+20
* sim-fpu.h (sim_fpu_printn_fpu): Declare. * sim-fpu.c (print_bits): Add digits parameter. Print only as many trailing digits as specified (-1 to print all digits). (sim_fpu_print_fpu): New wrapper around sim_fpu_printn_fpu. (sim_fpu_printn_fpu): Rename from sim_fpu_print_fpu; update calls to print_bits ().
2000-11-082000-11-09 Ben Elliston <bje@redhat.com>Ben Elliston1-2/+2
* sim-fpu.c (sim_fpu_one): Set exponent to 0. (sim_fpu_two): Set exponent to 1.
1999-09-22import gdb-1999-09-21Jason Molenda1-1/+1
1999-04-16Initial creation of sourceware repositorygdb-4_18-branchpointStan Shebs1-0/+2578
1999-04-16Initial creation of sourceware repositoryStan Shebs1-2566/+0
1998-04-16o CVT.S.W and CVT.W.S were reversedAndrew Cagney1-3/+40
o When unpacking an r5900 FP value, was not treating IEEE-NaN's as very large values. o When packing an r5900 FP result from an infinite precision intermediate value was saturating to IEEE-MAX instead of r5900-MAX o The least significant bit of the FP status register did not stick to one.
1998-04-04Cleanup INLINE support for simulators using common framework.Andrew Cagney1-7/+19
Make IGEN responsible for co-ordinating inlining of generated files. By default, aclocal.m4 disabled all inlining.
1998-02-25Extend TRACE macros to include more cases.Andrew Cagney1-6/+205
Add MAX/MIN floating point functions. Add max32, min32 floating point contstants.