diff options
author | Jim Lin <jim@andestech.com> | 2025-04-28 17:23:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 17:23:51 +0800 |
commit | 6ba1a62a6c512e32bf85f21b59b2c8e507d1a72e (patch) | |
tree | b1d511c418aab335f72ebb57ffdb17213588be7e /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | |
parent | 5afe9c72e4bea2ea38beb1cb0d3a3edc9a958414 (diff) | |
download | llvm-6ba1a62a6c512e32bf85f21b59b2c8e507d1a72e.zip llvm-6ba1a62a6c512e32bf85f21b59b2c8e507d1a72e.tar.gz llvm-6ba1a62a6c512e32bf85f21b59b2c8e507d1a72e.tar.bz2 |
[RISCV] Add Andes XAndesperf (Andes Performance) extension. (#135110)
The spec can be found at:
https://github.com/andestech/andes-v5-isa/releases/tag/ast-v5_4_0-release.
This patch only supports assembler.
Relocation and fixup for the branch and gp-implied instructions will be
added in a later patch.
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp index 27809d9..8f1b790 100644 --- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp +++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp @@ -447,15 +447,15 @@ static DecodeStatus decodeSImmNonZeroOperand(MCInst &Inst, uint32_t Imm, return decodeSImmOperand<N>(Inst, Imm, Address, Decoder); } -template <unsigned N> -static DecodeStatus decodeSImmOperandAndLsl1(MCInst &Inst, uint32_t Imm, +template <unsigned T, unsigned N> +static DecodeStatus decodeSImmOperandAndLslN(MCInst &Inst, uint32_t Imm, int64_t Address, const MCDisassembler *Decoder) { - assert(isUInt<N>(Imm) && "Invalid immediate"); - // Sign-extend the number in the bottom N bits of Imm after accounting for - // the fact that the N bit immediate is stored in N-1 bits (the LSB is + assert(isUInt<T - N + 1>(Imm) && "Invalid immediate"); + // Sign-extend the number in the bottom T bits of Imm after accounting for + // the fact that the T bit immediate is stored in T-N bits (the LSB is // always zero) - Inst.addOperand(MCOperand::createImm(SignExtend64<N>(Imm << 1))); + Inst.addOperand(MCOperand::createImm(SignExtend64<T>(Imm << N))); return MCDisassembler::Success; } @@ -727,6 +727,8 @@ static constexpr FeatureBitset XTHeadGroup = { RISCV::FeatureVendorXTHeadMemPair, RISCV::FeatureVendorXTHeadSync, RISCV::FeatureVendorXTHeadVdot}; +static constexpr FeatureBitset XAndesGroup = {RISCV::FeatureVendorXAndesPerf}; + static constexpr DecoderListEntry DecoderList32[]{ // Vendor Extensions {DecoderTableXVentana32, @@ -740,6 +742,7 @@ static constexpr DecoderListEntry DecoderList32[]{ {DecoderTableXmipscmov32, {RISCV::FeatureVendorXMIPSCMov}, "MIPS mips.ccmov"}, + {DecoderTableXAndes32, XAndesGroup, "Andes extensions"}, // Standard Extensions {DecoderTableXCV32, XCVFeatureGroup, "CORE-V extensions"}, {DecoderTableXqci32, XqciFeatureGroup, "Qualcomm uC Extensions"}, |