From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80074.outbound.protection.outlook.com [40.107.8.74]) by sourceware.org (Postfix) with ESMTPS id D8FCC3853541 for ; Tue, 14 Jun 2022 14:54:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D8FCC3853541 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f5JUgefvE+A6NeukGUATO/UfRzay0sERZacyrQCTB2bNc4fj15Dz7tA2xHNgOyoW4raHiDZ2ddGxgS5+rL3NZxygjnbj3LC+ahh3UAnZpCRRuF3bHFnpmK05uay/ckCSWXwwOcj1Ys4VJ+sKYiA976ly0cJhad2iMOg1n1DBgZsis0zaeJ+fzc8AHfu4PxGneu49NsilwpzPj72kGm9YJ18RlCIwfjOhGZWh0fo3xVhtg9s7NU7671m3R7pcrMUDDv54lUmw7rTRTSalLTndHvPgDAYMAoY/7JPb2FllhtvfkyFSK5OnTh+eUPdun76wmz2j5eix1vEX8DSv+sJd+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5H1M8eq9GrYS9hcNScIlZAdcmQDFLRpX72bNDnVoMSA=; b=clfKw7JK1at8w8t97ZRW6ZZPsWdBbvzdMKCZ14BgJjQyeQVWngNlOYSzLYgm15dAGHqdSEvqTIqWplr6iB/CN074l8hLdnOAty4s1/GBFJrkKV/lcX7dUSaBapHCiBIwYxPWvNJZMdRmmksHTrCHLTMkU6VjyxozR3r+O4ItCICpGRYb2k597yYeGda/WMydXvK8er+pqTMSZuYy3LQvVLJEFDjz6rlS2Imk5Imup3+XGWT2Ko0mq+NTGpDFizkslfobwqhksyEOgJKJtN0zumtsjMGiBdA/hwAd5DIjqRtxvCdLmaPP22qrY4p8ef2QheUFpH3BAm4hVccf4TvYjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by HE1PR0401MB2235.eurprd04.prod.outlook.com (2603:10a6:3:27::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.21; Tue, 14 Jun 2022 14:54:43 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b%7]) with mapi id 15.20.5332.020; Tue, 14 Jun 2022 14:54:42 +0000 Message-ID: <8c888654-3a6d-88d8-a174-32162a1e1299@suse.com> Date: Tue, 14 Jun 2022 16:54:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] x86: drop print_operand_value()'s "hex" parameter Content-Language: en-US To: "H.J. Lu" Cc: Binutils References: From: Jan Beulich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS8PR07CA0058.eurprd07.prod.outlook.com (2603:10a6:20b:459::15) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 741ce97f-dd67-4eb9-e85a-08da4e15d087 X-MS-TrafficTypeDiagnostic: HE1PR0401MB2235:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dLND7tF7kNheUOHBqQ95jMmxrkObm7hGODU7unvd0GFRlNdZsSmjStVicpDDv9DNsOB85f7OKCzj0bKUZcVORvdrQ0x0kfK2aH0KwRUIatJU6agvhVK8X6rde1HPufhmcQZkcDyM7dxkJw52+NbuHUFQVn9wW1fMT/3fnU9jt/rFzi2lTiJF+qqRlYCy3/Enwwk1n4IRrxIRNOWvBnD+E6rNp+v06c3qGV+8Vlpy2B3EqQnmWyyd94ZIimazcS7U88/7VkNoqMEfWmOSGy1FuCs1gqJuoWwViugTXxHFDPh9Zq/rCAO166idrhbbst2KiZMe1asGJo33H6/9UBRTne7GugHbpvuOpT+pzxvAuHyCHxe/T5ixhZS+1UN2SdZVK95Dilvb6hbllcQsPayXVaSoi2sFu6USe2fabaJCRXwFHT5ehALSBvgRDNRDNDcoHGZEh/yQcnvGAPUKYqe7R1njcvSZWGNNl+JsNp20VWVqNh6FaJ7/gmFvarZWuXAIToiGRJcaR/rW1w74OA1wcOWbelj2PwuM8XG5ZvBp8DTzGDBEhfpry2nJWp3daNTMCmb2Xlk1EQMcWm/s5romL4hf3Y1hptq4IT8xV5f5I0wxuBRW0eS0Hq1Ky5Im6esHah7QmJ+TO28ixksGANol5cBlHLZSMnNzSICiYXVzwVDhS1AC95bDhQtbUtwla5FoZTjKoiHC+X4f6xSCG1orZIVj0DZtYAltpGTerAKKQ1c= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(66946007)(8936002)(66556008)(4326008)(66476007)(6916009)(83380400001)(8676002)(316002)(38100700002)(5660300002)(2906002)(36756003)(31686004)(6486002)(508600001)(86362001)(6512007)(31696002)(6506007)(53546011)(26005)(2616005)(186003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-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1kUnJONEFUbVNRRThHaWo3Y0xibjYzR2tlNGlYL1B6RWRX?= =?utf-8?B?OUFXVDVta04yOVdNTCt2NlpSanRRSUJrQUpIakNvYUZDSFhDbWxZWXFac3Fw?= =?utf-8?B?UDJGY2JVdEZIK2gxNW44Q29NTFJkMWVwczZaZkJDUW1hYUVaenRKN0lmT2VQ?= =?utf-8?B?VlA1bEZ2aXh6UDJKdSsyaTU0d2pJVlJSbnJ6aCtQOWZSOHl3OUphUWN4MlNN?= =?utf-8?B?VTFQUnZJWnRSMnJkUE5jWjNRZGQwTnZZellnckcvQ1dKZzZXaW9McC9uL1RP?= =?utf-8?B?ZkUxSkZld0tqZnMxeFgxb05DTG9XNDFoWHgzKzE0OGM4a0hDNkJrMEpNajJZ?= =?utf-8?B?eW1Ma09nVGtLSDZZWUh1dkhVOGlBSE9XYTdnQTRNMGNWbmpaWGd2WjJ4elBq?= =?utf-8?B?UzVuQlhyejZxUXNRMExVd0lwcmVQOW4xRERLbzAySk5jMGNUelF4c3hmN1dO?= =?utf-8?B?ekIyb1I0V0J1THJWcTJLcHI0SGpMME5SYVhoWi8rQmtTcmFDdUZXdWd4bDIw?= =?utf-8?B?SkU3RDV3ejJVM0pjVFFETzU1Y2d1ZzZ3eGdvTkkvRWVZRGhnMTM4QT09?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 741ce97f-dd67-4eb9-e85a-08da4e15d087 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2022 14:54:42.7912 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eB161QhsoQMvMFuQ4w67+fFj0NOFbpNCxWxWtWP6+AgBJnSZ8PaDWv24iaGxnrzlbsBC4S7QajulZalzsZTeUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2235 X-Spam-Status: No, score=-3031.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: , X-List-Received-Date: Tue, 14 Jun 2022 14:54:48 -0000 On 14.06.2022 15:59, H.J. Lu wrote: > On Tue, Jun 14, 2022 at 3:07 AM Jan Beulich wrote: >> >> For quite some time all callers have been passing 1 / true. While there >> fold the final oappend_with_style() calls. >> --- >> Instead of 0x%x I could see us using %#x, thus printing at least zero >> without the redundant 0x prefix. Thoughts? (I expect there'll be quite a > > 0x is clearer than 0 which is also used for octal. How is 0x0 clearer than 0? There's also no ambiguity at all with octal: 0 represents zero for all of hex, dec, and octal. Also - any word on the patch itself? The aspect here was brought up just to figure whether there wants to be yet another change on top. Jan >> bit of testsuite fallout from such a change, but I don't think that's a >> major concern.) >> >> --- a/opcodes/i386-dis.c >> +++ b/opcodes/i386-dis.c >> @@ -10969,61 +10969,22 @@ OP_indirE (instr_info *ins, int bytemode >> } >> >> static void >> -print_operand_value (instr_info *ins, bool hex, bfd_vma disp, >> +print_operand_value (instr_info *ins, bfd_vma disp, >> enum disassembler_style style) >> { >> char tmp[30]; >> + unsigned int i = 0; >> >> if (ins->address_mode == mode_64bit) >> { >> - if (hex) >> - { >> - int i; >> - oappend_with_style (ins, "0x", style); >> - sprintf_vma (tmp, disp); >> - for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++); >> - oappend_with_style (ins, tmp + i, style); >> - } >> - else >> - { >> - bfd_signed_vma v = disp; >> - int i; >> - if (v < 0) >> - { >> - oappend_char_with_style (ins, '-', style); >> - v = -disp; >> - /* Check for possible overflow on 0x8000000000000000. */ >> - if (v < 0) >> - { >> - oappend_with_style (ins, "9223372036854775808", style); >> - return; >> - } >> - } >> - if (!v) >> - { >> - oappend_char_with_style (ins, '0', style); >> - return; >> - } >> - >> - i = 0; >> - tmp[29] = 0; >> - while (v) >> - { >> - tmp[28 - i] = (v % 10) + '0'; >> - v /= 10; >> - i++; >> - } >> - oappend_with_style (ins, tmp + 29 - i, style); >> - } >> + oappend_with_style (ins, "0x", style); >> + sprintf_vma (tmp, disp); >> + while (tmp[i] == '0' && tmp[i + 1]) >> + ++i; >> } >> else >> - { >> - if (hex) >> - sprintf (tmp, "0x%x", (unsigned int) disp); >> - else >> - sprintf (tmp, "%d", (int) disp); >> - oappend_with_style (ins, tmp, style); >> - } >> + sprintf (tmp, "0x%x", (unsigned int) disp); >> + oappend_with_style (ins, tmp + i, style); >> } >> >> /* Like oappend, but called for immediate operands. */ >> @@ -11033,7 +10994,7 @@ oappend_immediate (instr_info *ins, bfd_ >> { >> if (!ins->intel_syntax) >> oappend_char_with_style (ins, '$', dis_style_immediate); >> - print_operand_value (ins, true, imm, dis_style_immediate); >> + print_operand_value (ins, imm, dis_style_immediate); >> } >> >> /* Put DISP in BUF as signed hex number. */ >> @@ -11721,7 +11682,7 @@ OP_E_memory (instr_info *ins, int bytemo >> if (havedisp || riprel) >> print_displacement (ins, disp); >> else >> - print_operand_value (ins, true, disp, dis_style_address_offset); >> + print_operand_value (ins, disp, dis_style_address_offset); >> if (riprel) >> { >> set_op (ins, disp, true); >> @@ -11798,7 +11759,7 @@ OP_E_memory (instr_info *ins, int bytemo >> if (havedisp) >> print_displacement (ins, disp); >> else >> - print_operand_value (ins, true, disp, dis_style_address_offset); >> + print_operand_value (ins, disp, dis_style_address_offset); >> } >> >> oappend_char (ins, ins->close_char); >> @@ -11825,7 +11786,7 @@ OP_E_memory (instr_info *ins, int bytemo >> oappend_register (ins, att_names_seg[ds_reg - es_reg]); >> oappend (ins, ":"); >> } >> - print_operand_value (ins, true, disp, dis_style_text); >> + print_operand_value (ins, disp, dis_style_text); >> } >> } >> } >> @@ -11900,7 +11861,7 @@ OP_E_memory (instr_info *ins, int bytemo >> oappend_register (ins, att_names_seg[ds_reg - es_reg]); >> oappend (ins, ":"); >> } >> - print_operand_value (ins, true, disp & 0xffff, dis_style_text); >> + print_operand_value (ins, disp & 0xffff, dis_style_text); >> } >> } >> if (ins->vex.b) >> @@ -12370,7 +12331,7 @@ OP_J (instr_info *ins, int bytemode, int >> disp = ((ins->start_pc + (ins->codep - ins->start_codep) + disp) & mask) >> | segment; >> set_op (ins, disp, false); >> - print_operand_value (ins, true, disp, dis_style_text); >> + print_operand_value (ins, disp, dis_style_text); >> } >> >> static void >> @@ -12430,7 +12391,7 @@ OP_OFF (instr_info *ins, int bytemode, i >> oappend (ins, ":"); >> } >> } >> - print_operand_value (ins, true, off, dis_style_address_offset); >> + print_operand_value (ins, off, dis_style_address_offset); >> } >> >> static void >> @@ -12459,7 +12420,7 @@ OP_OFF64 (instr_info *ins, int bytemode, >> oappend (ins, ":"); >> } >> } >> - print_operand_value (ins, true, off, dis_style_address_offset); >> + print_operand_value (ins, off, dis_style_address_offset); >> } >> >> static void > > >