]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Yet another fix for mcore-sim (rotli)
authorJeff Law <jeffreyalaw@gmail.com>
Tue, 19 Dec 2023 05:04:25 +0000 (22:04 -0700)
committerJeff Law <jeffreyalaw@gmail.com>
Tue, 19 Dec 2023 05:04:25 +0000 (22:04 -0700)
commitb3fa92f12a83d284db3124e0992e15d1ff31a3d8
tree4138893f104f67a5fedaceec04fa7eca776cc20f
parentf6149394f9a46d03ff853a0e83aae61441182811
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:
sim/mcore/interp.c
sim/testsuite/mcore/rotli.s [new file with mode: 0644]