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

--- Comment #5 from Aaron Sawdey <acsawdey at linux dot vnet.ibm.com> ---
On Tue, 2016-09-27 at 14:30 +0000, bernds at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77718
> 
> --- Comment #4 from Bernd Schmidt <bernds at gcc dot gnu.org> ---
> So something like this maybe?
> 
> Index: builtins.c
> ===================================================================
> --- builtins.c  (revision 240511)
> +++ builtins.c  (working copy)
> @@ -3707,11 +3707,13 @@ expand_builtin_memcmp (tree exp, rtx tar
> 
>    by_pieces_constfn constfn = NULL;
> 
> -  const char *src_str = c_getstr (arg1);
> -  if (src_str == NULL)
> -    src_str = c_getstr (arg2);
> -  else
> -    std::swap (arg1_rtx, arg2_rtx);
> +  const char *src_str = c_getstr (arg2);
> +  if (result_eq && src_str == NULL)
> +    {
> +      src_str = c_getstr (arg1);
> +      if (src_str != NULL)
> +       std::swap (arg1_rtx, arg2_rtx);
> +    }
> 
>    /* If SRC is a string constant and block move would be done
>       by pieces, we can avoid loading the string from memory
Bernd,
  Yeah that is about what I was thinking it needed. I'll test this on
ppc64le.

Thanks,
    Aaron

Reply via email to