From patchwork Thu Jun 29 16:34:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 11441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9764401vqr; Thu, 29 Jun 2023 09:35:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFRmCUuO+FB1af8y8nH0ZRxY9clsv3JNSnmQk4w4vbDWAhzxsBzVC6GrqIiAomHY83E8Yz5 X-Received: by 2002:a17:906:980d:b0:98e:16b9:6c8c with SMTP id lm13-20020a170906980d00b0098e16b96c8cmr22993ejb.14.1688056524316; Thu, 29 Jun 2023 09:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688056524; cv=none; d=google.com; s=arc-20160816; b=Tq22KhyyrYRAs7nfhEHo/6x9bDymGUvJ5rj6dn67yykTgACllpboSnuaVkHo/Y10bq zE+6j2Cj9p3SZemEtRFqa5DJqCZ3oRJtTxz7pg2k8bU65ur0qS8y4XiuGUoH3pjH5qSn rcNz4VPciHEQX1Xn9XnEl/z8F5rsLY2h8pS3W5TKqmZiqdLXkf/rfYVnb/aREADzEfPt oAoNrcXs1ujho6zH3dFnXYtNCl/hncHC5qR2c84/RI85ln5D+GmOnG3Hy0ysrIQxiAx2 8mUm5M1FnbfDX8AkKUYbpnQauYq7wUC/T3bLxaaPExW0p8BPeuzQa0Oz71cMFF9MgytI 9Y0w== 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:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=qtayWwoMQ22wmWkBg5VHaCxJc0vlT0By9Us0I6uCYDw=; fh=F52lMKP/ag7PTpjpGsg79bnedhkoffS1BBUct4g/1x0=; b=uwET+Gcs7aLD0BtoCttWh4S7V/iJriW/Maiqbp3VgyMa21yKshTfzi7nrNv3MbXeeb GVRyXFn8yO6Ue3pibUhFDQlBKSN8d8C9LXRlTZODHulZ83Ob03VlL7SIIaFlzamfnCct dWnUZofMjgnxoPuf59YC22+7b7MRUs7oLsvmT1n4nx8te1+sGDSenFacDZc9q1qvKnjk K/itr/nID94VHYksDkkQHtoNE4KLuQs8/shwwzSZxppKD3RgyQh89ABbEyd0wOTNIAB9 m4OT1XxA/eH1xrZC42eL3nOuUjd3dTuKcwRFaCd0kKPZ1u1l+2DkiXgT2Zd7Te5WrwMj +gAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=rmiBLLKx; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id rv18-20020a17090710d200b00992a9bdb0e4si1188099ejb.309.2023.06.29.09.35.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 09:35:24 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=rmiBLLKx; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 479D43858408 for ; Thu, 29 Jun 2023 16:35:23 +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 5548C3858D37 for ; Thu, 29 Jun 2023 16:35:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5548C3858D37 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=1688056507; bh=5rAt0lm24LwTzTboQaiDiXiZd4mGF6L3zjiQrgyv8cg=; h=From:To:Cc:Subject:Date:From; b=rmiBLLKxxgxwQBScaPpIN9Lt6X4BhPtrR1SkNthMxirbS6BKu8LxzrmFHdkhvmVBu /fJdQZl5y4PYKiMI5c58Uvf65vUJIB/TqhumpR6pao2/l7Cswrto9eKnnDupkgJaSI x8kDNbduv57dDXx0Ac1wgdX5+ceWmQSzIVz5w7fE= 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 8671460103; Fri, 30 Jun 2023 00:35:06 +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 v7 0/7] LoongArch: disassembler improvements & deprecate old register aliases Date: Fri, 30 Jun 2023 00:34:57 +0800 Message-Id: <20230629163504.1331025-1-i.swmail@xen0n.name> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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?1770055558132954443?= X-GMAIL-MSGID: =?utf-8?q?1770055558132954443?= From: WANG Xuerui Hi, This series implements colored output for LoongArch disassembly, and some minor tweaks to the output so there is less clutter. While at it, also deprecate the aliases $v0, $v1, $fv0, $fv1 and $x, so users don't find it confusing in an era when $vrNN and $xrNN (LSX/LASX registers) are also available. The patch is included last because its test case would need tweaking if the disassembler changes first get merged anyway. The 4th revision was sent back in February but at that time the Loongson maintainers were busy with linker relaxation support; now that the work was done let's try upstreaming this series again, hopefully for inclusion in binutils 2.41. Changes from v6: - Fixed more test failures Changes from v5: - Rebased - Added DCO (Signed-off-by) tags and changelog entries (I hate them but it seems LoongArch patches usually carry some, so I went for consistency) - Absorbed the https://sourceware.org/pipermail/binutils/2023-June/128073.html patch - Minor tweaks to the commit messages Changes from v4: - Rebased (mainly test case changes) Changes from v3: - Fixed ld test cases (make check-gas and make check-ld both pass on x86_64 and loongarch64) - Branch target address is now correctly printed in comment style, plus code simplification as suggested Changes from v2: - Fixed test cases - Added the fixed "LoongArch: support disassembling certain pseudo- instructions" patch into this series - Fixed ".insn" in the last patch to say ".word" instead (MIPS muscle memory strikes back hard) - Fixed some commit messages - Added mengqinggang to Cc list WANG Xuerui (7): LoongArch: support disassembling certain pseudo-instructions opcodes/loongarch: remove unused code opcodes/loongarch: implement style support in the disassembler opcodes/loongarch: style disassembled address offsets as such opcodes/loongarch: do not print hex notation for signed immediates opcodes/loongarch: print unrecognized insn words with the .word directive LoongArch: Deprecate $v[01], $fv[01] and $x names per spec gas/config/tc-loongarch.c | 45 +++++- gas/testsuite/gas/loongarch/64_pcrel.d | 2 +- .../gas/loongarch/deprecated_reg_aliases.d | 18 +++ .../gas/loongarch/deprecated_reg_aliases.l | 7 + .../gas/loongarch/deprecated_reg_aliases.s | 5 + gas/testsuite/gas/loongarch/imm_ins.d | 84 +++++------ gas/testsuite/gas/loongarch/imm_ins_32.d | 54 +++---- gas/testsuite/gas/loongarch/imm_op.d | 44 +++--- gas/testsuite/gas/loongarch/jmp_op.d | 44 +++--- gas/testsuite/gas/loongarch/li.d | 8 +- gas/testsuite/gas/loongarch/load_store_op.d | 80 +++++----- gas/testsuite/gas/loongarch/macro_op.d | 4 +- gas/testsuite/gas/loongarch/macro_op_32.d | 4 +- .../gas/loongarch/macro_op_large_abs.d | 12 +- .../gas/loongarch/macro_op_large_pc.d | 12 +- gas/testsuite/gas/loongarch/nop.d | 2 +- gas/testsuite/gas/loongarch/privilege_op.d | 8 +- gas/testsuite/gas/loongarch/raw-insn.d | 11 ++ gas/testsuite/gas/loongarch/raw-insn.s | 7 + gas/testsuite/gas/loongarch/relax_align.d | 6 +- gas/testsuite/gas/loongarch/reloc.d | 2 +- gas/testsuite/gas/loongarch/uleb128.d | 22 +-- gas/testsuite/gas/loongarch/vector.d | 140 +++++++++--------- include/opcode/loongarch.h | 11 +- ld/testsuite/ld-loongarch-elf/jmp_op.d | 40 ++--- ld/testsuite/ld-loongarch-elf/macro_op.d | 24 +-- ld/testsuite/ld-loongarch-elf/macro_op_32.d | 4 +- ld/testsuite/ld-loongarch-elf/relax-align.dd | 4 +- opcodes/disassemble.c | 5 + opcodes/loongarch-dis.c | 118 ++++++--------- opcodes/loongarch-opc.c | 81 ++++++---- 31 files changed, 495 insertions(+), 413 deletions(-) create mode 100644 gas/testsuite/gas/loongarch/deprecated_reg_aliases.d create mode 100644 gas/testsuite/gas/loongarch/deprecated_reg_aliases.l create mode 100644 gas/testsuite/gas/loongarch/deprecated_reg_aliases.s create mode 100644 gas/testsuite/gas/loongarch/raw-insn.d create mode 100644 gas/testsuite/gas/loongarch/raw-insn.s