5151 Commits

Author SHA1 Message Date
Mike Frysinger
67df132b65 sim: sh: fix -Wunused-variable warnings 2023-12-19 05:51:11 -05:00
Mike Frysinger
5daeb7f67a sim: moxie: fix -Wunused-variable warnings 2023-12-19 05:51:11 -05:00
Mike Frysinger
eade758025 sim: msp430: fix -Wunused-variable warnings 2023-12-19 05:51:11 -05:00
Mike Frysinger
7704565d2f sim: mn10300: fix -Wunused-variable warnings 2023-12-19 05:51:11 -05:00
Mike Frysinger
bb2f91823f sim: mips: fix -Wunused-variable warnings 2023-12-19 05:51:11 -05:00
Mike Frysinger
96967be368 sim: microblaze: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
2705c08342 sim: mcore: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
568b2f90c7 sim: m32r: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
9340c17241 sim: lm32: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
ef2022265b sim: iq2000: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
04a33b24eb sim: h8300: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
8bc2893fb4 sim: ft32: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
cd3f716d9a sim: frv: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
c6ce030ba9 sim: erc32: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
1857c9f587 sim: cris: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
303dc26d24 sim: cr16: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
4b75ed1797 sim: bpf: fix -Wunused-variable warnings 2023-12-19 05:51:10 -05:00
Mike Frysinger
4ff93a08ab sim: bfin: fix -Wunused-variable warnings 2023-12-19 05:51:09 -05:00
Mike Frysinger
91669a0537 sim: aarch64: fix -Wunused-variable warnings 2023-12-19 05:51:09 -05:00
Mike Frysinger
715dd70c29 sim: common: fix -Wunused-variable warnings 2023-12-19 05:51:09 -05:00
Mike Frysinger
e9026cfbcf cpu: cris: drop some unused vars
These fix unused variable warnings in the generated sim.
2023-12-19 05:45:01 -05:00
Jeff Law
b3fa92f12a Yet another fix for mcore-sim (rotli)
This came up testing the CRC optimization work from Mariam@RAU.
Basically to optimize some CRC loops into table lookups or carryless
multiplies, we may need to do a bit reflection, which on the mcore
processor is done using a rotate instruction.

Unfortunately the simulator implementation of rotates has the exact same
problem as we saw with right shifts.  The input value may have been sign
extended from 32 to 64 bits.  When we rotate the extended value, we get
those sign extension bits and thus the wrong result.

The fix is the same.  Rather than using a "long", use a uint32_t for the
type of the temporary.  This fixes a handful of tests in the GCC testsuite:
2023-12-18 22:04:25 -07:00
Mike Frysinger
2757c1c65f sim: warnings: add more flags
We already build cleanly with these.
2023-12-17 00:15:49 -05:00
Mike Frysinger
9846e9c110 sim: cr16: clean up unused insn operands
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-16 00:31:01 -05:00
Mike Frysinger
82a398adb8 sim: sh: adjust some dsp insn masks
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-15 23:59:00 -05:00
Mike Frysinger
0fd9d0cec0 sim: sh: tidy up gencode slightly
Mark a few things static/const, and clean up trailing whitespace.
2023-12-15 23:59:00 -05:00
Mike Frysinger
302bd5bf18 sim: bfin: fix typo in bf52x ports
These should be using the BF52x set of ports, not BF51x.
2023-12-15 21:41:07 -05:00
Mike Frysinger
00383ba6b4 sim: warnings: enable -Wunused-but-set-variable 2023-12-15 21:14:13 -05:00
Mike Frysinger
81a3befa0a sim: mn10300: fix incorrect implementation of a few insns
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-15 21:14:13 -05:00
Mike Frysinger
10802d9ac0 sim: m32r: fix mloop.in variant stamp deps
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-14 22:45:22 -05:00
Mike Frysinger
2f1de74501 sim: m32r: use @cpu@_fill_argbuf_tp to set trace & profile state
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-14 22:34:28 -05:00
Mike Frysinger
880530b71f sim: igen: do not reindent literal semantics output
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-14 22:33:47 -05:00
Jeff Law
76c51bed59 Improve performance of the H8 simulator
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-10 13:26:03 -07:00
Mike Frysinger
c64ec6d082 sim: aarch64: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
3762437ead sim: common: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
8958a91714 sim: ppc: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
bbe7b93875 sim: v850: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
49b556efb5 sim: sh: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
0e12bb132e sim: msp430: fix -Wunused-but-set-variable warnings 2023-12-07 22:31:21 -07:00
Mike Frysinger
5dda1cd28a sim: mips: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
2a04b8c908 sim: mcore: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
fca8f1a3dc sim: m68hc11: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
7368a2cf73 sim: h8300: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
ab46df15a0 sim: ft32: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
0dabdc69c7 sim: frv: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
89d7fc2ab0 sim: erc32: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
a886474a62 sim: d10v: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
4125d64738 sim: cris: fix -Wunused-but-set-variable warnings
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-07 21:41:27 -07:00
Mike Frysinger
ee45e43358 sim: bfin: fix -Wunused-but-set-variable warnings 2023-12-07 21:41:27 -07:00
Mike Frysinger
058d0bf5f0 sim: bfin: gui: fix -Wunused-but-set-variable warnings
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-07 21:41:27 -07:00