[v4,6/6] opcodes/loongarch: print unrecognized insn words with the .word directive
Checks
Commit Message
From: WANG Xuerui <git@xen0n.name>
For better round-trip fidelity and readability in general.
---
gas/testsuite/gas/loongarch/raw-insn.d | 11 +++++++++++
gas/testsuite/gas/loongarch/raw-insn.s | 7 +++++++
opcodes/loongarch-dis.c | 1 +
3 files changed, 19 insertions(+)
create mode 100644 gas/testsuite/gas/loongarch/raw-insn.d
create mode 100644 gas/testsuite/gas/loongarch/raw-insn.s
new file mode 100644
@@ -0,0 +1,11 @@
+#as:
+#objdump: -dr
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ ]+0:[ ]+00000000[ ]+.word[ ]+0x00000000
+[ ]+4:[ ]+feedf00d[ ]+.word[ ]+0xfeedf00d
new file mode 100644
@@ -0,0 +1,7 @@
+target:
+ .word 0
+ # Given how the LoongArch encoding space is apparently centrally-
+ # managed and sequentially allocated in chunks of prefixes, it is
+ # highly unlikely this would become a valid LoongArch instruction in
+ # the foreseeable future.
+ .word 0xfeedf00d
@@ -250,6 +250,7 @@ disassemble_one (insn_t insn, struct disassemble_info *info)
if (!opc)
{
info->insn_type = dis_noninsn;
+ info->fprintf_styled_func (info->stream, dis_style_assembler_directive, ".word\t\t");
info->fprintf_styled_func (info->stream, dis_style_immediate, "0x%08x", insn);
return;
}