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 libstdc++/43108] mixed complex<T> multiplication horribly inefficient



------- Comment #15 from jan at epgmod dot phys dot tue dot nl  2010-02-17 23:16 -------
(In reply to comment #8)
> The patch will make results incorrect regarding the sign of zeros.  Does
> the C++ standard library allow this?  Thus, does it specify multiplication
> with a scalar float as component-wise multiplication?

OK, before giving up on this, let me state for the record that 

* this patch *fixes* the signs (also see comment #13). 
* It also fixes a serious regression when std::complex is used (that
std::complex relies on __complex__ for its implementation is an implementation
detail). So closing this as INVALID does not feel right.
* I agree that a long-term solution would involve fixing the middle-end, for
example by using the concept of a 'strong 0 ' (00) in the promotion of scalars
to (degenerate) doubles (see LIA-3, ISO/IEC 10967-3:2006(E) page 77). Then
u*(x+iy) -> (u+00i)*(x+iy), and expand_complex_multiplication() can eliminate
the terms 00*x and 00*iy. I have no idea how difficult it would be implement
that, since this is my first experience with gcc 'under the hood'. Ideas?

With kind regards, and thank you again for your time. Jan.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43108


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