This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][rs6000] avoid using unaligned vsx or lxvd2x/stxvd2x for memcpy/memmove inline expansion
- From: Aaron Sawdey <acsawdey at linux dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot ibm dot com>
- Date: Thu, 20 Dec 2018 17:34:54 -0600
- Subject: Re: [PATCH][rs6000] avoid using unaligned vsx or lxvd2x/stxvd2x for memcpy/memmove inline expansion
- References: <0a17416b-57a0-99e7-2e7e-90a63da66fe6@linux.ibm.com> <20181220095119.GP3803@gate.crashing.org>
On 12/20/18 3:51 AM, Segher Boessenkool wrote:
> 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.
>
[snip]
>
> 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.
I think this should be better:
static rtx
gen_lvx_v4si_move (rtx dest, rtx src)
{
gcc_assert ((MEM_P (dest) && !MEM_P (src)) || (MEM_P (src) && !MEM_P(dest)));
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);
gcc_unreachable ();
}
I'll commit after I re-regstrap.
Thanks!
Aaron
--
Aaron Sawdey, Ph.D. acsawdey@linux.vnet.ibm.com
050-2/C113 (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain