38 lines · plain
1# REQUIRES: riscv2# REQUIRES: python3 4# This test verifies that disassemble -b prints out the correct bytes and5# format for standard and unknown riscv instructions of various sizes,6# and that unknown instructions show opcodes and disassemble as "<unknown>".7# It also tests that the fdis command from examples/python/filter_disasm.py8# pipes the disassembly output through a simple filter program correctly.9 10 11# RUN: llvm-mc -filetype=obj -mattr=+c --triple=riscv32-unknown-unknown %s -o %t12# RUN: %lldb -b %t "-o" "disassemble -b -n main" | FileCheck %s13# RUN: %lldb -b %t -o "command script import %S/../../../examples/python/filter_disasm.py" -o "fdis set %python %S/Inputs/dis_filt.py" -o "fdis -n main" | FileCheck --check-prefix=FILTER %s14 15main:16 addi sp, sp, -0x20 # 16 bit standard instruction17 sw a0, -0xc(s0) # 32 bit standard instruction18 .insn 8, 0x2000200940003F; # 64 bit custom instruction19 .insn 6, 0x021F | 0x00001000 << 32 # 48 bit xqci.e.li rd=8 imm=0x100020 .insn 4, 0x84F940B # 32 bit xqci.insbi 21 .insn 2, 0xB8F2 # 16 bit cm.push22 23# CHECK: [0x0] <+0>: 1101 addi sp, sp, -0x20 24# CHECK-NEXT: [0x2] <+2>: fea42a23 sw a0, -0xc(s0)25# CHECK-NEXT: [0x6] <+6>: 0940003f 00200020 <unknown>26# CHECK-NEXT: [0xe] <+14>: 021f 0000 1000 <unknown>27# CHECK-NEXT: [0x14] <+20>: 084f940b <unknown>28# CHECK-NEXT: [0x18] <+24>: b8f2 <unknown>29 30# FILTER: Disassembly filter command (fdis) loaded31# FILTER: [0x0] <+0>: 1101 addi sp, sp, -0x20 32# FILTER-NEXT: [0x2] <+2>: fea42a23 sw a0, -0xc(s0)33# FILTER-NEXT: [0x6] <+6>: 0940003f 00200020 Fake6434# FILTER-NEXT: [0xe] <+14>: 021f 0000 1000 <unknown>35# FILTER-NEXT: [0x14] <+20>: 084f940b <unknown>36# FILTER-NEXT: [0x18] <+24>: b8f2 <unknown>37 38