From: Richard Biener <richard.guenther@gmail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org>,
liuhongt <hongtao.liu@intel.com>,
crazylht@gmail.com, hjl.tools@gmail.com,
richard.sandiford@arm.com
Subject: Re: [PATCH] [vect]Use intermiediate integer type for float_expr/fix_trunc_expr when direct optab is not existed.
Date: Thu, 22 Jun 2023 09:32:43 +0200 [thread overview]
Message-ID: <CAFiYyc09ZOVBg8i+VZDyqmH0hq209yviNEHJ9JDnF-bpwerCbA@mail.gmail.com> (raw)
In-Reply-To: <31edd667-fec7-7b0-a9af-5063d73922f@codesourcery.com>
On Wed, Jun 21, 2023 at 10:39 PM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Wed, 21 Jun 2023, Richard Biener via Gcc-patches wrote:
>
> > > > int32_t x = (int32_t)0x1.0p32;
> > > > int32_t y = (int32_t)(int64_t)0x1.0p32;
> > > >
> > > > sets x to 2147483647 and y to 0.
> >
> > Hmm, good question. GENERIC has a direct truncation to unsigned char
> > for example, the C standard generally says if the integral part cannot
> > be represented then the behavior is undefined. So I think we should be
> > safe here (0x1.0p32 doesn't fit an int).
>
> We should be following Annex F (unspecified value plus "invalid" exception
> for out-of-range floating-to-integer conversions rather than undefined
> behavior). But we don't achieve that very well at present (see bug 93806
> comments 27-29 for examples of how such conversions produce wobbly
> values).
That would mean guarding this with !flag_trapping_math would be the appropriate
thing to do.
Richard.
> --
> Joseph S. Myers
> joseph@codesourcery.com
next prev parent reply other threads:[~2023-06-22 7:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 1:00 liuhongt
2023-06-20 8:38 ` Richard Biener
2023-06-20 9:09 ` Hongtao Liu
2023-06-20 9:22 ` Richard Biener
2023-06-20 16:11 ` liuhongt
2023-06-21 7:49 ` Uros Bizjak
2023-06-21 8:19 ` Richard Biener
2023-06-21 14:37 ` Uros Bizjak
2023-06-22 20:36 ` Thiago Jung Bauermann
2023-06-21 9:10 ` Richard Sandiford
2023-06-21 9:32 ` Richard Sandiford
2023-06-21 11:04 ` Richard Biener
2023-06-21 11:20 ` Richard Sandiford
2023-06-21 20:39 ` Joseph Myers
2023-06-22 7:32 ` Richard Biener [this message]
2023-07-12 9:19 ` Robin Dapp
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=CAFiYyc09ZOVBg8i+VZDyqmH0hq209yviNEHJ9JDnF-bpwerCbA@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=hongtao.liu@intel.com \
--cc=joseph@codesourcery.com \
--cc=richard.sandiford@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).