From: Richard Sandiford <richard.sandiford@arm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Tejas Joshi <tejasjoshi9673@gmail.com>,
gcc@gcc.gnu.org, Martin Jambor <mjambor@suse.cz>,
hubicka@ucw.cz, joseph@codesourcery.com
Subject: Re: Expansion of narrowing math built-ins into power instructions
Date: Tue, 20 Aug 2019 14:43:00 -0000 [thread overview]
Message-ID: <mpt8srn523k.fsf@arm.com> (raw)
In-Reply-To: <20190820134613.GR31406@gate.crashing.org> (Segher Boessenkool's message of "Tue, 20 Aug 2019 08:46:13 -0500")
Segher Boessenkool <segher@kernel.crashing.org> writes:
> On Tue, Aug 20, 2019 at 01:59:06PM +0100, Richard Sandiford wrote:
>> Segher Boessenkool <segher@kernel.crashing.org> writes:
>> >> [(set (match_operand:SI 0 "register_operand" "=d")
>> >> (truncate:SI
>> >> (lshiftrt:DI
>> >
>> > (this is optimised to a subreg, in many cases, for example).
>>
>> Right. MIPS avoids that one thanks to TARGET_TRULY_NOOP_TRUNCATION.
>
> Trying 10 -> 18:
> 10: r200:TI=zero_extend(r204:DI)*zero_extend(r205:DI)
> REG_DEAD r205:DI
> REG_DEAD r204:DI
> 18: $2:DI=r200:TI#0
> REG_DEAD r200:TI
> Failed to match this instruction:
> (set (reg/i:DI 2 $2)
> (subreg:DI (mult:TI (zero_extend:TI (reg:DI 204))
> (zero_extend:TI (reg:DI 205))) 0))
>
> I'm afraid not.
That's TI->DI though, whereas the pattern above is DI->SI. The modes
matter :-) There'd also need to be a shift to match a highpart pattern.
>> >> float_narrow is different in that the plus (or whatever operation
>> >> it's quoting) has to be kept in-place rather than folded away,
>> >> otherwise the rtx itself is malformed and could trigger an ICE,
>> >> just like the zero_extend of a const_int that I mentioned.
>> >
>> > Yes, it will not pass recog. Structurally it is just hunky-dory though.
>>
>> So maybe that's the main point of difference. We're introducing
>> float_narrow to modify another rtx operation rather than to operate
>> on an rtx value.
>
> I wouldn't say it "operates" on anything. A float_narrow rtx means the
> thing inside it does single-rounding to SP float. And it is just
> notation: RTL itself knows *nothing* about float rounding, and because
> of the way this is structured, nothing can change anything about the
> float_narrow.
I wouldn't say it knows nothing about rounding. It doesn't know
what the runtime rounding mode is, but that isn't the same thing.
(Just like not knowing what (mem:SI (sp)) contains isn't the same
thing as not knowing anything about stack memory.)
Besides, how much depends on target-independent code not knowing what
the rounding mode is? Do you think float_narrow would still make
sense even if more information was available at compile time
(e.g. if a plus could be annotated with a specific rounding mode)?
Or is not knowing the rounding mode a fundamental part of float_narrow
being OK for you?
> And yes, it is icky. But it is sound, as far as I can see.
I really disagree that it's sound, but no point me saying why again :-)
(It could certainly be made to work with sufficient hacks of course,
like pretty much anything could, but I don't think that's the same thing.)
Thanks,
Richard
next prev parent reply other threads:[~2019-08-20 14:43 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 17:37 Martin Jambor
2019-07-29 18:40 ` Segher Boessenkool
2019-07-30 19:47 ` Joseph Myers
2019-07-30 9:20 ` Florian Weimer
2019-07-30 19:49 ` Joseph Myers
2019-07-31 6:47 ` Tejas Joshi
2019-07-31 14:47 ` Segher Boessenkool
2019-08-08 18:39 ` Tejas Joshi
2019-08-08 20:05 ` Segher Boessenkool
2019-08-08 23:09 ` Joseph Myers
2019-08-10 10:24 ` Tejas Joshi
2019-08-10 16:46 ` Segher Boessenkool
2019-08-11 4:58 ` Tejas Joshi
2019-08-11 7:20 ` Segher Boessenkool
2019-08-11 12:46 ` Tejas Joshi
2019-08-11 16:59 ` Segher Boessenkool
2019-08-12 17:25 ` Tejas Joshi
2019-08-12 17:55 ` Segher Boessenkool
2019-08-12 21:20 ` Joseph Myers
2019-08-12 21:52 ` Segher Boessenkool
2019-08-14 6:15 ` Tejas Joshi
2019-08-14 7:21 ` Segher Boessenkool
2019-08-14 16:11 ` Joseph Myers
2019-08-14 20:21 ` Segher Boessenkool
2019-08-14 20:23 ` Joseph Myers
2019-08-14 21:00 ` Segher Boessenkool
2019-08-15 9:52 ` Tejas Joshi
2019-08-15 12:47 ` Richard Sandiford
2019-08-15 13:55 ` Tejas Joshi
2019-08-15 18:45 ` Segher Boessenkool
2019-08-16 10:23 ` Richard Sandiford
2019-08-17 5:40 ` Tejas Joshi
2019-08-17 8:21 ` Richard Sandiford
2019-08-19 10:46 ` Tejas Joshi
2019-08-19 13:07 ` Segher Boessenkool
2019-08-20 7:41 ` Richard Sandiford
2019-08-20 12:11 ` Segher Boessenkool
2019-08-20 12:59 ` Richard Sandiford
2019-08-20 13:46 ` Segher Boessenkool
2019-08-20 14:43 ` Richard Sandiford [this message]
2019-08-20 15:12 ` Richard Sandiford
2019-08-20 19:42 ` Segher Boessenkool
2019-08-21 17:20 ` Tejas Joshi
2019-08-21 18:28 ` Segher Boessenkool
2019-08-21 19:17 ` Segher Boessenkool
2019-08-22 3:33 ` Tejas Joshi
2019-08-22 6:25 ` Segher Boessenkool
2019-08-22 7:57 ` Tejas Joshi
2019-08-22 9:56 ` Segher Boessenkool
2019-08-23 17:17 ` Martin Jambor
2019-08-23 19:13 ` Segher Boessenkool
2019-08-24 9:53 ` Richard Sandiford
2019-08-25 13:55 ` Tejas Joshi
2019-08-25 16:47 ` Segher Boessenkool
2019-08-26 7:07 ` Tejas Joshi
2019-08-26 7:42 ` Segher Boessenkool
2019-08-30 19:12 ` Tejas Joshi
2019-08-30 20:35 ` Segher Boessenkool
2019-09-02 3:19 ` Tejas Joshi
2019-09-02 11:30 ` Segher Boessenkool
2019-08-26 13:23 ` Martin Jambor
2019-08-20 16:04 ` Joseph Myers
2019-08-15 18:54 ` Segher Boessenkool
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=mpt8srn523k.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=joseph@codesourcery.com \
--cc=mjambor@suse.cz \
--cc=segher@kernel.crashing.org \
--cc=tejasjoshi9673@gmail.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).