diff --git a/llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s b/llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s @@ -0,0 +1,80 @@ +# RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \ +# RUN: | llvm-objdump -d -M no-aliases --no-show-raw-insn - \ +# RUN: | FileCheck --match-full-lines %s + +# CHECK: 00000000 : +foo: +# CHECK: 0: beq t0, t1, 0x58 +beq t0, t1, .Llocal +# CHECK: 4: bne t0, t1, 0x58 +bne t0, t1, .Llocal +# CHECK: 8: blt t0, t1, 0x58 +blt t0, t1, .Llocal +# CHECK: c: bge t0, t1, 0x58 +bge t0, t1, .Llocal +# CHECK: 10: bltu t0, t1, 0x58 +bltu t0, t1, .Llocal +# CHECK: 14: bgeu t0, t1, 0x58 +bgeu t0, t1, .Llocal + +# CHECK: 18: c.beqz a0, 0x58 +beq a0, zero, .Llocal +# CHECK: 1a: c.bnez a0, 0x58 +bne a0, zero, .Llocal + +# CHECK: 1c: beq t0, t1, 0x60 +beq t0, t1, bar +# CHECK: 20: bne t0, t1, 0x60 +bne t0, t1, bar +# CHECK: 24: blt t0, t1, 0x60 +blt t0, t1, bar +# CHECK: 28: bge t0, t1, 0x60 +bge t0, t1, bar +# CHECK: 2c: bltu t0, t1, 0x60 +bltu t0, t1, bar +# CHECK: 30: bgeu t0, t1, 0x60 +bgeu t0, t1, bar + +# CHECK: 34: c.beqz a0, 0x60 +beq a0, zero, bar +# CHECK: 36: c.bnez a0, 0x60 +bne a0, zero, bar + +# CHECK: 38: jal t0, 0x58 +jal t0, .Llocal +# CHECK: 3c: c.jal 0x58 +c.jal .Llocal + +# CHECK: 3e: c.j 0x58 +c.j .Llocal + +# CHECK: 40: jal t0, 0x60 +jal t0, bar +# CHECK: 44: c.jal 0x60 +c.jal bar + +# CHECK: 46: c.j 0x60 +c.j bar + +# CHECK: 48: auipc ra, 0 +# CHECK: 4c: jalr ra, 16(ra) +call .Llocal + +# CHECK: 50: auipc ra, 0 +# CHECK: 54: jalr ra, 16(ra) +call bar + +.Llocal: +# CHECK: 58: c.nop +# CHECK: 5a: c.nop +# CHECK: 5c: c.nop +# CHECK: 5e: c.nop +nop +nop +nop +nop + +# CHECK: 00000060 : +bar: +# CHECK: 60: c.nop +nop