public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/1] RISC-V: Fix zip/unzip on disassembler
@ 2022-06-03 12:04 Tsukasa OI
  2022-06-03 12:04 ` [PATCH 1/1] RISC-V: Make zip/unzip on Zbkb non-aliases Tsukasa OI
  0 siblings, 1 reply; 2+ messages in thread
From: Tsukasa OI @ 2022-06-03 12:04 UTC (permalink / raw)
  To: Tsukasa OI, Kito Cheng, Palmer Dabbelt; +Cc: binutils

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-03 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 12:04 [PATCH 0/1] RISC-V: Fix zip/unzip on disassembler Tsukasa OI
2022-06-03 12:04 ` [PATCH 1/1] RISC-V: Make zip/unzip on Zbkb non-aliases Tsukasa OI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).