On 02/09/2012 10:07 AM, xunxun wrote: > 于 2012/2/9 17:47, Andrew Haley 写道: >> On 02/09/2012 09:35 AM, xunxun wrote: >>> 于 2012/2/9 17:21, Andrew Haley 写道: >>>> On 02/09/2012 08:33 AM, xunxun wrote: >>>>> When using -ffast-math, gcc don't generate the math function >>>>> symbol: U _exp >>>> No, it doesn't. Instead gcc uses the F2XM1 instruction. Why would >>>> you want to call a library when gcc has an instruction to do the >>>> job? >>>> >>> Because other math lib works faster than gcc itself (even with >>> fastmath), and I want to use fastmath to make other caculation faster, too. >> Hmm, I think that'll be difficult. We tend to assume that when a >> processor has built-in instructions to do something, that's the >> fastest way to do it. It's usually true, and I am wondering what >> tricks Intel uses. Granted, the floating-point transcendental >> instructions aren't super-fast, and perhaps Intel doesn't optimize >> them any more. >> > Thank you for the explanation. > > I think I can separate all the math functions from other code, put the > math functions within one lib, and don't use fastmath to build the lib. :) Okay. Can you tell us how much faster than the builtins the Intel lib actually, is, and how you measured that? Andrew.