On Fri, Jul 15, 2022 at 4:17 PM Takayuki 'January June' Suwa
<jjsuwa_sys3...@yahoo.co.jp> wrote:
>
> This patch allows the constant synthesis to choose shorter instruction
> if possible.
>
>     /* example */
>     int test(void) {
>       return 128 << 8;
>     }
>
>     ;; before
>     test:
>         movi    a2, 0x100
>         addmi   a2, a2, 0x7f00
>         ret.n
>
>     ;; after
>     test:
>         movi.n  a2, 1
>         slli    a2, a2, 15
>         ret.n
>
> When the Code Density Option is configured, the latter is one byte smaller
> than the former.
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.cc (xtensa_emit_constantsynth): Remove.
>         (xtensa_constantsynth_2insn): Change to try all three synthetic
>         methods and to use the one that fits the immediate value of
>         the seed into a Narrow Move Immediate instruction "MOVI.N"
>         when the Code Density Option is configured.
> ---
>  gcc/config/xtensa/xtensa.cc | 58 ++++++++++++++++++-------------------
>  1 file changed, 29 insertions(+), 29 deletions(-)

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

-- 
Thanks.
-- Max

Reply via email to