public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5121] xtensa: Optimize ctzsi2 and ffssi2 a bit
@ 2023-01-12 12:44 Max Filippov
  0 siblings, 0 replies; only message in thread
From: Max Filippov @ 2023-01-12 12:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:117be79bd84ed21b47588d0cd86d72d5d1757cae

commit r13-5121-g117be79bd84ed21b47588d0cd86d72d5d1757cae
Author: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Date:   Thu Jan 12 13:26:42 2023 +0900

    xtensa: Optimize ctzsi2 and ffssi2 a bit
    
    This patch saves one byte when the Code Density Option is enabled,
    
    gcc/ChangeLog:
    
            * config/xtensa/xtensa.md (ctzsi2, ffssi2):
            Rearrange the emitting codes.

Diff:
---
 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;
 })

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-12 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 12:44 [gcc r13-5121] xtensa: Optimize ctzsi2 and ffssi2 a bit 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).