diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2020-12-20 02:23:12 -0800 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2020-12-20 14:02:26 -0800 |
commit | 18e86fae2a14f78e70aae06afce6bb9853068bb1 (patch) | |
tree | 2d06b0068acea1f9ec4a2164a6b2a3b358eb045b /gcc/config/xtensa | |
parent | 3621a7bb5795ad4e47b30e1a8a06f1abe2b3b036 (diff) | |
download | gcc-18e86fae2a14f78e70aae06afce6bb9853068bb1.zip gcc-18e86fae2a14f78e70aae06afce6bb9853068bb1.tar.gz gcc-18e86fae2a14f78e70aae06afce6bb9853068bb1.tar.bz2 |
gcc: xtensa: implement bswapsi2, bswapdi2 and helpers
2020-12-20 Max Filippov <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.md (bswapsi2, bswapdi2): New patterns.
gcc/testsuite/
* gcc.target/xtensa/bswap.c: New test.
libgcc/
* config/xtensa/lib1funcs.S (__bswapsi2, __bswapdi2): New
functions.
* config/xtensa/t-xtensa (LIB1ASMFUNCS): Add _bswapsi2 and
_bswapdi2.
Diffstat (limited to 'gcc/config/xtensa')
-rw-r--r-- | gcc/config/xtensa/xtensa.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 462a724..cfb6a54 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -469,6 +469,27 @@ }) +;; Byte swap. + +(define_insn "bswapsi2" + [(set (match_operand:SI 0 "register_operand" "=&a") + (bswap:SI (match_operand:SI 1 "register_operand" "r")))] + "!optimize_size" + "ssai\t8\;srli\t%0, %1, 16\;src\t%0, %0, %1\;src\t%0, %0, %0\;src\t%0, %1, %0" + [(set_attr "type" "arith") + (set_attr "mode" "SI") + (set_attr "length" "15")]) + +(define_insn "bswapdi2" + [(set (match_operand:DI 0 "register_operand" "=&a") + (bswap:DI (match_operand:DI 1 "register_operand" "r")))] + "!optimize_size" + "ssai\t8\;srli\t%0, %D1, 16\;src\t%0, %0, %D1\;src\t%0, %0, %0\;src\t%0, %D1, %0\;srli\t%D0, %1, 16\;src\t%D0, %D0, %1\;src\t%D0, %D0, %D0\;src\t%D0, %1, %D0" + [(set_attr "type" "arith") + (set_attr "mode" "DI") + (set_attr "length" "27")]) + + ;; Negation and one's complement. (define_insn "negsi2" |