aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2023-12-17sim: warnings: add more flagsMike Frysinger2-0/+6
We already build cleanly with these.
2023-12-16sim: cr16: clean up unused insn operandsMike Frysinger1-4/+2
The push/pop insns only have 2 operands, so delete unused "c". The pushret/popret insns use 2 operands, but they don't implement the logic directly, they call the push/pop implementations. So delete the unused "a" & "b".
2023-12-15sim: sh: adjust some dsp insn masksMike Frysinger1-3/+3
The pmuls encoding is incorrect -- it looks like a copy & paste error from the padd pmuls variant. The SuperH software manual covers this. On the flip side, the manual lists pwsb & pwad as insns that exist, but no description of what they do, what the insn name means, or the actual encoding. Our sim implementation stubs them both out as nops. Let's mark the fields to avoid unused variable warnings.
2023-12-15sim: sh: tidy up gencode slightlyMike Frysinger1-68/+72
Mark a few things static/const, and clean up trailing whitespace.
2023-12-15sim: bfin: fix typo in bf52x portsMike Frysinger1-6/+6
These should be using the BF52x set of ports, not BF51x.
2023-12-15sim: warnings: enable -Wunused-but-set-variableMike Frysinger2-2/+2
2023-12-15sim: mn10300: fix incorrect implementation of a few insnsMike Frysinger1-7/+7
Fix a few problems caught by compiler warnings: * Some of the asr & lsr insns were setting up the c state flag, but then forgetting to set it in the PSW. Add it like the other asr & lsr variants. * Some of the dmulh insns were multiplying one of the source regs against itself instead of against the other source reg. * The sat16_cmp parallel insn was using the wrong register in the compare -- the reg1 src/dst pair are used in the sat16 op, and the reg2 src/dst pair are used in the add op.
2023-12-14sim: m32r: fix mloop.in variant stamp depsMike Frysinger2-4/+4
The migration to local.mk in commit 0a129eb19a773d930d60b084209570f663db2053 accidentally listed the deps for all mloop steps as mloop.in instead of the various variants that m32r uses. Reported-by: Simon Marchi <simon.marchi@polymtl.ca>
2023-12-14sim: m32r: use @cpu@_fill_argbuf_tp to set trace & profile stateMike Frysinger2-16/+8
The mloop.in code does this, but these variants do not. Use it to avoid unused function warnings. The fast_p logic in these files also looks off, but that'll require a bit more work to fixup. CC m32r/mloopx.o m32r/mloopx.c:37:1: error: ‘m32rxf_fill_argbuf_tp’ defined but not used [-Werror=unused-function] 37 | m32rxf_fill_argbuf_tp (const SIM_CPU *cpu, ARGBUF *abuf, | ^~~~~~~~~~~~~~~~~~~~~ CC m32r/mloop2.o m32r/mloop2.c:37:1: error: ‘m32r2f_fill_argbuf_tp’ defined but not used [-Werror=unused-function] 37 | m32r2f_fill_argbuf_tp (const SIM_CPU *cpu, ARGBUF *abuf, | ^~~~~~~~~~~~~~~~~~~~~ Reported-by: Simon Marchi <simon.marchi@polymtl.ca> Tested-By: Simon Marchi <simon.marchi@polymtl.ca>
2023-12-14sim: igen: do not reindent literal semantics outputMike Frysinger1-2/+9
When generating semantics.c from .igen source files, indenting the code makes it more readable, but confuses compiler diagnostics. The latter is a bit more important than the former, so bias towards that. For example, with an introduced error, we can see w/gcc-13: (before this change) CC mn10300/semantics.o ../../../sim/mn10300/am33-2.igen: In function ‘semantic_dcpf_D1a’: ../../../sim/mn10300/am33-2.igen:11:5: error: ‘srcreg’ undeclared (first use in this function) 11 | srcreg = translate_rreg (SD_, RN2); | ^~~~~~ (with this change) CC mn10300/semantics.o ../../../sim/mn10300/am33-2.igen: In function ‘semantic_dcpf_D1a’: ../../../sim/mn10300/am33-2.igen:11:3: error: ‘srcreg’ undeclared (first use in this function) 11 | srcreg = translate_rreg (SD_, RN2); | ^~~~~~
2023-12-10Improve performance of the H8 simulatorJeff Law1-2/+96
Running the H8 port through the GCC testsuite currently takes 4h 30m on my fastest server -- that's roughly 1.5hrs per multilib tested and many tests are disabled for various reasons. To put that 1.5hr/multilib in perspective, that's roughly 3X the time for other embedded targets. Clearly something isn't working as well as it should. A bit of digging with perf shows that we're spending a crazy amount of time decoding instructions in the H8 simulator. It's not hard to see why -- basically we take a blob of instruction data, then try to match it to every instruction in the H8 opcode table starting at the beginning. That table has ~8000 entries (each different addressing mode is considered a different instruction in the table). Naturally my first thought was to sort the table and use a binary search to find the right entry. That's made excessively complex due to the encoding on the H8. Just getting the sort right would be much more complex than I'd consider advisable. Another thought was to build a mapping to the right entry for all the instructions that can be disambiguated based on the first nibble (4 bits) of instruction data and a mapping for those which can be disambiguated based on the first byte of instruction data. That seemed feasible until I realized that the H8/SX did some truly horrid things with encoding branches in the 0x4XYY opcode space. It uses an "always zero" bit in the offset to encode new semantic information. So we can't select on just 0x4X. Ugh! We could always to a custom decoder. I've done several through the years, they can be very fast. But no way I can justify the time to do that. So what I settled on was to first sort the opcode table by the first nibble, then find the index of the first instruction for each nibble. Decoding uses that index to start its search. This cuts the overall build/test by more than half. Next I adjusted the sort so that instructions that are not available on the current sub architecture are put at the end of the table. This shaves another ~15% off the total cycle time. The net of the two changes is on my fastest server we've gone from 4:30 to 1:40 running the GCC testsuite. Same test results before/after, of course. It's still not fast, but it's a hell of a lot better.
2023-12-07sim: aarch64: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+1
2023-12-07sim: common: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+0
2023-12-07sim: ppc: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+0
2023-12-07sim: v850: fix -Wunused-but-set-variable warningsMike Frysinger2-11/+8
2023-12-07sim: sh: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+0
2023-12-07sim: msp430: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+1
2023-12-07sim: mips: fix -Wunused-but-set-variable warningsMike Frysinger1-3/+5
2023-12-07sim: mcore: fix -Wunused-but-set-variable warningsMike Frysinger1-4/+0
2023-12-07sim: m68hc11: fix -Wunused-but-set-variable warningsMike Frysinger2-6/+0
2023-12-07sim: h8300: fix -Wunused-but-set-variable warningsMike Frysinger1-8/+0
2023-12-07sim: ft32: fix -Wunused-but-set-variable warningsMike Frysinger1-4/+0
2023-12-07sim: frv: fix -Wunused-but-set-variable warningsMike Frysinger3-15/+0
2023-12-07sim: erc32: fix -Wunused-but-set-variable warningsMike Frysinger2-15/+4
2023-12-07sim: d10v: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+2
2023-12-07sim: cris: fix -Wunused-but-set-variable warningsMike Frysinger3-4/+9
We suppress the warning in the generated switch file because the cris cpu file has a hack to workaround a cgen bug, but that generates a set but unused variable which makes the compiler upset.
2023-12-07sim: bfin: fix -Wunused-but-set-variable warningsMike Frysinger7-23/+7
2023-12-07sim: bfin: gui: fix -Wunused-but-set-variable warningsMike Frysinger1-12/+22
Rework the code to use static inline functions when it's disabled rather than macros so the compiler knows the various function args are always used. The ifdef macros are a bit ugly, but get the job done without duplicating the function prototypes.
2023-12-07sim: arm: fix -Wunused-but-set-variable warningsMike Frysinger1-2/+0
2023-12-07sim: m32r: fix syslog callMike Frysinger1-1/+2
The function returns void, not int. We only pass one argument to syslog (the format), so use %s as the static format instead since the emulation layer doesn't handle passing additional arguments.
2023-12-07sim: m32r: include more glibc headers for the funcs we use [PR sim/29752]Mike Frysinger1-0/+5
Not exactly portable, but doesn't make the situation worse here, and fixes a lot of implicit function warnings. Bug: https://sourceware.org/PR29752
2023-12-07sim: m32r: add more cgen prototypes for trapsMike Frysinger1-0/+12
The traps file uses a bunch of functions directly without prototypes, and we can't safely include the relevant cpu*.h files for them.
2023-12-07sim: m32r: add more cgen prototypes to enable -Werror in most filesMike Frysinger3-24/+27
2023-12-07sim: warnings: disable -Wenum-conversion fow now [PR sim/29752]Mike Frysinger2-0/+4
The cgen code mixes virtual insn enums with insn enums, and there isn't an obvious (to me) way to unravel this atm, so disable the warning. sim/lm32/decode.c:45:5: error: implicit conversion from enumeration type 'CGEN_INSN_VIRTUAL_TYPE' to different enumeration type 'CGEN_INSN_TYPE' (aka 'enum cgen_insn_type') [-Werror,-Wenum-conversion] 45 | { VIRTUAL_INSN_X_INVALID, LM32BF_INSN_X_INVALID, LM32BF_SFMT_EMPTY }, | ~ ^~~~~~~~~~~~~~~~~~~~~~ Bug: https://sourceware.org/PR29752
2023-12-06sim: support dlopen in -lcMike Frysinger2-2/+2
Stop assuming that dlopen is only available via -ldl. Newer versions of glibc have merged it into -lc which broke this configure test.
2023-12-06sim: cris: move generated file to right placeMike Frysinger2-14121/+1
Not sure why this ended up in the topdir, but it belongs under cris/.
2023-12-06sim: warnings: add more flagsMike Frysinger2-8/+37
Sync with the list of flags from gdbsupport, and add a few more of our own to catch recent issues. Comment out the C++-specific flags as we don't build with C++.
2023-12-05sim: warnings: sync some build logic from gdbsupportMike Frysinger2-15/+65
This fixes testing of -Wno flags, and adds some more portable ones.
2023-12-05sim: mips: fix sim_fpu usageMike Frysinger1-4/+4
Fix some of the sim_fpu calls to use the right types. While I'm not familiar with the MIPS ISA in these cases, these look like simple oversights due to the name/type mismatches. This at least fixes compiling with -Wenum-conversion.
2023-12-05sim: sh: trim trailing whitespace in generated codeMike Frysinger1-15/+15
No functional change here, but makes it a little easier to read the generated code when editors aren't highlighting all the spurious trailing whitespace on lines.
2023-12-05sim: mn10300: fix sim_engine_halt callMike Frysinger1-1/+2
The sim_stop argument is an enum and should only be one of those values, not a signal constant. Fix the logic to pass the right sim_xxx & SIM_xxx values in the right arguments.
2023-12-05sim: m32c: use UTF-8 encodingMike Frysinger1-1/+1
We only support UTF-8 nowadays, so stop using ISO-8859-1. Maybe we should delete this logic entirely, but for now, do the bare min conversion to keep it compiling.
2023-12-04sim: rx: mark unused static var as unusedMike Frysinger1-0/+1
This seems like a useful utility func that mirrors the int2float helper, so mark it as unused rather than delete.
2023-12-04sim: rx: constify some read-only global varsMike Frysinger1-3/+3
2023-12-04sim: warnings: enable only for development buildsMike Frysinger5-5/+13
Reuse the bfd/development.sh script like most other project to determine whether the current source tree is a dev build (e.g. git) or a release build, and disable the warnings for releases.
2023-12-04sim: ppc: fix implicit enum conversionMike Frysinger1-3/+3
This code tries to use attach_type enums as hw_phb_decode, and while they're setup to have compatible values, the compiler doesn't like it when the cast is missing. So cast it explicitly and then use that. sim/ppc/hw_phb.c:322:28: error: implicit conversion from enumeration type 'attach_type' (aka 'enum _attach_type') to different enumeration type 'hw_phb_decode' [-Werror,-Wenum-conversion]
2023-12-04sim: ppc: fix -Wmisleading-indentation warningsMike Frysinger1-1/+1
Fix building with -Wmisleading-indentation.
2023-12-04sim: ppc: cleanup getrusage declsMike Frysinger3-17/+2
Don't conflate HAVE_GETRUSAGE & HAVE_SYS_RESOURCE_H. Use the latter to include the header and nothing else. Use the former to determine whether to use the function and nothing else. If we find a system that doesn't follow POSIX and provides only one of these, we can figure out how to support it then. The manual local definition is clashing with the system ones and leading to build failures with newer C standards. sim/ppc/emul_netbsd.c:51:5: error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a previous declaration [-Werror,-Wdeprecated-non-prototype]
2023-12-01Fix right shifts in mcore simulator on 64 bit hosts.Jeff Law3-2/+55
If the value to be shifted has the sign bit set, the sign bit would get copied into bits 32..63 of the temporary. Those would then be right shifted into the final value giving an incorrect final result. This was observed with upcoming GCC improvements which eliminate unnecessary extensions.
2023-11-28sim: bpf: do not use semicolon to begin commentsJose E. Marchesi11-292/+292
The BPF assembler has been updated to follow the clang convention in the interpretation of semicolons: they separate statements and directives, and do not start line comments.