From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 400 invoked by alias); 10 Feb 2008 22:48:37 -0000 Received: (qmail 307 invoked by uid 48); 10 Feb 2008 22:47:55 -0000 Date: Sun, 10 Feb 2008 22:48:00 -0000 Message-ID: <20080210224755.306.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/29549] matmul slow for complex matrices In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tkoenig at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg01136.txt.bz2 ------- 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