public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Robin Dapp <rdapp.gcc@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] vect: Handle demoting FLOAT and promoting FIX_TRUNC.
Date: Thu, 13 Jul 2023 14:36:12 +0200	[thread overview]
Message-ID: <CAFiYyc0h=H9bgTrWV3MqROpJTN=MA=39Cfj9vebF=Puv4pL+qw@mail.gmail.com> (raw)
In-Reply-To: <be6c974e-8459-bf3e-767e-68f9f8f4d198@gmail.com>

On Thu, Jul 13, 2023 at 2:19 PM Robin Dapp <rdapp.gcc@gmail.com> wrote:
>
> > Can you add testcases?  Also the current restriction is because
> > the variants you add are not always correct and I don't see any
> > checks that the intermediate type doesn't lose significant bits?
>
> The testcases I wanted to add with a follow-up RISC-V patch but
> I can also try an aarch64 one.
>
> So for my understanding, please correct, we have:
>
>   promoting int -> float, should always be safe.  We currently
>    vectorize this with WIDEN and NONE.
>
>   demoting float -> int, this is safe as long as the float
>    value can be represented in the int type, otherwise we must
>    trap.
>    We currently vectorize this on x86 using NARROW (regardless
>    of -ftrapping-math) and using NONE only with -fno-trapping-math.
>
>   demoting int -> float, this is safe as long as the
>    intermediate types can hold the initial value?  How is
>    this different to demoting e.g. int64_t -> int8_t?
>    We currently do not vectorize this with either NARROW or NONE.
>    LLVM vectorizes but only with their default(?) -fno-trapping-math.
>    Yet I don't see how we could trap here?
>
>   promoting float -> int, this is safe as long as the float
>    value can be represented (as above)?  We currently vectorize
>    this (regardless of -ftrapping-math) with WIDEN but not NONE.
>
> So apart from unifying the -ftrapping-math behavior I think only
> the third variant is somewhat critical?

I think all demoting cases need checks that are not present right now
irrespective of properly trapping.

Richard.

> Regards
>  Robin
>

  reply	other threads:[~2023-07-13 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 10:30 Robin Dapp
2023-07-13 10:37 ` Richard Biener
2023-07-13 12:19   ` Robin Dapp
2023-07-13 12:36     ` Richard Biener [this message]
2023-07-14 15:16       ` [PATCH v2] " Robin Dapp
2023-07-19  8:28         ` Richard Biener
2023-07-20 10:11           ` 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='CAFiYyc0h=H9bgTrWV3MqROpJTN=MA=39Cfj9vebF=Puv4pL+qw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdapp.gcc@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).