This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50032] New: Bad optimization with sin/cos
- From: "fbafelipe at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 9 Aug 2011 17:42:08 +0000
- Subject: [Bug c/50032] New: Bad optimization with sin/cos
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50032
Summary: Bad optimization with sin/cos
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: fbafelipe@gmail.com
Created attachment 24966
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24966
Sample code of the bug
When I compile and run the attached code, the optimizations make the code run
slower.
If I change the variable ang to double, the optimizations work (making the code
run faster than without optimization).
Checking the assembly output, I find that the compiler is changing the function
being called from cos and sin to sincosf instead of calling sincos to save a
cast. But it seems sincos is faster than sincosf (fpu is optimized for double).
System: Ubuntu 11.04, 64 bits, Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz
Gcc: 4.5.2