public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit
       [not found] <bf7f5873-6959-9ca5-5a2f-83499ac78034.ref@yahoo.co.jp>
@ 2023-01-12  4:26 ` Takayuki 'January June' Suwa
  2023-01-12 12:46   ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2023-01-12  4:26 UTC (permalink / raw)
  To: GCC Patches; +Cc: Max Filippov

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(-)

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index b4989832169..764da63f91c 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -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;
 })
 
-- 
2.30.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit
  2023-01-12  4:26 ` [PATCH 2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit Takayuki 'January June' Suwa
@ 2023-01-12 12:46   ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2023-01-12 12:46 UTC (permalink / raw)
  To: Takayuki 'January June' Suwa; +Cc: GCC Patches

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.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-12 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bf7f5873-6959-9ca5-5a2f-83499ac78034.ref@yahoo.co.jp>
2023-01-12  4:26 ` [PATCH 2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit Takayuki 'January June' Suwa
2023-01-12 12:46   ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).