This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19953] Special-case real + complex arithmetic operation (-ffast-math)
- From: "fredrik dot huss at home dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Mar 2005 17:25:44 -0000
- Subject: [Bug middle-end/19953] Special-case real + complex arithmetic operation (-ffast-math)
- References: <20050214155119.19953.Thomas.Koenig@online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From fredrik dot huss at home dot se 2005-03-16 17:25 -------
I see similar problems with real by complex multiplications in C++.
The following test program,
#include <complex>
std::complex<double> a, b;
double c;
void f()
{
a = b * c;
}
when compiled with "g++ -O3 -march=pentium4 -mfpmath=sse -S -c test.C", gives
this result (from test.s):
_Z1fv:
.LFB1857:
pushl %ebp
.LCFI0:
movl %esp, %ebp
.LCFI1:
movsd b+8, %xmm3
movsd b, %xmm2
movsd c, %xmm4
pxor %xmm5, %xmm5
movapd %xmm2, %xmm0
mulsd %xmm5, %xmm0
movapd %xmm4, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, a+8
mulsd %xmm4, %xmm2
mulsd %xmm5, %xmm3
subsd %xmm3, %xmm2
movsd %xmm2, a
popl %ebp
ret
I.e, the real value c is still converted to a complex value and a full
multiplication is done.
I'm using the following version of gcc:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0-20050312/configure --prefix=/home/fredrik/gcc
--enable-languages=c,c++
Thread model: posix
gcc version 4.0.0 20050312 (prerelease)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19953