https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128906

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <[email protected]>:

https://gcc.gnu.org/g:a08af1d98c785407f47cac640ecbf01d042ffd2d

commit r17-6542-ga08af1d98c785407f47cac640ecbf01d042ffd2d
Author: Jeff Law <[email protected]>
Date:   Fri Nov 20 21:27:30 2026 -0700

    [PR target/128906] Fix length calculation and some output templates for the
H8

    So this PR is (yet another) case where the H8 port under-reported the
length of
    one or more insns leading to branches going into never-never land.

    The really annoying thing here is there are notes that these patterns had
    incorrect lengths, presumably added by me a few years ago when I added the
    patterns.  I'm not sure why I didn't spot and then fix these before
pushing.

    The length calculation in 2 cases failed to account for the additional
length
    of the xor.l instruction.  A two register xor.[bw] form is just 2 bytes,
but
    for xor.l 4 bytes are needed.

    There's two other cases where the SImode sequence requires an additional
    instruction and in one of those we also need to account fo the longer xor.l
    instruction.

    I did have an LLM scan the port for other similar instances.  It tripped a
few
    false positives, but nothing real.

    The LLM scan also reported the missing "%" that the PR noted in a few
places.
    It also reported a case where we used the wrong output modifier.  The
missing
    "%" would have triggered a fatal failure in the assembler, so clearly that
case
    isn't triggered building libgcc, newlib or anywhere in the testsuite.  The
    wrong modifier case will trigger a warning in the assembler, so it's not
    tripping in the testsuite anywhere, though it perhaps could be triggering
    building libgcc or newlib.

    After the LLM scan and manually fixing things I had the LLM write testcases
for
    the problem which I've included.

    Regression tested on the H8 in my usual set of multilibs (-mint32 with -mh,
-ms
    or -msx).

    Assisted-By: Claude for scanning the port for issues and testcase
generation.

    Pushing to the trunk.

            PR target/128906
    gcc/
            * config/h8300/testcompare.md (store_z_<mode>): Fix length
calculation
            for SI case.
            (store_z_<mode>_neg): Likewise.
            (store_z_<mode>_sb): Fix length calculation for SI case.  Also fix
            output templates.
            (store_z_<mode>_and): Likewise.

    gcc/testsuite
            * gcc.target/h8300/pr128906.c: New test.
            * gcc.target/h8300/pr128906-2.c: New test.

Reply via email to