> -----Original Message-----
> From: H.J. Lu <[email protected]>
> Sent: Monday, June 29, 2026 11:32 AM
> To: Hongtao Liu <[email protected]>
> Cc: GCC Patches <[email protected]>; Uros Bizjak
> <[email protected]>; Liu, Hongtao <[email protected]>
> Subject: Re: [PATCH] x86-64: Don't use overlapping unaligned moves to move
> 1 byte
> 
> On Mon, Jun 29, 2026 at 11:14 AM Hongtao Liu <[email protected]>
> wrote:
> >
> > On Sun, Jun 28, 2026 at 7:16 AM H.J. Lu <[email protected]> wrote:
> > >
> > > commit b41f96465190751561f6909e858604ceab00595b
> > > Author: H.J. Lu <[email protected]>
> > > Date:   Mon Oct 20 16:14:34 2025 +0800
> > >
> > > x86-64: Inline memmove with overlapping unaligned loads and stores.
> > >
> > > inlines memmove with overlapping unaligned and stores.  For
> > unaligned loads and stores.
> >
> > >-     }
> > >+
> > >+      /* NB: This assert may fail without the fixes for
> > >+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125977
> > >+       */
> > >+      gcc_assert (min_size != max_size);
> > >+    }
> >
> > We already have gcc_assert in
> > r17-1928-g10f654cd90ffd58f91bf1ee8a0af762040346ab4, this one looks
> > redundant, when count_exp is not const_int, min_size must be not equal
> > to max_size.
> 
> This is insurance in case that someone backports this patch without
> PR 125977 fixes.   I found
It makes sense, Ok for the patch.

> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125977
> 
> when I got
> 
> FAIL: gfortran.dg/associate_32.f03   -O0  execution test
> FAIL: gfortran.dg/deferred_character_22.f90   -O0  execution test
> FAIL: gfortran.dg/deferred_character_16.f90   -O0  execution test
> FAIL: gfortran.dg/nested_array_constructor_2.f90   -O0  execution test
> FAIL: gfortran.dg/nested_array_constructor_3.f90   -O0  execution test
> FAIL: gfortran.dg/pr93814.f90   -O0  execution test
> FAIL: gfortran.dg/realloc_on_assign_25.f90   -O0  execution test
> FAIL: gfortran.dg/realloc_on_assign_5.f03   -O0  execution test
> FAIL: gfortran.dg/select_rank_5.f90   -O0  execution test
> FAIL: gfortran.dg/string_array_constructor_4.f90   -O0  execution test
> FAIL: gfortran.dg/transfer_simplify_9.f90   -O0  execution test
> 
> with the change:
> 
> @@ -10759,9 +10764,9 @@ ix86_expand_set_or_movmem (rtx operands[],
> bool iscpymem, bool issetmem)
>               nullptr, count_mode, 1,
>               more_2x_vec_label);
> 
> -  if (min_size == 0 || min_size <= 2 * move_max)
> +  if (max_size != 1 && (min_size == 0 || min_size <= 2 * move_max))
>      {
> -      /* Size >= MOVE_MAX and size <= 2 * MOVE_MAX.  */
> +      /* Max size != 1, size >= MOVE_MAX and size <= 2 * MOVE_MAX.  */
>        ix86_expand_n_overlapping_move_set_or_movmem (dst, src,
>                       memset_vals_p,
>                       destreg, srcreg,
> 
> since max_size == min_size == 1 and count is a variable.
> 
> >
> > ----- the commit ------------------------ commit
> > r17-1928-g10f654cd90ffd58f91bf1ee8a0af762040346ab4
> > Author: H.J. Lu <[email protected]>
> > Date:   Sat Jun 27 05:22:21 2026 +0800
> >
> >     Replace the min size rtx with GEN_INT (min_size)
> >
> >     commit cbc56384029c9224280b0a1018fb9502797f243d
> >     Author: H.J. Lu <[email protected]>
> >     Date:   Fri Jun 26 08:43:20 2026 +0800
> >
> >         determine_block_size: Set len_rtx to min size if min size ==
> > max size
> >
> >     added
> >
> >     +    gcc_assert (min_size != max_size
> >     +           || rtx_equal_p (ops[2].value, ops[6].value));
> >
> >     But the number of operands isn't fixed and may be less than 7.  Replace
> >     the min size rtx with GEN_INT (min_size) to support different numbers of
> >     operands.
> > ---------------cut end ----------------------
> >
> > Others LGTM.
> >
> >
> > --
> > BR,
> > Hongtao
> 
> 
> 
> --
> H.J.

Reply via email to