From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0617.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::617]) by sourceware.org (Postfix) with ESMTPS id 85E9F38582BE for ; Thu, 30 Mar 2023 10:54:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85E9F38582BE 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=k4cSKzaaAvaeLeAhytig+fsOYTwN1pTOaWIMFnnGnIrzdMRvldxsuqzAS/eRFZRLqBJE/nx8/grLxFTEEy51akemi4Ip0zEJmlBZQ5r/TB8MgKJZ51tI1g1Y7DqIrJN2DoPFpSuAoiVZHT6+POybBtsVC+Wn4O9yJxGXbRN/RN37/5RErfeiwvCz4YvfrxOI1ywocXmNk3OPwV2qV6CCHpTViWUIec9xl9X7Unq6IMAsgAGxEELmspjmV/AdSoKG9mzj+20G97hawgH0n2bQ9JBwjgbh4736yLSttVaPmd5rEwKJ1CH6cxBS8ZSiqdG/FldEXVfDAg35bA/Fmyg5xA== 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=dnfPWRCu9RIyZ7tc6vMlrIvYJNqZ3B19j2ghpA+7lcg=; b=A0zKaRBrXownTGRAmYS6azg/2Cmjbkh3N4jfv1tBDtT8jz0lu9wUQCjDp2+fNxpHe92A9IajsWs9H0ut3hOuGECMv3FJi8Yet8KT1mDaBK2/jPgSZnts23/duIEQPpikG2lYeho7nsdKLS0xnDBdUUURXwkBX7ZnuZzOAYH60dO7wX/KZU/LDOTomCgMRPACjkTTUd81PXpeGIsdlnOXj7ZlfQmIy2tCb6uMaMzp88GPw97bcuMuekRxDUMHH5GC7KQO0XfYLhUXA475E/UD9dykac/uJNsbP+DoRVLOKAFDW8qBibQhMXG0KFpUS65TMHSxxRMkeH6S7sIizrWWcQ== 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=dnfPWRCu9RIyZ7tc6vMlrIvYJNqZ3B19j2ghpA+7lcg=; b=TSwaT77e77CpViKMMn+WfbzMYHnz8JqIdM8+fDlkCAmssOC5XgHLnoqZNNd/Le+KTEAGM90SgN7yasQDdN+4ZyEnI9F06/Z/SfwZ8GbxN1nNcVOFV3oSjdzp+/99eDgxkqfZS9je+1ayZx/2K1wFzqYZ6P23MF/HvZWjpmWhgoH4SLRQBzw3W35UG/RahACPkBBLT19i+So5gnNNujuohLCIcFVemUnGh04+aK9jE+nPIFEJMeqdZC2ggHjPm5DBQeb94+oqbUoT3new77Qm1KwwlOC0huRcYKsp2rdDlSmOFJE/Ar6Rwh1HL+ueulY6jl5YxZs5TSztqjPziaoWCA== 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 PAXPR04MB8191.eurprd04.prod.outlook.com (2603:10a6:102:1c4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Thu, 30 Mar 2023 10:54:30 +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 10:54:30 +0000 Message-ID: <3fce7ece-855e-81dc-34fb-0953bc6e2ca7@suse.com> Date: Thu, 30 Mar 2023 12:54:28 +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> From: Jan Beulich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR3P281CA0037.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4a::21) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PAXPR04MB8191:EE_ X-MS-Office365-Filtering-Correlation-Id: a5b60273-b682-462f-24d4-08db310d2380 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OfhMGN16np6S4e1l6k9mhQGFulXigk9/yGjFynpippuLowd1LRySUt4QYohAMlUhPgb02R7GsjZ2JpfQHNz7HyYu39RJRhp1i007Cm2QDJaPygoipYsd1WmDDjO1wqC0L+jFB6be/+LGZOR+BmUaHgDRyB8g4+A83QyhsbCLYJHKa86oh48Th6rHmfRYADWU3wZsZFj4hBTXooVQ+9HujP8ATdwQyKbbpAtjKSX2S/7rPueZOJ2481HmsGeT6xBE0sGQ06QyAbiSqSjYUf2jGmoHN/8tUG+nRa8rhez+HH327cgfiTHQd5xXnBYyckBW/fOmj85ExhUrzLdYBtBW9Qqo7Il/g5sTlO2JpqYqIa5T0IFUvgK+aof+bi6N+WrqtynOpt+pR4FNerQR7cbY11FSr3XGg4JAhoNTLaXv9MlQmT+acrIOHNW3dGPUZHfXgXOjcP4QlGqhNvB8wIuHFaj4qCP8KtVZc9SiP5fj35OgAfvqpWJjwaC2WsSsZmzgZXevo88yeAwEO8RZZvDWsDuCT86r3Y9Q7SvA5U0cp4Z9mhQ28EDJxkpqGKCjvjgq0WMNPZEREFX+ey5GL266vIRKqA3eoeFS9accURUfqw93OiB8SrtPTa+zV7WLIV7a 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)(136003)(346002)(376002)(396003)(39860400002)(366004)(451199021)(36756003)(31696002)(86362001)(2906002)(31686004)(2616005)(966005)(6486002)(478600001)(186003)(53546011)(6512007)(83380400001)(6916009)(4326008)(6506007)(26005)(66556008)(66476007)(66946007)(8676002)(54906003)(7416002)(41300700001)(8936002)(316002)(38100700002)(5660300002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eGc2ckFQT3NKV1FpcEtJY1ZvcGdEODQ3Y1ljTUh2WEw0ODBmak5SS0s5bEZy?= =?utf-8?B?Um5SZkhCak1TRStqa2V2SU5xbWVmckVPMUEraVQyR2RFa1BXV0t5K1pITHF1?= =?utf-8?B?TkhBdC9jdHF4RFlMTGNla0JEOVFOcjBKQ1ZDeUJhLzVtR1lYRUZxOUNhc2hH?= =?utf-8?B?WDdJaiswMFlSdS9IMkZka01oQzFqaVlFZ3ZPbFRsWXR1RGRvSjJ2el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1ZIZDJvaWVPUW1rU04xd3B6NVJFTENCd0NodDJk?= =?utf-8?B?amdtbmk5QldKQzMzS25pRCs5ejZhL0VNRS9WcE02WEI0TWpIYUpNa2ZHeElU?= =?utf-8?Q?ZOPn0oh1JDlZO1e1Co+SECPmT?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5b60273-b682-462f-24d4-08db310d2380 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 10:54:30.4550 (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: jAcmiY7tg28vhp3bo+cEpRTUwAPkElyn+4OMsaL3batm1FFiOnL/wrLeAdKyXbZxwa6PhiRJbncgdGmMAefBWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8191 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,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: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. Jan