[PATCH 0/1] RISC-V: Fix zip/unzip on disassembler

Tsukasa OI research_trasio@irq.a4lg.com
Fri Jun 3 12:04:39 GMT 2022


Hello,

I noticed another disassembler issue and this is a fix.


zip and unzip are instructions from Zbkb extension (RV32 only).
They are, in fact, specialized forms of shfli and unshfli instructions,
respectively.  The problem now is, since generalized shfli and unshfli
are not ratified AND zip/unzip are defined as aliases (with INSN_ALIAS),
it causes a problem on the diassembler.

With following assembler file with -march=rv32i_zbkb,
    _start:
        zip a0, a1
        unzip a2, a3

The output with `objdump -d' is like this:
    80000028 <_start>:
    80000028:   08f59513      zip     a0,a1
    8000002c:   08f6d613      unzip   a2,a3

However, output with `objdump -d -M no-aliases' looks like this:
    80000028 <_start>:
    80000028:   08f59513      .4byte  0x8f59513
    8000002c:   08f6d613      .4byte  0x8f6d613

You can see that `-M no-aliases' option causes disassembler to ignore
zip/unzip instructions but cannot find right non-alias instructions.

Until generalized shfli and unshfli instructions are ratified,
my simple patch (which makes zip/unzip non-aliases) does the trick.

When generalized shfli and unshfli instructions are ratified, the
situation will be a bit different.  As the same issue is already present
on disassembling zext.h instruction on RV{32,64}_Zbb_Zbkb, this is to
be fixed (but WITH ANOTHER PATCHSET I will submit later).




Tsukasa OI (1):
  RISC-V: Make zip/unzip on Zbkb non-aliases

 opcodes/riscv-opc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 625b6eae091709b95471eae92d42dc6bc71e6553
-- 
2.34.1



More information about the Binutils mailing list