From patchwork Wed Jun 28 11:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 113821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8862418vqr; Wed, 28 Jun 2023 04:55:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5YvTI6p8FHfhhmdtjP5j6hbt2yl12IiJUw1p+FXIksFWYcd98DJr2QtucW6tVoim9CtnQr X-Received: by 2002:a50:ee96:0:b0:518:7cf5:7ff8 with SMTP id f22-20020a50ee96000000b005187cf57ff8mr23107263edr.12.1687953330122; Wed, 28 Jun 2023 04:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687953330; cv=none; d=google.com; s=arc-20160816; b=hTO/FLx1Umcrm7BH0lVtpAfPGjW4Cm8CkU6w2QOuZ5jU2wNi8hQK2ra99selCUGapL PrBc5ZRWErOrgNVmc/6Ru7UztK+5hGpqwJHZexO7fWs9GDvOeQFOHKrgX5KSz5wjVc2c pcVoS3ZmKYb6V2prBM9C9l/oia5ea0uCUjroun1mSYR7R6fVpnPH04h96nA/m6POJrMN +VVEI1KEKTF31bmw3xAXGYvfIbZhoT26BB0QszRroaHJq01kw67y0+qux92WbO9uYywB KEgi+wnmHhMUfPsRdlrIN/vc+8v0n6d9FnGoa60qNMEToLA1yTPd/8ofylc2dMs20BMe eByA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=KfVD5tQ8Rv5vNjqF2+nKd0F6hdJ7BzbD1Qh1m+3MbZU=; fh=F52lMKP/ag7PTpjpGsg79bnedhkoffS1BBUct4g/1x0=; b=LBSHMJxAyXtR2GdBepTNIhoNX2WfzhhQ/AAumf0MtvpbWGQUjrNPuDram1gczkBicB sZVF4/bkuP18ZzL2PgTZbBRjSFnSR+L82k1ITMWdMVZyGl0/7hayjLqUS2UH4IiRNEmB E1XbM28n1fZbDeQEB1iatxIuXZQadGEbD1aSImu68eYlnKkTJTuyVbNT+3PxxZYsl9Vw FqwLEd6cXi/3IjYilWDR5OU83MzXXmgQMUU2HwHwSRD3XF8Ck0PtB/DOZbpmdyDHRfDD ef1IIqduoPexBEcxuXjzztVVTno3EYSEiP3WI2r4ZV5RrQhecT/oWImzLjWdVbeTznNI N07A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=oyHr4CqX; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v12-20020aa7cd4c000000b0051d80279e56si5208534edw.70.2023.06.28.04.55.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 04:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=oyHr4CqX; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28A843882026 for ; Wed, 28 Jun 2023 11:52:34 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by sourceware.org (Postfix) with ESMTPS id 29862385828D for ; Wed, 28 Jun 2023 11:51:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29862385828D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=xen0n.name Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xen0n.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1687953088; bh=0ZnGwY3oBQuvJc2ncywCU2TwVyy1Ln8KD5fd49SEf/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oyHr4CqXAX9ZwY1XEv2X8ETBFRiuDu7V0J4Nvf7I8ANlVfEIppvyxDLtUMj3R2dMm uQ5kwVYdk9dGyLYxIR6Pq/XWB6YR9wcskJ3moSI1L0rMPYRR13j/yxbcDeCG0PWv+j dwjdJXGBXgJerZtX0Oiv2le4cOworRossMefdXNQ= Received: from ld50.lan (unknown [101.88.25.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 0D36D605E8; Wed, 28 Jun 2023 19:51:28 +0800 (CST) From: WANG Xuerui To: binutils@sourceware.org Cc: Chenghua Xu , Zhensong Liu , Qinggang Meng , Lulu Cheng , Fangrui Song , Xi Ruoyao , WANG Xuerui Subject: [PATCH v5 6/6] opcodes/loongarch: print unrecognized insn words with the .word directive Date: Wed, 28 Jun 2023 19:51:03 +0800 Message-Id: <20230628115103.3440262-7-i.swmail@xen0n.name> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230628115103.3440262-1-i.swmail@xen0n.name> References: <20230628115103.3440262-1-i.swmail@xen0n.name> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769947350759619533?= X-GMAIL-MSGID: =?utf-8?q?1769947350759619533?= From: WANG Xuerui 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 : +[ ]+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 10614a5a704..c87ea569791 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; }