Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ static DecodeStatus DecodeGPRPairRegisterClass(MCInst &Inst, uint32_t RegNo,
return MCDisassembler::Success;
}

static DecodeStatus
DecodeGPRPairNoX0RegisterClass(MCInst &Inst, uint32_t RegNo, uint64_t Address,
const MCDisassembler *Decoder) {
if (RegNo == 0)
return MCDisassembler::Fail;

return DecodeGPRPairRegisterClass(Inst, RegNo, Address, Decoder);
}

static DecodeStatus DecodeGPRPairCRegisterClass(MCInst &Inst, uint32_t RegNo,
uint64_t Address,
const MCDisassembler *Decoder) {
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/RISCV/RISCVRegisterInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ let RegAltNameIndices = [ABIRegAltName] in {
}
}

let RegInfos = XLenPairRI, CopyCost = 2,
DecoderMethod = "DecodeGPRPairRegisterClass" in {
let RegInfos = XLenPairRI, CopyCost = 2 in {
def GPRPair : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
X10_X11, X12_X13, X14_X15, X16_X17,
X6_X7,
Expand All @@ -370,12 +369,11 @@ def GPRPair : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
)>;

def GPRPairNoX0 : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (sub GPRPair, X0_Pair)>;
} // let RegInfos = XLenPairRI, DecoderMethod = "DecodeGPRPairRegisterClass"

let RegInfos = XLenPairRI, CopyCost = 2 in
def GPRPairC : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
X10_X11, X12_X13, X14_X15, X8_X9
)>;
} // let RegInfos = XLenPairRI, CopyCost = 2

//===----------------------------------------------------------------------===//
// Floating Point registers
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/MC/Disassembler/RISCV/zclsd-invalid-pair.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# RUN: not llvm-mc -disassemble -triple=riscv32 -mattr=+zclsd -M no-aliases %s \
# RUN: | FileCheck -check-prefixes=CHECK %s


[0x00,0x00]
# CHECK: unimp

[0x52,0x70]
# CHECK-NOT: c.ldsp zero, {{[0-9]+}}(sp)

[0x00,0x00]
# CHECK: unimp