[Bug c/43639] Missed optimization with complex long double
--- Comment #4 from jsm28 at gcc dot gnu dot org 2010-05-22 18:18 --- This is deliberate, use -fno-signed-zeros to get the optimization you want with 4.5. *** This bug has been marked as a duplicate of 24581 *** -- jsm28 at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||DUPLICATE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639
[Bug c/43639] Missed optimization with complex long double
--- Comment #1 from pinskia at gmail dot com 2010-04-04 06:28 --- Subject: Re: New: Missed optimization with complex long double Sent from my iPhone On Apr 3, 2010, at 11:21 PM, svfuerst at gmail dot com gcc-bugzi...@gcc.gnu.org wrote: 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 0x +0: fldt 0x8(%rsp) 0x0004 +4: fldt 0x18(%rsp) 0x0008 +8: fxch %st(1) 0x000a +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 0x +0: fldt 0x18(%rsp) 0x0004 +4: fld%st(0) 0x0006 +6: fmuls 0x0(%rip)# 0xc foo+12 0x000c +12:fldt 0x8(%rsp) 0x0010 +16:faddp %st,%st(1) 0x0012 +18:retq which is quite a bit worse. Except it is needed for handling -0.0 correctly. -- 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 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639
[Bug c/43639] Missed optimization with complex long double
--- Comment #2 from svfuerst at gmail dot com 2010-04-04 16:51 --- Paragraph 2 in G.5.1 defines multiplication of a real floating point type by an imaginary floating point type to be an imaginary type, not a complex type. In addition, the Rationale for Annex G states that It allow writing imaginary and complex expressions in common mathematical style, for example x + I*y. Note that the multiplication here affects translated code, but does not necessitate an actual floating-point multiply, nor does the addition necessitate a floating point add. Which strongly suggests that the naive code generation which ignores the signed zero issue is the correct one. (Note that the rationale also lists the case where y=INFINITY as causing problems with signaling NaNs if I is _Complex_I.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639
[Bug c/43639] Missed optimization with complex long double
--- Comment #3 from joseph at codesourcery dot com 2010-04-04 19:12 --- Subject: Re: Missed optimization with complex long double On Sun, 4 Apr 2010, svfuerst at gmail dot com wrote: Paragraph 2 in G.5.1 defines multiplication of a real floating point type by an imaginary floating point type to be an imaginary type, not a complex type. GCC does not support imaginary types, so this is irrelevant. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43639