From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20618.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::618]) by sourceware.org (Postfix) with ESMTPS id C554F3858CDA for ; Thu, 30 Mar 2023 12:18:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C554F3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q4pJvHYdi+1HJ2W0209JHI9GuAd530Hdt/oudkoM0BlgwOl7Y76cosfOKy00fmTiSTWG+6xlx4wr7duPbcHXeFmyTCmc057R5JoCcaSnLMUY8bf+pCE2Rn8wQluu5UQEOJj17mIQYZgHGez0Iy2V77ALA1npUGOB6DiQIBYcNT+O+7iejxZGMGJIh+XIJb4i5RIcj1fvhnvuy0smiynuY1NvGM6fbb+Il4QOZdcpHNOnYxDzQugy12NK98UA5R5kyIY5ueYThreGpkdvAP+7/rF+aM3aIwLw9jTJNrETqXlCNdj+J4w9Pb2Uw+2GawMT0wvUyMbpkKs1PKKErVSqRA== 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=qdfIqJ12rQc53JyEfnJUZ2tcj6rxB/HczCNw7e14lOY=; b=dNucOH3xXaAnCggRdxI0WBaVLTo9IDNlu52xi9HaIs/pavTBykJhv8K6faq3bjVXk3zDuRDFJzmrjvuJgG6AZ38BatcgrAnNHvQYGDzWgUh7n62WNuzhhN68xV0KTbpCfbPW1Wd5/IZuog5oUquvzyIdX6Sz9vMUmvP9Ecva6ISYbKlR0Q4XzQ2aWW5pKRtaQRNcv3PqHFc+ttaPyulaY4YSlCG42dU7UygetAwK1XAK7gMuV3zPRWqlgRkjnefL9eJaegqAPLoyjqrQ8DtsMYcnfmqgi8GhunDYzecOQ0xJ8vsJURWZZWou6/lgOjsvIvhccF+XDIEjUilyN+JB4A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qdfIqJ12rQc53JyEfnJUZ2tcj6rxB/HczCNw7e14lOY=; b=sgiNQ9Lbpybn5jQrS1iGOZ9v9Tk3ZmPCkZcGSAkALKBTFi9zTjuFA+lVmcPvRy0ONZPkbapzP0GukVqQb1qJJTALTV32CRALjc1j+2dcz+ifuv/Et04GoOb2JiOWn7USDWfoMRl68C//IkomhuNGCnB8Ir2+k9bNj+zcfhfI+Y0U5zHZuE842KSN7IqRhy0xHOVSqmc/F84CSgaK53Wy2OSvl75GSViMmIeUSp2JJ8xtpMxtTSFCcpBJfGI6KrwuC35aoudHrQqQjT3wAaYjN5TRjdjUI4t2tokuNb5VjjADBlqs5BeqF+1W50jU9nVTpoYtmPNlKCgOI0WxC9IKSQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by PAXPR04MB8142.eurprd04.prod.outlook.com (2603:10a6:102:1ce::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Thu, 30 Mar 2023 12:18:15 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%6]) with mapi id 15.20.6222.033; Thu, 30 Mar 2023 12:18:15 +0000 Message-ID: <293759bb-e66e-3ff1-c4d8-61f4fbee3d2c@suse.com> Date: Thu, 30 Mar 2023 14:18:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [RFC PATCH v2 2/2] RISC-V: Add support for the Zfa extension Content-Language: en-US To: =?UTF-8?Q?Christoph_M=c3=bcllner?= Cc: Kito Cheng , binutils@sourceware.org, Nelson Chu , Andrew Waterman , Palmer Dabbelt , Jim Wilson , Philipp Tomsich , Jeff Law , Tsukasa OI References: <20230327080107.3266866-1-christoph.muellner@vrull.eu> <20230327080107.3266866-3-christoph.muellner@vrull.eu> <981c0ad5-3e84-d2f3-c14a-4c7bb70749a9@suse.com> <3fce7ece-855e-81dc-34fb-0953bc6e2ca7@suse.com> From: Jan Beulich In-Reply-To: <3fce7ece-855e-81dc-34fb-0953bc6e2ca7@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0057.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::14) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PAXPR04MB8142:EE_ X-MS-Office365-Filtering-Correlation-Id: c5c6f090-afdf-49eb-c110-08db3118d665 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3aWZDG3LslwObKu8LR16cR/MwQw4jJoSIdtjwB3n61jECienMzCUyB9ntbxCm7bAJL1+m48ulWQsOaGly9LGfgxLPRvQ7r70MrjSsNaorK4hKqvSY+2M+ttc0ThWGXrouXx/zQcjMed+icncsIz5YhwEL51ctlVVUe2BO5zRYWy02l2yUgw8kUrsLlxkm+ENB6oNC+L1guRTvtnURZ2RFCESWOKouuNJPV0D+dNlQ2YdDbrcKSX2N/iRUFi8/EPCqNLuhZKNOG/ZWpCuaf2sRivros9SuAMEbhfl2cKyCcb7BahDd8ArllarwLNIPLvR1p3bu8W90wZKBXVsSdxuVjBg3vZTEwwMpUbrm28nvdK/CFs5LFQuap73U2dYgmDpVGNCMQ/u5GMxGsTojp3Zj0kStGw+bq7frQn9I+aurxFNGO43DQ3l2s8HizeYkDLyw3uwrsgmMcO++IHBtwBqbbAS6T4aKKWIgLEaRtPyJmn9CEahpfG1nSFcEm8EaUJJQ/zJJkrBftBqOW0fBa+qt3ojkugCZMTyC9lgC6EmMLyauNcWt/9RwUkMBWO+g7e2zBghZA24PvewrYseSZdwVYp/sR7z48IvCuAFmZxADnoIE1NpGJUPZFtw/bfHe2MY 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:(13230028)(39860400002)(396003)(136003)(376002)(366004)(346002)(451199021)(2906002)(8936002)(41300700001)(7416002)(38100700002)(86362001)(36756003)(31696002)(5660300002)(186003)(31686004)(478600001)(54906003)(6666004)(26005)(53546011)(6506007)(2616005)(6512007)(966005)(83380400001)(66946007)(66556008)(6486002)(8676002)(4326008)(66476007)(6916009)(316002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WGNPQ2JwbHFtVzNzZUZrdTF2a1dlb3ZXSmtpMDdlUGJtckJxMFA5N0c4TUg1?= =?utf-8?B?UU1YWnp6TkhCVjR2b0tEWUl4QnZLeWtiK2p2K2QyQVJNbkcxT1VORkJrYzha?= =?utf-8?B?Y1hTL0ROK1hhNmRHUEdXYWcySWlYc3ZxK2JOVlNnRXh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05DajVLNkpKOHAvSlN3cnh2M05SYnQwdlhTSEh3QjNtVUdpazVv?= =?utf-8?B?Sks2S2lwMW9jNHFnWVlVNUhuSzFPcURJRzRteVZRK3lFZVprWDBGRk9MQ29R?= =?utf-8?B?K3ZwSk1lZHhpWnNIUGVlRHBZNm1KZ1FPV0tyZDJyTVpEcUFyWGFIOUt1WHdO?= =?utf-8?Q?wIRsudN4MHlTiu66xIDriZSgT?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5c6f090-afdf-49eb-c110-08db3118d665 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 12:18:15.0430 (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: xUaop641WCp2CtuKGcv2Emc5Rj9pkC9QOfYqzi4KdJxFPdajhu3yBSOOSrGw7f2MGrcHRWPvS/LlRQx8c4wHSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8142 X-Spam-Status: No, score=-3028.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,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: On 30.03.2023 12:54, Jan Beulich via Binutils wrote: > On 30.03.2023 12:30, Christoph Müllner wrote: >> On Mon, Mar 27, 2023 at 11:54 AM Jan Beulich wrote: >>> >>> On 27.03.2023 10:53, Kito Cheng wrote: >>>> Wait, I mean the hex floating point format defined in C99/C++17, not >>>> the raw hex value. >>>> so something like 0x1p-16 (0.0000152587890625), 0x1p-2 (0.25) 0x1p+0, >>>> -0x1p+0 could be used for fli.* instruction. >>>> >>>> You could use printf with %a to get those values. >>>> >>>> https://gcc.gnu.org/onlinedocs/gcc/Hex-Floats.html >>>> https://developer.arm.com/documentation/dui0375/latest/Compiler-Coding-Practices/Hexadecimal-floating-point-numbers-in-C99 >>> >>> Sure, my (secondary) suggestion ... >>> >>>> On Mon, Mar 27, 2023 at 4:39 PM Jan Beulich via Binutils >>>> wrote: >>>>> >>>>> On 27.03.2023 10:01, Christoph Muellner wrote: >>>>>> --- a/opcodes/riscv-opc.c >>>>>> +++ b/opcodes/riscv-opc.c >>>>>> @@ -110,6 +110,16 @@ const char * const riscv_vma[2] = >>>>>> "mu", "ma" >>>>>> }; >>>>>> >>>>>> +/* The FLI.[HSDQ] value constants. */ >>>>>> +const char * const riscv_fli_value[32] = >>>>>> +{ >>>>>> + "-1.0", "min", "0.0000152587890625", "0.000030517578125", >>>>>> + "0.00390625", "0.0078125", "0.0625", "0.125", >>>>>> + "0.25", "0.3125", "0.375", "0.4375", "0.5", "0.625", "0.75", "0.875", >>>>>> + "1.0", "1.25", "1.5", "1.75", "2.0", "2.5", "3.0", "4.0", >>>>>> + "8.0", "16.0", "128.0", "256.0", "32768.0", "65536.0", "inf", "nan", >>>>>> +}; >>>>> >>>>> Especially for values like 1.0x2^^-n (entries 2 and onwards) I question >>>>> the spelled out numbers to be the most suitable ones usability wise. At >>>>> least some alternative spelling (e.g. 2.e-16) ought to be recognized as >>>>> well. But since there are meany reasonable spellings (leading 0 omitted >>>>> in 0. or trailing zero omitted in .0), I guess I'd prefer >>>>> if values were actually parsed as a floating point number (e.g. via >>>>> ieee_md_atof()), and then matched against values stored in the table. >>>>> One might further consider to also permit the 2nd form accepted >>>>> elsewhere, see read.c:parse_one_float(). >>> >>> ... here wasn't meant to collide with yours. What you're asking for is >>> covered by my primary suggestion (to actually parse the values), extended >>> by the need to actually recognize C99 hex float in the parser then (leaving >>> aside for now whether that's feasible in the first place). >> >> Thanks for all the suggestions! >> >> I worked my way through this and I believe that the following would be >> a reasonable solution: >> * constants min, inf and nan must be symbols (as stated in the specification) >> * other constants are parsed by scanf("%f") as floats and compared >> (float compare in C) against the numeric constants in the table >> * output in the disassembly uses symbols for min/inf/nan and %a (hex >> FP literals) for other constants >> >> So we support every format that '%f' accepts including hex FP literals >> (e.g. -0x1p0, 0x1p+0, ...) and normal FP constants (e.g. >> 0.0000152587890625, 25E-4). > > How's this going to work with a cross-assembler run on an architecture > supporting a floating point format other than IEEE 754's? Hence why I > suggested using ieee_md_atof() instead. Hmm, I see riscv_fli_numval[] has "float" as the base type (which I didn't really expect), so this ought to work as long as the initializers used can be represented exactly in whatever arch's floating point format. Jan