[2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit
Checks
Commit Message
This patch saves one byte when the Code Density Option is enabled,
gcc/ChangeLog:
* config/xtensa/xtensa.md (ctzsi2, ffssi2):
Rearrange the emitting codes.
---
gcc/config/xtensa/xtensa.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Wed, Jan 11, 2023 at 8:26 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch saves one byte when the Code Density Option is enabled,
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.md (ctzsi2, ffssi2):
> Rearrange the emitting codes.
> ---
> gcc/config/xtensa/xtensa.md | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.
@@ -477,8 +477,8 @@
emit_insn (gen_negsi2 (temp, operands[1]));
emit_insn (gen_andsi3 (temp, temp, operands[1]));
emit_insn (gen_clzsi2 (temp, temp));
- emit_insn (gen_negsi2 (temp, temp));
- emit_insn (gen_addsi3 (operands[0], temp, GEN_INT (31)));
+ emit_move_insn (operands[0], GEN_INT (31));
+ emit_insn (gen_subsi3 (operands[0], operands[0], temp));
DONE;
})
@@ -491,8 +491,8 @@
emit_insn (gen_negsi2 (temp, operands[1]));
emit_insn (gen_andsi3 (temp, temp, operands[1]));
emit_insn (gen_clzsi2 (temp, temp));
- emit_insn (gen_negsi2 (temp, temp));
- emit_insn (gen_addsi3 (operands[0], temp, GEN_INT (32)));
+ emit_move_insn (operands[0], GEN_INT (32));
+ emit_insn (gen_subsi3 (operands[0], operands[0], temp));
DONE;
})