public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Richard Biener <richard.guenther@gmail.com>
Cc: HAO CHEN GUI <guihaoc@linux.ibm.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: [PATCH, rs6000] Disable gimple fold for float or double vec_minmax when fast-math is not set
Date: Wed, 13 Oct 2021 13:19:27 -0500	[thread overview]
Message-ID: <20211013181927.GA614@gate.crashing.org> (raw)
In-Reply-To: <CAFiYyc0YdUbba8eVPkL76G8boUP+Td+OoiVt45BA4imfFa0-gg@mail.gmail.com>

On Wed, Oct 13, 2021 at 10:29:26AM +0200, Richard Biener wrote:
> On Wed, Oct 13, 2021 at 9:43 AM HAO CHEN GUI <guihaoc@linux.ibm.com> wrote:
> >    As to IEEE behavior, do you mean "Minimum and maximum operations" defined in IEEE-754 2019?  If so, I think VSX/altivec min/max instructions don't conform with it. It demands a quite NaN if either operand is a NaN while our instructions don't.
> >
> > IEEE-754 2019 maximum(x, y) is xif x>y, yif y>x, and a quiet NaN if either operand is a NaN, according to 6.2. For this operation, +0 compares greater than −0. Otherwise (i.e., when x=y and signs are the same) it is either xor y. Actions for xvmaxdp
> 
> Hmm, then I do not understand the reason for the patch - people using
> the intrinsics cannot expect IEEE semantics then.
> So you are concerned that people don't get the 1:1 machine instruction
> but eventually the IEEE conforming MIN/MAX_EXPR?

I do not know about Gimple MIN_EXPR (it is not documented?), but the
RTL "smin" is meaningless in the presence of NaNs or signed zeros.  This
is documented (in rtl.texi):

"""
@findex smin
@findex smax
@cindex signed minimum
@cindex signed maximum
@item (smin:@var{m} @var{x} @var{y})
@itemx (smax:@var{m} @var{x} @var{y})
Represents the smaller (for @code{smin}) or larger (for @code{smax}) of
@var{x} and @var{y}, interpreted as signed values in mode @var{m}.
When used with floating point, if both operands are zeros, or if either
operand is @code{NaN}, then it is unspecified which of the two operands
is returned as the result.
"""

(not exactly meaningless, okay, but not usable for almost anything).

> But that can then still happen with -ffast-math so I wonder what's the point.

That :-)


Segher

  parent reply	other threads:[~2021-10-13 18:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  8:57 HAO CHEN GUI
2021-10-12  9:57 ` Richard Biener
2021-10-13  7:43   ` HAO CHEN GUI
2021-10-13  8:29     ` Richard Biener
2021-10-13  9:15       ` HAO CHEN GUI
2021-10-13 18:19       ` Segher Boessenkool [this message]
2021-10-13 22:04     ` Joseph Myers
2021-10-13 18:28 ` Segher Boessenkool
  -- strict thread matches above, loose matches on Subject: below --
2021-11-01  6:48 HAO CHEN GUI
2021-11-02  0:21 ` David Edelsohn
2021-11-02  2:40   ` HAO CHEN GUI
2021-11-02 13:12     ` David Edelsohn
2021-11-03  2:14       ` HAO CHEN GUI
2021-10-20  9:04 HAO CHEN GUI
2021-10-20 16:19 ` Segher Boessenkool
2021-10-21  6:25   ` HAO CHEN GUI
2021-10-13 15:02 David Edelsohn
2021-08-24  8:52 HAO CHEN GUI
2021-08-24 20:04 ` Bill Schmidt
2021-08-24 22:40   ` Segher Boessenkool
2021-08-25  7:06     ` HAO CHEN GUI
2021-08-25  7:50       ` Kewen.Lin
2021-08-25  8:17         ` HAO CHEN GUI
2021-08-25  8:44           ` HAO CHEN GUI
2021-08-25 12:34       ` Bill Schmidt
2021-08-26  1:19         ` HAO CHEN GUI
2021-09-06  6:01           ` HAO CHEN GUI
2021-10-11 15:55           ` Segher Boessenkool
2021-10-11 16:07             ` 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=20211013181927.GA614@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guihaoc@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=wschmidt@linux.ibm.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).