------- Comment #6 from tkoenig at gcc dot gnu dot org 2008-02-10 22:47 -------
(In reply to comment #5)
> The big culprit seems to be -fcx-limited-range. The other flags enabled by
> -ffast-math help very little.
C has some strange rules for complex types, which are mandated by the
C standard and aren't much use for other languages.
This is controlled by the variable flag_complex_method. For C, this
is either 2 (meaning full C rules) or 0, which implies limited range
for complex division. Complex multiplication can be expanded into
a libcall for flag_complex_method == 2 under circumstances I don't
understand (line 981, tree-complex.c).
Fortran usually has 1, which means sane rules for complex division
and multiplication.
Unfortunately, our matmul routines are written in C, so we
get what we don't need in Fortran - full C rules and possibly
a call to a library routine.
Solutions? We could introduce an option to set flag_complex_method to
1 in C. We could also set -fcx-limited-range for our matmul
routines, which should be safe as they don't use complex division
(at least they should not :-)
CC:ing rth as he wrote the code in question.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rth at gcc dot gnu dot org,
| |tkoenig at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29549