File tree Expand file tree Collapse file tree 3 files changed +69
-8
lines changed
lib/Target/RISCV/MCTargetDesc
test/MC/Disassembler/RISCV Expand file tree Collapse file tree 3 files changed +69
-8
lines changed Original file line number Diff line number Diff line change @@ -212,24 +212,24 @@ class RISCVMCInstrAnalysis : public MCInstrAnalysis {
212212 return true ;
213213 }
214214
215- if (Inst.getOpcode () == RISCV::C_JAL || Inst.getOpcode () == RISCV::C_J) {
215+ switch (Inst.getOpcode ()) {
216+ case RISCV::C_J:
217+ case RISCV::C_JAL:
218+ case RISCV::QC_E_J:
219+ case RISCV::QC_E_JAL:
216220 Target = Addr + Inst.getOperand (0 ).getImm ();
217221 return true ;
218- }
219-
220- if (Inst.getOpcode () == RISCV::JAL) {
222+ case RISCV::JAL:
221223 Target = Addr + Inst.getOperand (1 ).getImm ();
222224 return true ;
223- }
224-
225- if (Inst.getOpcode () == RISCV::JALR) {
225+ case RISCV::JALR: {
226226 if (auto TargetRegState = getGPRState (Inst.getOperand (1 ).getReg ())) {
227227 Target = *TargetRegState + Inst.getOperand (2 ).getImm ();
228228 return true ;
229229 }
230-
231230 return false ;
232231 }
232+ }
233233
234234 return false ;
235235 }
Original file line number Diff line number Diff line change 1+ # RUN: llvm-mc -assemble -triple riscv32 \
2+ # RUN: -mattr=+xcvbi \
3+ # RUN: %s -filetype=obj -o - \
4+ # RUN: | llvm-objdump -d -M no-aliases - \
5+ # RUN: --mattr=+xcvbi \
6+ # RUN: | FileCheck %s
7+
8+ .option exact
9+
10+ # CHECK-LABEL: <label1>:
11+ label1:
12+
13+ # CHECK-NEXT: cv.beqimm a0, 0x1, 0x0 <label1>
14+ cv.beqimm a0, 1, label1
15+ # CHECK-NEXT: cv.beqimm a0, 0x1, 0x10 <label2>
16+ cv.beqimm a0, 1, label2
17+
18+ # CHECK-NEXT: cv.bneimm a0, 0x2, 0x0 <label1>
19+ cv.bneimm a0, 2, label1
20+ # CHECK-NEXT: cv.bneimm a0, 0x2, 0x10 <label2>
21+ cv.bneimm a0, 2, label2
22+
23+
24+ label2:
25+
Original file line number Diff line number Diff line change 1+ # RUN: llvm-mc -assemble -triple riscv32 \
2+ # RUN: -mattr=+experimental-xqcilb,+experimental-xqcibi \
3+ # RUN: %s -filetype=obj -o - \
4+ # RUN: | llvm-objdump -d -M no-aliases - \
5+ # RUN: --mattr=+experimental-xqcilb,+experimental-xqcibi \
6+ # RUN: | FileCheck %s
7+
8+ .option exact
9+
10+ # CHECK-LABEL: <label1>:
11+ label1:
12+
13+ # CHECK-NEXT: qc.e.j 0x0 <label1>
14+ qc.e.j label1
15+ # CHECK-NEXT: qc.e.j 0x2c <label2>
16+ qc.e.j label2
17+
18+ # CHECK-NEXT: qc.e.jal 0x0 <label1>
19+ qc.e.jal label1
20+ # CHECK-NEXT: qc.e.jal 0x2c <label2>
21+ qc.e.jal label2
22+
23+ # CHECK-NEXT: qc.beqi a0, 0x1, 0x0 <label1>
24+ qc.beqi a0, 1, label1
25+
26+ # CHECK-NEXT: qc.bnei a0, 0x1, 0x2c <label2>
27+ qc.bnei a0, 1, label2
28+
29+ # CHECK-NEXT: qc.e.beqi a0, 0x2, 0x0 <label1>
30+ qc.e.beqi a0, 2, label1
31+
32+ # CHECK-NEXT: qc.e.bnei a0, 0x2, 0x2c <label2>
33+ qc.e.bnei a0, 2, label2
34+
35+ label2:
36+
You can’t perform that action at this time.
0 commit comments