aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@vrull.eu>2023-02-13 16:10:11 +0100
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>2023-02-13 16:28:26 +0100
commit04a2baf58f2362cac85edbd55747cecb135b9ae5 (patch)
tree47ecd90660f3d78720503e12e1b6e7817e937da2 /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
parent676bca0b6f0df943935e3b17cfd1d9e8d9eb4797 (diff)
downloadllvm-04a2baf58f2362cac85edbd55747cecb135b9ae5.zip
llvm-04a2baf58f2362cac85edbd55747cecb135b9ae5.tar.gz
llvm-04a2baf58f2362cac85edbd55747cecb135b9ae5.tar.bz2
[RISCV] Add vendor-defined XTHeadBs (single-bit) extension
The vendor-defined XTHeadBs (predating the standard Zbs extension) extension adds a bit-test instruction (th.tst) with similar semantics as bexti from Zbs. It is supported by the C9xx cores (e.g., found in the wild in the Allwinner D1) by Alibaba T-Head. The current (as of this commit) public documentation for XTHeadBs is available from: https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf Support for these instructions has already landed in GNU Binutils: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8254c3d2c94ae5458095ea6c25446ba89134b9da Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D143036
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
-rw-r--r--llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
index bf60cd1..7276d82 100644
--- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -478,6 +478,13 @@ DecodeStatus RISCVDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
if (Result != MCDisassembler::Fail)
return Result;
}
+ if (STI.getFeatureBits()[RISCV::FeatureVendorXTHeadBs]) {
+ LLVM_DEBUG(dbgs() << "Trying XTHeadBs custom opcode table:\n");
+ Result = decodeInstruction(DecoderTableTHeadBs32, MI, Insn, Address, this,
+ STI);
+ if (Result != MCDisassembler::Fail)
+ return Result;
+ }
if (STI.getFeatureBits()[RISCV::FeatureVendorXTHeadVdot]) {
LLVM_DEBUG(dbgs() << "Trying XTHeadVdot custom opcode table:\n");
Result =