Paul,

This series fixes three independent wrong-code bugs in the pdp11
shift expanders in config/pdp11/pdp11.md, found while bringing up
Fuzix on a PDP-11/20-compatible FPGA system built with gcc 13.3.0
as the cross-compiler.  All three are still present in master.

1/3 - PR target/125058: the QImode branch of lshr<mode>3 does not
negate the shift count, so a logical right shift is emitted as a
LEFT shift.

2/3 - PR target/126190: the HImode/SImode variable-count branch of
lshr<mode>3 expands as a one-bit logical shift followed by an
arithmetic shift of (count - 1), which is invalid for a runtime
count of 0: it computes x & ~1.  In the field this corrupted every
odd single-indirect block of every Fuzix file read (bn >> sh with
sh = 0).

3/3 - PR target/126191: the QImode branch of ashr<mode>3
zero-extends the operand before the arithmetic shift, losing the
sign for counts 4..7 (smaller counts take the asrb path).  The fix
(sign-extend) also makes the emitted code two words shorter.

Each patch adds a scan-assembler test under gcc.target/pdp11.
The combined fixes have been running in a self-hosted gcc 13.3.0
cross toolchain building the Fuzix kernel, libc, and userland;
codegen verified case by case on the PRs.

Best regards,
James McGuire

Reply via email to