This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [GCC][PATCH][mid-end] Optimize x * copysign (1.0, y) [Patch (1/2)]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Tamar Christina <Tamar dot Christina at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, "law at redhat dot com" <law at redhat dot com>, "ian at airs dot com" <ian at airs dot com>, "rguenther at suse dot de" <rguenther at suse dot de>
- Date: Mon, 12 Jun 2017 16:52:24 +0000
- Subject: Re: [GCC][PATCH][mid-end] Optimize x * copysign (1.0, y) [Patch (1/2)]
- Authentication-results: sourceware.org; auth=none
- References: <VI1PR0801MB20316B7A94D73C180C266C15FFCD0@VI1PR0801MB2031.eurprd08.prod.outlook.com>
On Mon, 12 Jun 2017, Tamar Christina wrote:
> x * copysign (1.0, y) and
> x * copysign (-1.0, y)
>
> to:
>
> x ^ (y & (1 << sign_bit_position))
Note that this needs to be disabled for -fsignaling-nans, as if x is a
signaling NaN, the multiplication converts it to a quiet NaN and raises
"invalid".
> This is done by creating a special builtin during matching and generate the
> appropriate instructions during expand. This new builtin is called XORSIGN.
If the built-in function has a user-visible name such as __builtin_xorsign
(as opposed to one that's not a C identifier), it needs to be documented
as a user-visible feature. I'd suggest not having such a user-visible
built-in function.
--
Joseph S. Myers
joseph@codesourcery.com