All three are good, thanks James!

        paul

> On Jul 11, 2026, at 10:14 PM, Migraine Man <[email protected]> wrote:
> 
> Re-send to include updated patch files to gcc-patches list.
> 
> ---------- Forwarded message ---------
> From: Migraine Man <[email protected]>
> Date: Thu, Jul 9, 2026 at 5:26 PM
> Subject: [PATCH 0/3] pdp11: fix three shift-expander wrong-code bugs
> To: <[email protected]>
> Cc: Paul Koning <[email protected]>
> 
> 
> 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
> <0001-pdp11-negate-the-count-in-QImode-logical-right-shift.patch><0003-pdp11-sign-extend-the-operand-in-QImode-arithmetic-r.patch><v2-0002-pdp11-guard-variable-logical-right-shift-against-.patch>

Reply via email to