[LLVMdev] Pure external functions

Duncan Sands baldrick at free.fr
Tue Feb 17 01:46:07 PST 2009


Hi,

> Lennart Augustsson mentioned on his blog that he got substantial performance 
> improvements by conveying to LLVM when external functions (e.g. tanh) were 
> pure.

first note that tanh is not pure, because the result depends on the current
floating point rounding mode.  However, if you are willing to sacrifice
complete numerical correctness, you can give llvm-gcc the -ffast-math flag
and, voila!, tanh becomes pure.

Ciao,

Duncan.



More information about the llvm-dev mailing list