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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-11-30
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The bug is in
        case MULT:
          /* Some machines use MULT instead of ASHIFT because MULT
             is cheaper.  But it is still better on those machines to
             merge two shifts into one.  */
          if (CONST_INT_P (XEXP (varop, 1))
              && (log2 = exact_log2 (UINTVAL (XEXP (varop, 1)))) >= 0)
            {
              rtx log2_rtx = gen_int_shift_amount (GET_MODE (varop), log2);
              varop = simplify_gen_binary (ASHIFT, GET_MODE (varop),
                                           XEXP (varop, 0), log2_rtx);
              continue;
            }
          break;
This is (mult:TI something (const_int -0x8000000000000000)) and exact_log2
returns 63 on it, except that would be only fine for DImode, but for TImode
that isn't a single bit set, but 65 bits set.
I'm afraid similar bug happens many times in combine.cc.

Reply via email to