public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Kito Cheng <kito.cheng@gmail.com>
Cc: Christoph Muellner <christoph.muellner@vrull.eu>,
	binutils@sourceware.org, Nelson Chu <nelson@rivosinc.com>,
	Andrew Waterman <andrew@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Jeff Law <jeffreyalaw@gmail.com>,
	Tsukasa OI <research_trasio@irq.a4lg.com>
Subject: Re: [RFC PATCH v2 2/2] RISC-V: Add support for the Zfa extension
Date: Mon, 27 Mar 2023 11:54:29 +0200	[thread overview]
Message-ID: <d6ef8482-d51e-c3cc-a919-98af0e7474e3@suse.com> (raw)
In-Reply-To: <CA+yXCZBQiW9JsV5rzc8U-ksWno8pvaARmCQe+0j-t_h6nFJ55Q@mail.gmail.com>

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
> <binutils@sourceware.org> 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.<fraction> or trailing zero omitted in <num>.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).

Jan

  parent reply	other threads:[~2023-03-27  9:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  8:01 [RFC PATCH v2 0/2] " Christoph Muellner
2023-03-27  8:01 ` [RFC PATCH v2 1/2] RISC-V: Allocate "various" operand type Christoph Muellner
2023-03-27  8:01 ` [RFC PATCH v2 2/2] RISC-V: Add support for the Zfa extension Christoph Muellner
2023-03-27  8:09   ` Kito Cheng
2023-03-27  8:26     ` Christoph Müllner
2023-03-27  8:38   ` Jan Beulich
2023-03-27  8:53     ` Kito Cheng
2023-03-27  9:08       ` Christoph Müllner
2023-03-27  9:54       ` Jan Beulich [this message]
2023-03-30 10:30         ` Christoph Müllner
2023-03-30 10:54           ` Jan Beulich
2023-03-30 12:18             ` Jan Beulich
2023-03-30 15:36               ` Christoph Müllner
2023-03-30 16:13                 ` Jan Beulich
2023-03-30 16:59                   ` Christoph Müllner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6ef8482-d51e-c3cc-a919-98af0e7474e3@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=christoph.muellner@vrull.eu \
    --cc=jeffreyalaw@gmail.com \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=nelson@rivosinc.com \
    --cc=palmer@dabbelt.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=research_trasio@irq.a4lg.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).