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


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?

(Preferably of course the built-in functions for libm functions would 
generally exist for all the types.  I didn't include that in my patches 
adding _FloatN/_FloatNx support 
<https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01290.html> 
<https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01442.html> and noted 
various issues to watch out for there, especially increasing the size of 
the enum of built-in functions and the startup cost of initializing them.  
There are other optimizations with similar issues of only covering float, 
double and long double.)

-- 
Joseph S. Myers
joseph@codesourcery.com


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