On Sun, Jun 26, 2022 at 7:53 AM Takayuki 'January June' Suwa
<jjsuwa_sys3...@yahoo.co.jp> wrote:
>
> Such constants are often subject to the constant synthesis:
>
>     int test(int a) {
>       return a - 31999;
>     }
>
>     test:
>         movi    a3, 1
>         addmi   a3, a3, -0x7d00
>         add     a2, a2, a3
>         ret
>
> This patch optimizes such case as follows:
>
>     test:
>         addi    a2, a2, 1
>         addmi   a2, a2, -0x7d00
>         ret
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.md:
>         Suppress unnecessary emitting nop insn in the split patterns for
>         integer/FP constant synthesis, and add new peephole2 pattern that
>         folds such synthesized additions.
> ---
>  gcc/config/xtensa/xtensa.md | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.

-- 
Thanks.
-- Max

Reply via email to