[PATCH] D116676: [1/4] [llvm-objdump][NFC] Add RISC-V objdump test case

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 10:32:20 PST 2022


asb created this revision.
Herald added subscribers: VincentWu, luke957, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, rupprecht, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, emaste.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
asb requested review of this revision.
Herald added a subscriber: StephenFan.
Herald added a project: LLVM.

This test case captures the current state of support for printing branch targets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116676

Files:
  llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s


Index: llvm/test/tools/llvm-objdump/ELF/RISCV/branches.s
===================================================================
--- /dev/null
+++ 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>:
+foo:
+# CHECK: 0: beq t0, t1, 0x58 <foo+0x58>
+beq t0, t1, .Llocal
+# CHECK: 4: bne t0, t1, 0x58 <foo+0x58>
+bne t0, t1, .Llocal
+# CHECK: 8: blt t0, t1, 0x58 <foo+0x58>
+blt t0, t1, .Llocal
+# CHECK: c: bge t0, t1, 0x58 <foo+0x58>
+bge t0, t1, .Llocal
+# CHECK: 10: bltu t0, t1, 0x58 <foo+0x58>
+bltu t0, t1, .Llocal
+# CHECK: 14: bgeu t0, t1, 0x58 <foo+0x58>
+bgeu t0, t1, .Llocal
+
+# CHECK: 18: c.beqz a0, 0x58 <foo+0x58>
+beq a0, zero, .Llocal
+# CHECK: 1a: c.bnez a0, 0x58 <foo+0x58>
+bne a0, zero, .Llocal
+
+# CHECK: 1c: beq t0, t1, 0x60 <bar>
+beq t0, t1, bar
+# CHECK: 20: bne t0, t1, 0x60 <bar>
+bne t0, t1, bar
+# CHECK: 24: blt t0, t1, 0x60 <bar>
+blt t0, t1, bar
+# CHECK: 28: bge t0, t1, 0x60 <bar>
+bge t0, t1, bar
+# CHECK: 2c: bltu	t0, t1, 0x60 <bar>
+bltu t0, t1, bar
+# CHECK: 30: bgeu	t0, t1, 0x60 <bar>
+bgeu t0, t1, bar
+
+# CHECK: 34: c.beqz	a0, 0x60 <bar>
+beq a0, zero, bar
+# CHECK: 36: c.bnez	a0, 0x60 <bar>
+bne a0, zero, bar
+
+# CHECK: 38: jal t0, 0x58 <foo+0x58>
+jal t0, .Llocal
+# CHECK: 3c: c.jal 0x58 <foo+0x58>
+c.jal .Llocal
+
+# CHECK: 3e: c.j 0x58 <foo+0x58>
+c.j .Llocal
+
+# CHECK: 40: jal t0, 0x60 <bar>
+jal t0, bar
+# CHECK: 44: c.jal 0x60 <bar>
+c.jal bar
+
+# CHECK: 46: c.j 0x60 <bar>
+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>:
+bar:
+# CHECK: 60: c.nop
+nop


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116676.397634.patch
Type: text/x-patch
Size: 1968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220105/4d40b64a/attachment.bin>


More information about the llvm-commits mailing list