https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110939
--- Comment #9 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> --- Thanks for the reproducer and sorry for the hassle. The normal form of a constant for a mode with fewer bits than in HOST_WIDE_INT is a sign extended version of the original constant. This even holds for unsigned constants which I missed. The following should fix this: diff --git a/gcc/combine.cc b/gcc/combine.cc index e46d202d0a7..9e5bf96a09d 100644 --- a/gcc/combine.cc +++ b/gcc/combine.cc @@ -12059,7 +12059,7 @@ simplify_compare_const (enum rtx_code code, machine_mode mode, : (GET_MODE_SIZE (int_mode) - GET_MODE_SIZE (narrow_mode_iter))); *pop0 = adjust_address_nv (op0, narrow_mode_iter, offset); - *pop1 = GEN_INT (n); + *pop1 = gen_int_mode (n, narrow_mode_iter); return adjusted_code; } } Can you give this a try?