From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 972AE3857022 for ; Mon, 3 Oct 2022 10:45:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 972AE3857022 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id E04C6300089; Mon, 3 Oct 2022 10:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1664793902; bh=lMuw8ojelJl0YCR8WnpKmBtaB5yygTiimENEsWnbbyM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=dbaqdnzETJM3iT2StQ/pEzpEs8aygmAKwEo8ykiC5toMytLiLZCtvMvSGLW7iypCp OBPmQLFHGXbE5ZPTmialNGuG/pPYAHVh5Ud9LQXE8fMoxNcczSK6Txxufmn1Ycx86Q YAsLp2Ae5OOZQv8AuB+QfDcKYbHAk9EblRqDBvKc= From: Tsukasa OI To: Tsukasa OI , =?UTF-8?q?Christoph=20M=C3=BCllner?= , Nelson Chu , Kito Cheng , Palmer Dabbelt , Andrew Burgess Cc: binutils@sourceware.org Subject: [PATCH v3 3/6] RISC-V: Optimize riscv_disassemble_data printf Date: Mon, 3 Oct 2022 10:44:01 +0000 Message-Id: <0002ea716713ace4998a33dde0b81f4f890d10bf.1664793840.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,KAM_MANYTO,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This commit makes types of printf arguments on riscv_disassemble_data as small as possible (as long as we can preserve the portability) to reduce the cost of printf (especially on 32-bit host). opcodes/ChangeLog: * riscv-dis.c (riscv_disassemble_data): Use smallest possible type to printing data. --- opcodes/riscv-dis.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 503b839f19e..70f484189f5 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -963,24 +963,22 @@ riscv_disassemble_data (bfd_vma memaddr ATTRIBUTE_UNUSED, (*info->fprintf_styled_func) (info->stream, dis_style_assembler_directive, ".byte\t"); (*info->fprintf_styled_func) - (info->stream, dis_style_immediate, "0x%02llx", - (unsigned long long) data); + (info->stream, dis_style_immediate, "0x%02x", (unsigned) data); break; case 2: info->bytes_per_line = 8; (*info->fprintf_styled_func) (info->stream, dis_style_assembler_directive, ".short\t"); (*info->fprintf_styled_func) - (info->stream, dis_style_immediate, "0x%04llx", - (unsigned long long) data); + (info->stream, dis_style_immediate, "0x%04x", (unsigned) data); break; case 4: info->bytes_per_line = 8; (*info->fprintf_styled_func) (info->stream, dis_style_assembler_directive, ".word\t"); (*info->fprintf_styled_func) - (info->stream, dis_style_immediate, "0x%08llx", - (unsigned long long) data); + (info->stream, dis_style_immediate, "0x%08lx", + (unsigned long) data); break; case 8: info->bytes_per_line = 8; -- 2.34.1