[Patch match.pd] Add a simplify rule for x * copysign (1.0, y);
Richard Biener
richard.guenther@gmail.com
Fri Oct 2 08:18:00 GMT 2015
On Thu, Oct 1, 2015 at 8:36 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Oct 01, 2015 at 02:57:15PM +0100, James Greenhalgh wrote:
>> 2015-10-01 James Greenhalgh <james.greenhalgh@arm.com>
>>
>> * match.pd (mult (COPYSIGN:s real_onep @0) @1): New simplifier.
>
> Also, please note that
> + wide_int m = wi::min_value (TYPE_PRECISION (type), SIGNED);
> + tree tt
> + = build_nonstandard_integer_type (TYPE_PRECISION (type),
> + false);
> + tree mask = wide_int_to_tree (tt, m);
> is really not a reliable way to determine which bit to change.
> In some floating format it is not possible at all, in others it might not
> be the topmost bit of the precision, or might depend on
> FLOAT_WORDS_BIG_ENDIAN etc., see expand_copysign_bit and expand_copysign
> for details (e.g. one has to look at fmt->signbit_rw etc.).
> So, I probably agree with Andrew that it would be better optimized during
> expansion. One issue for that though is that TER stops at calls, we'd need
> to special case this case.
I agreee with optimizing this in expansion only. The copysign form is shorter
and it captures the high-level part of the operation better. Say we later
constant-propagate a positive real into y then chances are high we optimize
the copysign form but not the lowered one. Also if we ever get VRP to
handle real-type ranges it would need to decipher the sequence as well.
Richard.
> Jakub
More information about the Gcc-patches
mailing list