Hi!
On Thu, Jul 08, 2021 at 05:01:05PM -0500, Peter Bergner wrote:
> The MMA build built-ins currently use individual lxv instructions to
> load up the registers of a __vector_pair or __vector_quad. If the
> memory addresses of the built-in operands are to adjacent locations,
> then we could use an lxvp in some cases to load up two registers at once.
> The patch below adds support for checking whether memory addresses are
> adjacent and emitting an lxvp instead of two lxv instructions.
>
> This passed bootstrap and regtesting on powerpc64le-linux with no regressions.
> Ok for trunk?
It needs testing on BE.
> +static bool consecutive_mem_locations (rtx, rtx);
Please don't; just move functions to somewhere earlier than where they
are used.
> @@ -16841,8 +16843,35 @@ rs6000_split_multireg_move (rtx dst, rtx src)
> for (int i = 0; i < nvecs; i++)
> {
> int index = WORDS_BIG_ENDIAN ? i : nvecs - 1 - i;
> - rtx dst_i = gen_rtx_REG (reg_mode, reg + index);
> - emit_insn (gen_rtx_SET (dst_i, XVECEXP (src, 0, i)));
> + int index_next = WORDS_BIG_ENDIAN ? index + 1 : index - 1;
What does index_next mean? The machine instructions do the same thing
in any endianness.
> + rtx dst_i;
> + int regno = reg + i;
> +
> + /* If we are loading an even VSX register and our memory location
> + is adjacent to the next register's memory location (if any),
> + then we can load them both with one LXVP instruction. */
> + if ((regno & 1) == 0
> + && VSX_REGNO_P (regno)
> + && MEM_P (XVECEXP (src, 0, index))
> + && MEM_P (XVECEXP (src, 0, index_next)))
> + {
> + rtx base = WORDS_BIG_ENDIAN ? XVECEXP (src, 0, index)
> + : XVECEXP (src, 0, index_next);
> + rtx next = WORDS_BIG_ENDIAN ? XVECEXP (src, 0, index_next)
> + : XVECEXP (src, 0, index);
Please get rid of index_next, if you still have to do different code for
LE here -- it doesn't make the code any clearer (in fact I cannot follow
it at all anymore :-( )
So this converts pairs of lxv to an lxvp in only a very limited case,
right? Can we instead do it more generically? And what about stxvp?
Segher