This is the mail archive of the 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: [PATCH] Fold (a > 0 ? 1.0 : -1.0) into copysign (1.0, a) and a * copysign (1.0, a) into abs(a)

Joseph Myers <> writes:
> On Mon, 26 Jun 2017, Richard Sandiford wrote:
>> > Non-generic builtins like copysign are such a pain... We also end up 
>> > missing the 128-bit case that way (pre-existing problem, not your patch). 
>> > We seem to have a corresponding internal function, but apparently it is 
>> > not used until expansion (well, maybe during vectorization).
>> It should be OK to introduce uses of the internal functions whenever
>> it's useful.  The match code will check that the internal function is
>> implemented before allowing the transformation.
> How well would internal functions work with some having built-in functions 
> only for float, double and long double, others (like copysign) having them 
> for all the _FloatN and _FloatNx types?

I don't think the internal functions themselves should be affected,
since they rely on optabs rather than external functions.  They can
support any mode that the target can support, even if there's no
equivalent standard function.

It might be a good idea to extend gencfn-macros.c and co. to handle
built-in functions that operate on _Float types though.  That wouldn't
be needed for correctness, but would be useful if we want to have folds
that operate on all built-in copysign functions as well as the internal
copysign function.


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