RISC-V: Add T-Head CMO vendor extension
authorChristoph Müllner <christoph.muellner@vrull.eu>
Tue, 28 Jun 2022 15:43:20 +0000 (17:43 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Thu, 22 Sep 2022 16:06:09 +0000 (18:06 +0200)
commita9ba8bc2d396fb8ae2b892f3bc6be8cdfe4b555c
tree2f67d6d6a2d2254ea43a2d3a0956903eb28b7fde
parentfb1737381d886c7c0a4e870af078c473ac463fce
RISC-V: Add T-Head CMO vendor extension

T-Head has a range of vendor-specific instructions.
Therefore it makes sense to group them into smaller chunks
in form of vendor extensions.

This patch adds the XTheadCmo extension, a collection of T-Head specific
cache management operations.
The 'th' prefix and the "XTheadCmo" extension are documented in a PR
for the RISC-V toolchain conventions ([1]).

In total XTheadCmo introduces the following 21 instructions:

* DCACHE.{C,CI,I}ALL
* DCACHE.{C,CI,I}{PA,VA,SW} rs1
* DCACHE.C{PAL1,VAL1} rs1
* ICACHE.I{ALL,ALLS}
* ICACHE.I{PA,VA} rs1
* L2CACHE.{C,CI,I}ALL

Contrary to Zicbom, the XTheadCmo instructions don't have a constant
displacement, therefore we have a different syntax for the arguments.
To clarify this is intended behaviour, there is a set of negative test
for Zicbom-style arguments in x-thead-cmo-fail.s.

[1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19

v2:
- Add missing DECLARE_INSN() list
- Fix ordering

Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
bfd/elfxx-riscv.c
gas/doc/c-riscv.texi
gas/testsuite/gas/riscv/x-thead-cmo-fail.d [new file with mode: 0644]
gas/testsuite/gas/riscv/x-thead-cmo-fail.l [new file with mode: 0644]
gas/testsuite/gas/riscv/x-thead-cmo-fail.s [new file with mode: 0644]
gas/testsuite/gas/riscv/x-thead-cmo.d [new file with mode: 0644]
gas/testsuite/gas/riscv/x-thead-cmo.s [new file with mode: 0644]
include/opcode/riscv-opc.h
include/opcode/riscv.h
opcodes/riscv-opc.c