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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |roger at 
nextmovesoftware dot com
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-09-09
     Ever confirmed|0                           |1

--- Comment #1 from Roger Sayle <roger at nextmovesoftware dot com> ---
Created attachment 65544
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65544&action=edit
proposed patch

I'm fairly certain the attached file both fixes this regression and improves
code quality on iq2000.  Unfortunately, I'm having trouble getting libgloss to
compile, which is ultimately preventing me from running the testsuite with
iq2000-sim.  Something I'm still working on, as it would be good to get to the
root cause of the execution failure [I suspect because plus is sign-extended
but ior is zero-extended, but I need to reduce 20040715-1.c to confirm that].

One thing that is clear is that without define_insn_and_splits in iq2000.md to
allow combine to handle general SImode immediate operands, the RTL optimizers
need to combine too many instructions to confirm that the problematic PLUS is
an AOP, so we miss an optimization and produce the larger code as mentioned in
Jeff's comment.  So for this target (and possibly also MIPS), IOR should be
preferred over PLUS, which is the main chunk of the proposed patch.

I'll see if there's anything that can be done to help iq2000, but the attached
patch stops this being a regression (just a latent bug?), also eliminates the
unnecessary "ori reg, $0" instructions that show up in the original bug report.

If someone could test this on iq2000 (sim or hardware) that would be great.

Reply via email to