This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] fold a * (a > 0 ? 1 : -1) to abs(a) and related optimizations
- From: Joseph Myers <joseph at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at gmail dot com>
- Date: Mon, 26 Jun 2017 15:02:36 +0000
- Subject: Re: [PATCH] fold a * (a > 0 ? 1 : -1) to abs(a) and related optimizations
- Authentication-results: sourceware.org; auth=none
- References: <CA+=Sn1mWYuz8h5zBcNqwT2LG9N4B3DueNdoZHmyb4DRREFhwQQ@mail.gmail.com> <alpine.DEB.email@example.com>
On Sat, 24 Jun 2017, Marc Glisse wrote:
> * if X is NaN, we may get a qNaN with the wrong sign bit. We probably don't
> care much though...
The sign bit from a multiplication involving a NaN is not specified.
*But* making any of these transformations with a qNaN loses the "invalid"
exception from an ordered comparison involving a qNaN, so isn't valid in
the case of (qNaNs respected and trapping-math).
Joseph S. Myers