]> git.ipfire.org Git - thirdparty/gcc.git/commit
riscv: thead: Add support for the XTheadBb ISA extension
authorChristoph Müllner <christoph.muellner@vrull.eu>
Fri, 29 Jul 2022 03:19:56 +0000 (05:19 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Wed, 15 Mar 2023 08:56:52 +0000 (09:56 +0100)
commitc493fa3892487c22d0bdd817361a02bd523fc2e7
tree6d44dab5ab6d97d00b24c21815512373d039c604
parentd328d3a6f8756ed61b3cdf3675b24051f7d3b2ef
riscv: thead: Add support for the XTheadBb ISA extension

This patch adds support for the XTheadBb ISA extension.
Thus, there is a functional overlap of the new instructions with
existing Bitmanip instruction, which allows a good amount of code
sharing. However, the vendor extensions are cleanly separated from
the standard extensions (e.g. by using INSN expand pattern that
will re-emit RTL that matches the patterns of either Bitmanip or
XThead INSNs).

gcc/ChangeLog:

* config/riscv/bitmanip.md (clzdi2): New expand.
(clzsi2): New expand.
(ctz<mode>2): New expand.
(popcount<mode>2): New expand.
(<bitmanip_optab>si2): Rename INSN.
(*<bitmanip_optab>si2): Hide INSN name.
(<bitmanip_optab>di2): Rename INSN.
(*<bitmanip_optab>di2): Hide INSN name.
(rotrsi3): Remove INSN.
(rotr<mode>3): Add expand.
(*rotrsi3): New INSN.
(rotrdi3): Rename INSN.
(*rotrdi3): Hide INSN name.
(rotrsi3_sext): Rename INSN.
(*rotrsi3_sext): Hide INSN name.
(bswap<mode>2): Remove INSN.
(bswapdi2): Add expand.
(bswapsi2): Add expand.
(*bswap<mode>2): Hide INSN name.
* config/riscv/riscv.cc (riscv_rtx_costs): Add costs for sign
extraction.
* config/riscv/riscv.md (extv<mode>): New expand.
(extzv<mode>): New expand.
* config/riscv/thead.md (*th_srri<mode>3): New INSN.
(*th_ext<mode>): New INSN.
(*th_extu<mode>): New INSN.
(*th_clz<mode>2): New INSN.
(*th_rev<mode>2): New INSN.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadbb-ext.c: New test.
* gcc.target/riscv/xtheadbb-extu-2.c: New test.
* gcc.target/riscv/xtheadbb-extu.c: New test.
* gcc.target/riscv/xtheadbb-ff1.c: New test.
* gcc.target/riscv/xtheadbb-rev.c: New test.
* gcc.target/riscv/xtheadbb-srri.c: New test.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/config/riscv/bitmanip.md
gcc/config/riscv/riscv.cc
gcc/config/riscv/riscv.md
gcc/config/riscv/thead.md
gcc/testsuite/gcc.target/riscv/xtheadbb-ext.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/xtheadbb-extu-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/xtheadbb-extu.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/xtheadbb-ff1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/xtheadbb-rev.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/xtheadbb-srri.c [new file with mode: 0644]