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

--- Comment #1 from Vineet Gupta <vineetg at rivosinc dot com> ---
Fix posted here

https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613106.html

Essentially:

   case PLUS:

      if (TARGET_ZBA
          && mode == word_mode
          && GET_CODE (XEXP (x, 0)) == MULT
          && REG_P (XEXP (XEXP (x, 0), 0))
          && CONST_INT_P (XEXP (XEXP (x, 0), 1))
-         && IN_RANGE (pow2p_hwi (INTVAL (XEXP (XEXP (x, 0), 1))), 1, 3))
+         && pow2p_hwi (INTVAL (XEXP (XEXP (x, 0), 1)))
+         && IN_RANGE (exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1))), 1, 3))
        {
          *total = COSTS_N_INSNS (1);
          return true;
        }

Reply via email to