Skip to content

Commit 8c0cf41

Browse files
committed
Fix some suggested changes
Change-Id: Idd3deec94bd324b2ab2b3fbc57bec16426673ad2
1 parent 3c4cfb7 commit 8c0cf41

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static DecodeStatus decodeUImmPlus1OperandGE(MCInst &Inst, uint32_t Imm,
347347
const MCDisassembler *Decoder) {
348348
assert(isUInt<Width>(Imm) && "Invalid immediate");
349349

350-
if (Imm < LowerBound)
350+
if ((Imm + 1) < LowerBound)
351351
return MCDisassembler::Fail;
352352

353353
Inst.addOperand(MCOperand::createImm(Imm + 1));

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ RISCVMCCodeEmitter::getImmOpValueMinus1(const MCInst &MI, unsigned OpNo,
400400
return (Res - 1);
401401
}
402402

403-
return getImmOpValue(MI, OpNo, Fixups, STI);
403+
llvm_unreachable("Unhandled expression!");
404+
return 0;
404405
}
405406

406407
uint64_t

llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ class QCIBitManipRII<bits<3> funct3, bits<2> funct2,
125125
(ins InTyRs1:$rs1, uimm5_plus1:$width, uimm5:$shamt),
126126
opcodestr, "$rd, $rs1, $width, $shamt"> {
127127
bits<5> shamt;
128-
bits<6> width;
128+
bits<5> width;
129129

130130
let Inst{31-30} = funct2;
131-
let Inst{29-25} = width{4-0};
131+
let Inst{29-25} = width;
132132
let Inst{24-20} = shamt;
133133
}
134134

@@ -406,10 +406,10 @@ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
406406
"$rd, $imm5, $width, $shamt"> {
407407
bits<5> imm5;
408408
bits<5> shamt;
409-
bits<6> width;
409+
bits<5> width;
410410
let rs1 = imm5;
411411
let Inst{31-30} = 0b00;
412-
let Inst{29-25} = width{4-0};
412+
let Inst{29-25} = width;
413413
let Inst{24-20} = shamt;
414414
}
415415
def QC_INSB : QCIBitManipRII<0b001, 0b01, GPR, "qc.insb">;
@@ -443,7 +443,7 @@ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
443443
bits<5> rd;
444444
bits<5> width;
445445
let Constraints = "$rd = $rd_wb";
446-
let Inst{6-2} = width{4-0};
446+
let Inst{6-2} = width;
447447
let Inst{11-7} = rd;
448448
let Inst{12} = 0b1;
449449
}

llvm/test/MC/Disassembler/RISCV/xqci-invalid.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# RUN: not llvm-mc -disassemble -triple=riscv32 -mattr=+experimental-xqciac %s | FileCheck %s
2+
# RUN: not llvm-mc -disassemble -triple=riscv32 -mattr=+experimental-xqcibm %s \
3+
# RUN: | FileCheck -check-prefixes=CHECK-XQCIBM %s
24

35
[0x00,0x00]
46
# CHECK: unimp
@@ -8,3 +10,6 @@
810

911
[0x00,0x00]
1012
# CHECK: unimp
13+
14+
[0x92,0x17]
15+
# CHECK-XQCIBM-NOT: qc.c.extu a5, 4

0 commit comments

Comments
 (0)