public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@vrull.eu>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: "Andrew Waterman" <andrew@sifive.com>,
	"Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Tsukasa OI" <research_trasio@irq.a4lg.com>,
	binutils@sourceware.org
Subject: Re: [REVIEW ONLY 1/1] UNRATIFIED RISC-V: Add 'Zfa' extension
Date: Mon, 27 Mar 2023 08:13:58 +0800	[thread overview]
Message-ID: <CAAeLtUB7cjXU9jsScjU8_UdDDhoROp56AcRN6u5-cPBL3acrbw@mail.gmail.com> (raw)
In-Reply-To: <4e49a63b-4a0b-6e58-1c94-40d515244f9e@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]

On Sun 26. Mar 2023 at 23:43, Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 3/22/23 09:47, Christoph Müllner wrote:
>
> >
> > Hi Tsukasa,
> >
> > There seems to be a misunderstanding of the spec.
> > The second operand of the fli should be the constant itself ("Value"
> > column of the specification) in C-like syntax.
> > E.g.:
> >    fli.h ft1, -1.0 # encoding rs1=0
> >    fli.h ft1, min # encoding rs1=1
> >    fli.h ft1, 0.0000152587890625 # encoding rs1=2
> >    ...
> >    fli.h ft1, 16 # encoding rs1=25
> >    ...
> >    fli.h ft1, nan # encoding rs1=31
> >
> > So we have 3 strings ("min", "inf", "nan") and 29 constants.
> Ouch.  So we've got to parse & match the actual constant.  I worked on a
> processor with similar capabilities, but we defined the assembly syntax
> to use the table index for the constant rather than the constant itself.


> I'd strongly suggest supporting the %a/%A hex notation for the
> constants.  It's unambiguous and less error prone.  I think Kito made a
> similar suggestion downthread.


That had been my initial reaction as well, when discussing the expected
assembly syntax with Andrew (the specification was not explicit enough to
me, as the table index will also be a decimal constant).  However, after
giving it a little thought, matching the FP-constant dies offer its own set
of advantages:
(a) it makes it clear to assembly writers and (more importantly) readers
what numeric value is intended; if we use the table index only, the typical
use will have a comment with the value next to it
(b) it is a clear improvement over today (where either the
hex-representation will be in the constant pool or a load-imm sequence will
be used).

Accepting both notations (possibly prefixing the index with #) sounds
reasonable. For disassembly, the fp-constant is preferable … sane for
compiler output (unless we want to emit a comment for verbose-asm).

The extra effort to handle the FP constants in the assembler certainly
seems worth the improved readability of the assembly.

When I read through the basics of Zfa I was a bit disappointed.  99% of
> the time the fli is going to feed one or more FP arithmetic
> instructions.


As the ship for fp-immediates in fp-arith has sailed (at least in the 32
bit encoding space), this fli-construction will at least offer
opportunities for fast result forwarding/bypass or for instruction fusion.

It'd be more efficient to be able to access those FP
> constants in the FP arithmetic instruction itself.  I guess that ship
> has sailed.
>
> Jeff
>

      reply	other threads:[~2023-03-27  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 10:12 [REVIEW ONLY 0/1] RISC-V (unratified): " Tsukasa OI
2022-09-18 10:12 ` [REVIEW ONLY 1/1] UNRATIFIED RISC-V: " Tsukasa OI
2023-03-22 15:47   ` Christoph Müllner
2023-03-22 16:01     ` Philipp Tomsich
2023-03-22 16:07     ` Tsukasa OI
2023-03-22 16:21       ` Christoph Müllner
2023-03-22 17:00         ` Tsukasa OI
2023-03-23 13:17           ` Kito Cheng
2023-03-26 15:43     ` Jeff Law
2023-03-27  0:13       ` Philipp Tomsich [this message]

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=CAAeLtUB7cjXU9jsScjU8_UdDDhoROp56AcRN6u5-cPBL3acrbw@mail.gmail.com \
    --to=philipp.tomsich@vrull.eu \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=christoph.muellner@vrull.eu \
    --cc=jeffreyalaw@gmail.com \
    --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).