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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-04-14
                 CC|                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Guess this is caused by r6-2055, before that change set_src_cost wasn't passed
mode argument at all.
The problem is while for speed == 0 we pass always QImode, for speed == 1 it is
some random mode after the last vector mode.  In x86 case it is V2HFmode, so it
happens to work somehow, but in the sparc64 case that mode is MAX_MACHINE_MODE
and so doesn't work at all.

2025-04-14  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/119785
        * expmed.cc (init_expmed): Always pass QImode rather than mode to
        set_src_cost passed to set_zero_cost.

--- gcc/expmed.cc.jj    2025-04-08 14:08:51.234282102 +0200
+++ gcc/expmed.cc       2025-04-14 12:17:48.334123928 +0200
@@ -285,7 +285,7 @@ init_expmed (void)
   for (speed = 0; speed < 2; speed++)
     {
       crtl->maybe_hot_insn_p = speed;
-      set_zero_cost (speed, set_src_cost (const0_rtx, mode, speed));
+      set_zero_cost (speed, set_src_cost (const0_rtx, QImode, speed));

       for (mode = MIN_MODE_INT; mode <= MAX_MODE_INT;
           mode = (machine_mode)(mode + 1))

Reply via email to