why not consfold sin(const)

Robert Dewar dewar@gnat.com
Sun Sep 19 20:25:00 GMT 2004


Luchezar Belev wrote:

> OK, but in our concrete case we already have some optimizing logic in place
> which looks if the argument of sin() is zero or if the argument of log() is one,
> and in the case of sqrt always replaces with const. So if this already present
> logic is worth enough to be there in the compiler, i fail to see why a full consfolder
> is not worth enough. It's definitely not the case that it's something too complex
> for implementing. In fact it's exactly as complex as the currently present logic.

Not at all, it is far more complex to implement, since you need a very
accurate set of target independent elementary function routines (you
can't just go calling these routines from the compiler and using the
host functions!)

> Surely the precision is not much of an issue either, since -ffast-math
> implies possible non-strict copliance with standards, precision requirements, etc.

Yes, but it does not stretch as far as giving complete junk results,
which is what would happen in some cases if you used host functions.




More information about the Gcc mailing list