gcc 4.4 compiles the following: _Complex long double foo(long double p1, long double p2) { return p1 + (__extension__ 1.0iF) * p2; }
gcc-4.4 -O3 tgcc.c -c -o tgcc.o into 0x0000000000000000 <+0>: fldt 0x8(%rsp) 0x0000000000000004 <+4>: fldt 0x18(%rsp) 0x0000000000000008 <+8>: fxch %st(1) 0x000000000000000a <+10>: retq This is ok, except for the useless fxch instruction. However, gcc 4.5 compiles the same code into: gcc-4.5 -O3 tgcc.c -c -o tgcc.o 0x0000000000000000 <+0>: fldt 0x18(%rsp) 0x0000000000000004 <+4>: fld %st(0) 0x0000000000000006 <+6>: fmuls 0x0(%rip) # 0xc <foo+12> 0x000000000000000c <+12>: fldt 0x8(%rsp) 0x0000000000000010 <+16>: faddp %st,%st(1) 0x0000000000000012 <+18>: retq which is quite a bit worse. -- Summary: Missed optimization with complex long double Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: svfuerst at gmail dot com GCC build triplet: x86_64-linux GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639