This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv2][PR 57371] Remove useless floating point casts in comparisons


On Fri, Jul 7, 2017 at 6:07 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 7 Jul 2017, Yuri Gribov wrote:
>
>> Hi all,
>>
>> This is an updated version of patch in
>> https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00034.html . It should
>> be much more complete, both in functionality and in tests.
>
> I think there should be tests when the constant is an infinity (of either
> sign) or NaN (quiet or signaling).

Indeed.

> I suspect infinities would already work with the patch as-is (the logic
> dealing with constants outside the range of the integer type).  I'm less
> clear that NaNs would work properly.  (If the comparison is == or != you
> can optimize it for quiet NaNs, to false and true respectively.  If it's a
> signaling NaN, or < <= > >=, optimizing to false is only valid with
> -fno-trapping-math, as it would lose an "invalid" exception.)

It's actually under -fsignaling-nans (which if off by default). I've
attached updated patch, tests are still running but perhaps you could
take a look?

-Y

Attachment: pr57371-3.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]