public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Marc Glisse <marc.glisse@inria.fr>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: ORDERED_EXPR in invert_tree_comparison
Date: Thu, 02 Aug 2012 08:51:00 -0000	[thread overview]
Message-ID: <CAFiYyc3qf9hh9H=o92xbsc=ucn8w-ZqAqoj=GhzDh40mpDvjrQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1208012115330.3264@laptop-mg.saclay.inria.fr>

On Wed, Aug 1, 2012 at 9:21 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> an opinion on this?
>
> (I just noticed: I'll update the list in the comment visible at the top of
> the patch if this gets in).

It looks ok to me but I am no floating-point expert.  Can you add a testcase?

Ok with that change.

Thanks,
Richard.

>
> On Thu, 19 Jul 2012, Marc Glisse wrote:
>
>> Hello,
>>
>> the simple patch below passes the testsuite after a c,c++ bootstrap
>> without new regressions. Note however that
>>
>> #include <math.h>
>> int f(double a, double b){
>>  return (!isunordered(a,b))&&(a<b);
>> }
>>
>> is then optimized by ifcombine to "return (a<b);", which seems wrong in
>> the absence of -fno-trapping-math. I don't know if there are ways to trigger
>> this latent bug without the patch.
>>
>>
>>
>> 2012-06-15  Marc Glisse  <marc.glisse@inria.fr>
>>
>>        PR tree-optimization/53805
>>        * fold-const.c (invert_tree_comparison): Do invert ORDERED_EXPR and
>>        UNORDERED_EXPR for floating point.
>>
>> --- fold-const.c        (revision 189622)
>> +++ fold-const.c        (working copy)
>> @@ -2096,13 +2096,14 @@ pedantic_non_lvalue_loc (location_t loc,
>>    It is generally not safe to do this for floating-point comparisons,
>> except
>>    for EQ_EXPR and NE_EXPR, so we return ERROR_MARK in this case.  */
>>
>> enum tree_code
>> invert_tree_comparison (enum tree_code code, bool honor_nans)
>> {
>> -  if (honor_nans && flag_trapping_math && code != EQ_EXPR && code !=
>> NE_EXPR)
>> +  if (honor_nans && flag_trapping_math && code != EQ_EXPR && code !=
>> NE_EXPR
>> +      && code != ORDERED_EXPR && code != UNORDERED_EXPR)
>>     return ERROR_MARK;
>>
>>   switch (code)
>>     {
>>     case EQ_EXPR:
>>       return NE_EXPR;
>
>
> --
> Marc Glisse

  reply	other threads:[~2012-08-02  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19 15:52 Marc Glisse
2012-08-01 19:21 ` Marc Glisse
2012-08-02  8:51   ` Richard Guenther [this message]
2012-08-02 12:48     ` Marc Glisse
2012-08-02 13:37       ` Richard Guenther
2012-08-02 13:56       ` Nathan Froyd
2012-08-02 15:20         ` Marc Glisse
2012-08-02 15:24           ` Nathan Froyd

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='CAFiYyc3qf9hh9H=o92xbsc=ucn8w-ZqAqoj=GhzDh40mpDvjrQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    /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).