[1/4] xtensa: Implement bswaphi2 insn pattern
Commit Message
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(+)
Comments
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.
@@ -471,6 +471,16 @@
;; 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" "")))]