https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107863
--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> --- For pattern (set (reg:QI 607) (const_int 255 [0xff])) general_operand return false for op const_int 255 QImode since trunc_int_for_mode (INTVAL (op), mode) return -1, INVAL (op) is 255. ---cut from general_operand (rtx, machine_mode)---------- if (CONST_INT_P (op) && mode != VOIDmode && trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op)) return false; ---cut end----------------- and in trunc_int_for_mode, it does signed extend, not unsigned_extend for !flag_signed_char. ----cut from trunc_int_for_mode------------ /* Sign-extend for the requested mode. */ if (width < HOST_BITS_PER_WIDE_INT) { HOST_WIDE_INT sign = 1; sign <<= width - 1; c &= (sign << 1) - 1; c ^= sign; c -= sign; } return c; --------------cut end-------------- Should we do something like modified gcc/explow.cc @@ -64,7 +64,8 @@ trunc_int_for_mode (HOST_WIDE_INT c, machine_mode mode) /* Sign-extend for the requested mode. */ - if (width < HOST_BITS_PER_WIDE_INT) + if (width < HOST_BITS_PER_WIDE_INT + && (mode != QImode || !flag_signed_char)) { HOST_WIDE_INT sign = 1; sign <<= width - 1;