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

            Bug ID: 127267
           Summary: [17 Regression] AOP changes causing execution failure
                    and poor code on iq2000-elf
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
  Target Milestone: ---

This change:

commit fb21f1686938d6cca13fa7efd9f94830a7a6ef04 (HEAD)
Author: Roger Sayle <[email protected]>
Date:   Mon Sep 7 16:53:07 2026 +0100

    middle-end: Improve bitreverse RTL expansion with AOP.

    This patch is a revision of my previous patch to use add_optab in
    the expansion of bitreverse and store_fixed_bitfield which improves
    code generation on x86, cris, riscv, parisc, sh and possibly other
    targets.
    https://gcc.gnu.org/pipermail/gcc-patches/2026-August/728199.html
    https://gcc.gnu.org/pipermail/gcc-patches/2026-August/726901.html

[ ... ]

Triggered:

Tests that now fail, but worked before (1 tests):

iq2000-sim: gcc: gcc.c-torture/execute/20040705-1.c   -O1  execution test

Note carefully -O1.  It doesn't fail at -O2. 


If we look at the diffs, they're primarily of this nature:

*************** fn1_1:
*** 102,108 ****
        addu    %4,%4,%5
        sll     %4,%4,26
        andoui  %2,%2,0x3ff
!       or      %2,%2,%4
        j       %31
        sw      %2,8(%3)

--- 102,108 ----
        addu    %4,%4,%5
        sll     %4,%4,26
        andoui  %2,%2,0x3ff
!       addu    %2,%2,%4
        j       %31
        sw      %2,8(%3)

But in main, which presumably has inlined copies of some functions we see:

*************** main:
*** 2988,2995 ****
        sw      %16,0(%29)
        lui     %16,%hi(b) # high
        addiu   %16,%16,%lo(b) # low
!       lui     %2,%hi(-851543506) # high
!       addiu   %2,%2,%lo(-851543506) # low
        sw      %2,8(%16)
        lui     %3,%hi(c) # high
        addiu   %3,%3,%lo(c) # low
--- 2988,3007 ----
        sw      %16,0(%29)
        lui     %16,%hi(b) # high
        addiu   %16,%16,%lo(b) # low
!       lw      %2,8(%16)
!       nop
!       andoui  %2,%2,0x3ff
!       lui     %3,0xcc00                       # -872415232
!       ori     %3,%3,0
!       addu    %2,%2,%3
!       lui     %3,%hi(-67076097) # high
!       addiu   %3,%3,%lo(-67076097) # low
!       and     %2,%2,%3
!       lui     %3,0x13e                        # 20840448
!       ori     %3,%3,0
!       addu    %2,%2,%3
!       andoi   %2,%2,0x8000
!       addiu   %2,%2,31278
        sw      %2,8(%16)
        lui     %3,%hi(c) # high
        addiu   %3,%3,%lo(c) # low

There's a few instances like that.  I don't know what inlined function they
correspond to.  The fact that it's an execution failure is quite a surprise,
though I guess we've never really due into iq2000 testresults in recent
history, so there may well be a correctness bug lurking in there.

Anyway, not working on this.  But wanted to get it filed so it's not forgotten.

jeff

Reply via email to