This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][rs6000] avoid using unaligned vsx or lxvd2x/stxvd2x for memcpy/memmove inline expansion


On Wed, Dec 19, 2018 at 01:53:05PM -0600, Aaron Sawdey wrote:
> Because of POWER9 dd2.1 issues with certain unaligned vsx instructions
> to cache inhibited memory, here is a patch that keeps memmove (and memcpy)
> inline expansion from doing unaligned vector or using vector load/store
> other than lvx/stvx. More description of the issue is here:
> 
> https://patchwork.ozlabs.org/patch/814059/
> 
> OK for trunk if bootstrap/regtest ok?

Okay, but see below.

> 2018-12-19  Aaron Sawdey  <acsawdey@linux.ibm.com>
> 
> 	* config/rs6000/rs6000-string.c (expand_block_move): Don't use
> 	unaligned vsx and avoid lxvd2x/stxvd2x.
> 	(gen_lvx_v4si_move): New function.

> +static rtx
> +gen_lvx_v4si_move (rtx dest, rtx src)
> +{
> +  rtx rv = NULL;
> +  if (MEM_P (dest))
> +    {
> +      gcc_assert (!MEM_P (src));
> +      gcc_assert (GET_MODE (src) == V4SImode);
> +      rv = gen_altivec_stvx_v4si_internal (dest, src);
> +    }
> +  else if (MEM_P (src))
> +    {
> +      gcc_assert (!MEM_P (dest));
> +      gcc_assert (GET_MODE (dest) == V4SImode);
> +      rv = gen_altivec_lvx_v4si_internal (dest, src);
> +    }
> +  else
> +    gcc_unreachable ();
> +
> +  return rv;
> +}

This is extraordinarily clumsy :-)  Maybe something like:

static rtx
gen_lvx_v4si_move (rtx dest, rtx src)
{
  gcc_assert (!(MEM_P (dest) && MEM_P (src));
  gcc_assert (GET_MODE (dest) == V4SImode && GET_MODE (src) == V4SImode);
  if (MEM_P (dest))
    return gen_altivec_stvx_v4si_internal (dest, src);
  else if (MEM_P (src))
    return gen_altivec_lvx_v4si_internal (dest, src);
  else
    gcc_unreachable ();
}

(Or do you allow VOIDmode for src as well?)  Anyway, at least get rid of
the useless extra variable.

Thanks!


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]