On Mon, May 23, 2022 at 8:52 AM Takayuki 'January June' Suwa
<[email protected]> wrote:
>
> This patch introduces setmemsi insn pattern of two kinds, unrolled loop and
> small loop, for fixed small length and constant initialization value.
>
> gcc/ChangeLog:
>
> * gcc/config/xtensa/xtensa-protos.h
> (xtensa_expand_block_set_unrolled_loop,
> xtensa_expand_block_set_small_loop): New prototypes.
> * gcc/config/xtensa/xtensa.cc (xtensa_sizeof_MOVI,
> xtensa_expand_block_set_unrolled_loop,
> xtensa_expand_block_set_small_loop): New functions.
> * gcc/config/xtensa/xtensa.md (setmemsi): New expansion pattern.
> * gcc/config/xtensa/xtensa.opt (mlongcalls): Add target mask.
> ---
> gcc/config/xtensa/xtensa-protos.h | 2 +
> gcc/config/xtensa/xtensa.cc | 211 ++++++++++++++++++++++++++++++
> gcc/config/xtensa/xtensa.md | 16 +++
> gcc/config/xtensa/xtensa.opt | 2 +-
> 4 files changed, 230 insertions(+), 1 deletion(-)
With this patch applied for the following test program
void f(char *p);
void g(void)
{
char c[72] = {0};
f(c);
}
the following code is generated with -O2:
.text
.literal_position
.literal .LC0, f@PLT
.align 4
.global g
.type g, @function
g:
entry sp, 112
movi.n a10, 0
s32i.n a10, sp, 0
addi.n a9, sp, 4
movi.n a8, 0x11
loop a8, .L2_LEND
.L2:
s32i.n a10, a9, 0
addi.n a9, a9, 4
.L2_LEND:
l32r a8, .LC0
mov.n a10, sp
callx8 a8
retw.n
The part
s32i.n a10, sp, 0
addi.n a9, sp, 4
movi.n a8, 0x11
looks redundant and could be just
mov a9, sp
movi a8, 0x12
is that something that can be addressed in this patch?
--
Thanks.
-- Max