From patchwork Mon Oct 3 10:44:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 1647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp886422wrs; Mon, 3 Oct 2022 03:47:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5obwnFfnbE+NbcQJ4focov0JrqBTSwfNauhb7bRk8wEzXIRMVUSIXEXeSGGsO9Bi18rjJ+ X-Received: by 2002:a17:907:2bdd:b0:77d:e0f3:81e5 with SMTP id gv29-20020a1709072bdd00b0077de0f381e5mr14677637ejc.328.1664794038140; Mon, 03 Oct 2022 03:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664794038; cv=none; d=google.com; s=arc-20160816; b=V7+3KZKEY7OARd28P8aa8W6q9jryHKIjmzfcvdWJkpcVe3sTfq76Z+XkDE4/M4wQFC HZZ85XxZ3pc98m5UvOxDeaGHO+lF04hqC/dO9W9HsPu2hSv68jrQWxE/1aCucEdKPkdu XZUqstiwL+YlPRsTo/d4lxT3WgUufTecq/sd26a0q2TqTxpN0jgdtc5rWefBffJYKDP2 wNQbezZA7EJ15ft3aO9o+EP0FsPb+wKM9tACOLLeclIllJASgIKHUx4+KFsYutkkbCzn G93TpUoq2eomZLyBqTUOLc7BAe7FIaLeOLtyyc+Iraiy1YOcsIfW7FFAq64CoDXKe2fF 0iPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from: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:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=lMuw8ojelJl0YCR8WnpKmBtaB5yygTiimENEsWnbbyM=; b=rdFEStzteL9CqGxTAin14pl/AF5gxuDpRY0tb9o0M8DHcsXwOmErxdSYG0hc2PJFhi JhDpYhus7oE+RY8CNQLpVy66gSATz5I5+wqhtSVkWlOa8NrBfiSYyAO7NiFFCCD7pXbU nGXW5hEErtiSv0zUOILs7zDUN2YudSJa3MCE45RTXoQmfmLirJI+jFbwwNEAv7c0cMZI z69LcE8GZMmWc1hZy+kL2phcJluNiFFUpleLS11UV3B8hkIzTBuadUSSAju4wX13oG9m w2wlWbqFsmmXR3vtiOukLmkXMckBucLQKN8z2VPpW8CsSHI6ptGCmzKteLipgTU6Bk7u neIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=S5B9c5F0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hu8-20020a170907a08800b0078ae5192906si2925382ejc.193.2022.10.03.03.47.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 03:47:18 -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=@sourceware.org header.s=default header.b=S5B9c5F0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D7E7386191C for ; Mon, 3 Oct 2022 10:46:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D7E7386191C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664793963; bh=lMuw8ojelJl0YCR8WnpKmBtaB5yygTiimENEsWnbbyM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=S5B9c5F0GfSJjGZmiKJwVpwsDS3KKYScPr3NqpbhAUGzPyii/wWjAqP8+PJIecqKR dVtICu05haSrJ+0e9/Rjajc24ELRW06dy32AyO8yGHHWD7A2fqgC7k0fJmMAzGUbhn UkBgr9dzWz0mlDb6p5tSadbvN/IsJ2nPUuvzDGZk= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org 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 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) To: Tsukasa OI , =?utf-8?q?Christoph_M=C3=BCll?= =?utf-8?q?ner?= , Nelson Chu , Kito Cheng , Palmer Dabbelt , Andrew Burgess 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 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 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: , X-Patchwork-Original-From: Tsukasa OI via Binutils From: Tsukasa OI Reply-To: Tsukasa OI Cc: binutils@sourceware.org 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?1745663073002867939?= X-GMAIL-MSGID: =?utf-8?q?1745663073002867939?= 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;