public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>,
	 Joel Hutton	<Joel.Hutton@arm.com>,  nd <nd@arm.com>,
	 GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [AArch64] Use scvtf fbits option where appropriate
Date: Tue, 18 Jun 2019 12:30:00 -0000	[thread overview]
Message-ID: <mptfto7uldf.fsf@arm.com> (raw)
In-Reply-To: <VI1PR0801MB21273E08FDEA3668B905C0D083EA0@VI1PR0801MB2127.eurprd08.prod.outlook.com>	(Wilco Dijkstra's message of "Tue, 18 Jun 2019 11:12:10 +0000")

Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
>  > +/* If X is a positive CONST_DOUBLE with a value that is the reciprocal of a
>  > +   power of 2 (i.e 1/2^n) return the number of float bits. e.g. for x==(1/2^n)
>  > +   return n. Otherwise return -1.  */
>  > +int
>  > +aarch64_fpconst_pow2_recip (rtx x)
>  > +{
>  > +  REAL_VALUE_TYPE r0;
>  > +
>  > +  if (!CONST_DOUBLE_P (x))
>  > +    return -1;
>  
>> CONST_DOUBLE can be used for things other than floating point.  You
>> should really check that the mode on the double in is in class MODE_FLOAT.
>  
> Several other functions (eg aarch64_fpconst_pow_of_2) do the same since
> this function is only called with HF/SF/DF mode. We could add an assert for
> SCALAR_FLOAT_MODE_P (but then aarch64_fpconst_pow_of_2 should do
> the same).

IMO we should leave it as-is.  aarch64.h has:

#define TARGET_SUPPORTS_WIDE_INT 1

which makes it invalid to use CONST_DOUBLE for anything other than
floating-point constants.  The handling of CONST_DOUBLEs with integer
modes is effectively compiled out in key places so it would be very hard
to create one accidentally.  And even if somehow we did, it would fail
noisily in other ways.

So I think it would be redundant to assert that CONST_DOUBLE has a float
mode here, much like we (rightly) don't assert that CONST_VECTORs have
vector modes.

Thanks,
Richard

  reply	other threads:[~2019-06-18 12:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 17:26 Wilco Dijkstra
2019-06-18  9:11 ` Joel Hutton
2019-06-18 10:37   ` Richard Earnshaw (lists)
2019-06-18 11:12     ` Wilco Dijkstra
2019-06-18 12:30       ` Richard Sandiford [this message]
2019-06-18 15:34         ` Joel Hutton
2019-06-26  9:35           ` [PING][AArch64] " Joel Hutton
2019-07-01 12:14             ` Wilco Dijkstra
2019-07-01 17:03             ` James Greenhalgh
2019-07-08 16:05               ` Joel Hutton
2019-08-19 17:47                 ` James Greenhalgh
  -- strict thread matches above, loose matches on Subject: below --
2019-06-13 16:04 [AArch64] " Joel Hutton

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=mptfto7uldf.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Joel.Hutton@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.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).