xref: /llvm-project/llvm/test/tools/llvm-objdump/ELF/RISCV/multi-instr-target.s (revision c532ba4edd7ad7675ba450ba43268aa9e7bda46b)
1# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s | \
2# RUN:     llvm-objdump --no-print-imm-hex -d -M no-aliases --no-show-raw-insn - | \
3# RUN:     FileCheck %s
4
5## Test multiple interleaved auipc/jalr pairs
6# CHECK: auipc t0, 0
71: auipc t0, %pcrel_hi(bar)
8# CHECK: auipc t1, 0
92: auipc t1, %pcrel_hi(bar)
10# CHECK: jalr ra, {{[0-9]+}}(t0) <bar>
11jalr %pcrel_lo(1b)(t0)
12## Target should not be printed because the call above clobbers register state
13# CHECK: jalr ra, {{[0-9]+}}(t1){{$}}
14jalr %pcrel_lo(2b)(t1)
15
16## Test that auipc+jalr with a write to the target register in between does not
17## print the target
18# CHECK: auipc t0, 0
191: auipc t0, %pcrel_hi(bar)
20# CHECK: c.li t0, 0
21li t0, 0
22# CHECK: jalr ra, {{[0-9]+}}(t0){{$}}
23jalr %pcrel_lo(1b)(t0)
24
25## Test that auipc+jalr with a write to an unrelated register in between does
26## print the target
27# CHECK: auipc t0, 0
281: auipc t0, %pcrel_hi(bar)
29# CHECK: c.li t1, 0
30li t1, 0
31# CHECK: jalr ra, {{[0-9]+}}(t0) <bar>
32jalr %pcrel_lo(1b)(t0)
33
34## Test that auipc+jalr with a terminator in between does not print the target
35# CHECK: auipc t0, 0
361: auipc t0, %pcrel_hi(bar)
37# CHECK: c.j {{.*}} <bar>
38j bar
39# CHECK: jalr ra, {{[0-9]+}}(t0){{$}}
40jalr %pcrel_lo(1b)(t0)
41
42# CHECK-LABEL: <bar>:
43bar:
44# CHECK: c.nop
45nop
46