- To: gcc-help@xxxxxxxxxxx
- Subject: Re: GCC's -ffast-math behavior
- From: Andrew Haley <aph@xxxxxxxxxx>
- Date: Thu, 09 Feb 2012 10:10:48 +0000
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329387075; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=YSf+yPB8h8no0+MKuAkj gpvLXnU=; b=vNwphPk9zS852ytjq+FDvitUfZD/0/jMqWTMiYeAhcnOG0LdNCj4 tW60nwlt1+Ks3sUxUkHHkzrgUsuhzc/3TEjxRr9rxFJ7fwE3mA58IxBn3RQg6Y0e o1qeMXq6RsJDckVqc+xu0GqtgKtM6zYG14B6g0KRVlsbBhJSVNTPAII=
- In-reply-to: <4F339AE5.5030300@gmail.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16
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.
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]