This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/50032] New: Bad optimization with sin/cos


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]