public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/4] xtensa: Implement bswaphi2 insn pattern
@ 2022-05-29 10:44 Takayuki 'January June' Suwa
  2022-06-09 22:11 ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2022-05-29 10:44 UTC (permalink / raw)
  To: GCC Patches

This patch adds bswaphi2 insn pattern that is one instruction less than the
default expansion.

gcc/ChangeLog:

	* config/xtensa/xtensa.md (bswaphi2): New insn pattern.
---
  gcc/config/xtensa/xtensa.md | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 6f5cbc541d8..217879bde15 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -471,6 +471,16 @@
  \f
  ;; Byte swap.

+(define_insn "bswaphi2"
+  [(set (match_operand:HI 0 "register_operand" "=a")
+	(bswap:HI (match_operand:HI 1 "register_operand" "r")))
+   (clobber (match_scratch:HI 2 "=&a"))]
+  ""
+  "extui\t%2, %1, 8, 8\;slli\t%0, %1, 8\;or\t%0, %0, %2"
+   [(set_attr "type"	"arith")
+    (set_attr "mode"	"HI")
+    (set_attr "length"	"9")])
+
  (define_expand "bswapsi2"
    [(set (match_operand:SI 0 "register_operand" "")
          (bswap:SI (match_operand:SI 1 "register_operand" "")))]
-- 
2.20.1

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

* Re: [PATCH 1/4] xtensa: Implement bswaphi2 insn pattern
  2022-05-29 10:44 [PATCH 1/4] xtensa: Implement bswaphi2 insn pattern Takayuki 'January June' Suwa
@ 2022-06-09 22:11 ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2022-06-09 22:11 UTC (permalink / raw)
  To: Takayuki 'January June' Suwa; +Cc: GCC Patches

On Sun, May 29, 2022 at 4:00 AM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch adds bswaphi2 insn pattern that is one instruction less than the
> default expansion.
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.md (bswaphi2): New insn pattern.
> ---
>   gcc/config/xtensa/xtensa.md | 10 ++++++++++
>   1 file changed, 10 insertions(+)

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:[~2022-06-09 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 10:44 [PATCH 1/4] xtensa: Implement bswaphi2 insn pattern Takayuki 'January June' Suwa
2022-06-09 22:11 ` 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).