public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: WANG Xuerui <i.swmail@xen0n.name>
To: binutils@sourceware.org
Cc: Chenghua Xu <xuchenghua@loongson.cn>,
	Zhensong Liu <liuzhensong@loongson.cn>,
	Qinggang Meng <mengqinggang@loongson.cn>,
	Xi Ruoyao <xry111@xry111.site>, WANG Xuerui <git@xen0n.name>
Subject: [PATCH v3 6/6] opcodes/loongarch: print unrecognized insn words with the .word directive
Date: Wed, 14 Dec 2022 13:52:04 +0800	[thread overview]
Message-ID: <20221214055204.2890795-7-i.swmail@xen0n.name> (raw)
In-Reply-To: <20221214055204.2890795-1-i.swmail@xen0n.name>

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

diff --git a/gas/testsuite/gas/loongarch/raw-insn.d b/gas/testsuite/gas/loongarch/raw-insn.d
new file mode 100644
index 00000000000..64980e47f7b
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/raw-insn.d
@@ -0,0 +1,11 @@
+#as:
+#objdump: -dr
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+0:[ 	]+00000000[ 	]+.word[ 	]+0x00000000
+[ 	]+4:[ 	]+feedf00d[ 	]+.word[ 	]+0xfeedf00d
diff --git a/gas/testsuite/gas/loongarch/raw-insn.s b/gas/testsuite/gas/loongarch/raw-insn.s
new file mode 100644
index 00000000000..528b15263ae
--- /dev/null
+++ b/gas/testsuite/gas/loongarch/raw-insn.s
@@ -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
diff --git a/opcodes/loongarch-dis.c b/opcodes/loongarch-dis.c
index b73ef43f8ea..7ac2b07465a 100644
--- a/opcodes/loongarch-dis.c
+++ b/opcodes/loongarch-dis.c
@@ -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;
     }
-- 
2.38.1


  parent reply	other threads:[~2022-12-14  5:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  5:51 [PATCH v3 RESEND 0/6] LoongArch: colored disassembly and readability tweaks WANG Xuerui
2022-12-14  5:51 ` [PATCH v3 1/6] LoongArch: support disassembling certain pseudo-instructions WANG Xuerui
2022-12-14  5:52 ` [PATCH v3 2/6] opcodes/loongarch: remove unused code WANG Xuerui
2022-12-14  5:52 ` [PATCH v3 3/6] opcodes/loongarch: implement style support in the disassembler WANG Xuerui
2023-01-17 10:37   ` Andrew Burgess
2022-12-14  5:52 ` [PATCH v3 4/6] opcodes/loongarch: style disassembled address offsets as such WANG Xuerui
2022-12-14  5:52 ` [PATCH v3 5/6] opcodes/loongarch: do not print hex notation for signed immediates WANG Xuerui
2022-12-14  5:52 ` WANG Xuerui [this message]
2023-01-03  4:05 ` [PATCH v3 RESEND 0/6] LoongArch: colored disassembly and readability tweaks WANG Xuerui
2023-01-03 11:10   ` mengqinggang
2023-01-03 11:16     ` WANG Xuerui
  -- strict thread matches above, loose matches on Subject: below --
2022-12-14  5:46 [PATCH v3 " WANG Xuerui
2022-12-14  5:47 ` [PATCH v3 6/6] opcodes/loongarch: print unrecognized insn words with the .word directive WANG Xuerui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221214055204.2890795-7-i.swmail@xen0n.name \
    --to=i.swmail@xen0n.name \
    --cc=binutils@sourceware.org \
    --cc=git@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=mengqinggang@loongson.cn \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).