public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19953] New: Special-case real*complex multiplication for flag_complex_method=2
@ 2005-02-14 20:06 Thomas dot Koenig at online dot de
  2005-02-14 20:08 ` [Bug middle-end/19953] " Thomas dot Koenig at online dot de
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-02-14 20:06 UTC (permalink / raw)
  To: gcc-bugs

Looking at the following piece of code:

#include <math.h>
#include <complex.h>

int main()
{
    float a;
    complex float b,c;
    foo(&a, &b);
    c = a*b;
    return creal(c)+cimag(c)<0;
}

and compiling this with flag_complex_method=2 and -O3, I find
that the statement is translated to (in t65.optimized) to

  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  #   aD.2211_25 = V_MAY_DEF <aD.2211_1>;
  #   bD.2212_26 = V_MAY_DEF <bD.2212_7>;
  foo (&aD.2211, &bD.2212);
  #   D.2217_11 = V_MUST_DEF <D.2217_10>;
  D.2217 = __mulsc3 (aD.2211, 0.0, REALPART_EXPR <bD.2212>, IMAGPART_EXPR
<bD.2212>);
  return (doubleD.24) REALPART_EXPR <D.2217> + (doubleD.24) IMAGPART_EXPR
<D.2217> < 0.0;
  # SUCC: EXIT [100.0%]

This costs quite a lot of performance.  Multiplying a real number
by a complex number doesn't require any special cases, so the whole
__mulsc3 machinery is not needed here.

$ gcc -v
Using built-in specs.
Target: ia64-unknown-linux-gnu
Configured with: ../gcc-4.0-20050213/configure --prefix=/home/zfkts
--enable-languages=c,f95
Thread model: posix
gcc version 4.0.0 20050213 (experimental)

-- 
           Summary: Special-case real*complex multiplication for
                    flag_complex_method=2
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-03-16 17:25 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 20:06 [Bug middle-end/19953] New: Special-case real*complex multiplication for flag_complex_method=2 Thomas dot Koenig at online dot de
2005-02-14 20:08 ` [Bug middle-end/19953] " Thomas dot Koenig at online dot de
2005-02-14 20:11 ` pinskia at gcc dot gnu dot org
2005-02-14 23:37 ` [Bug middle-end/19953] Special-case real + complex arithmetic operation Thomas dot Koenig at online dot de
2005-02-15  5:48 ` [Bug middle-end/19953] [4.0 regression] " Thomas dot Koenig at online dot de
2005-02-15 18:48 ` [Bug middle-end/19953] Special-case real + complex arithmetic operation (-ffast-math) pinskia at gcc dot gnu dot org
2005-02-15 20:43 ` Thomas dot Koenig at online dot de
2005-02-19 15:54 ` rth at gcc dot gnu dot org
2005-02-25  0:59 ` cvs-commit at gcc dot gnu dot org
2005-02-25  0:59 ` rth at gcc dot gnu dot org
2005-02-27 18:34 ` Thomas dot Koenig at online dot de
2005-03-01 15:44 ` Thomas dot Koenig at online dot de
2005-03-01 17:13 ` pinskia at gcc dot gnu dot org
2005-03-01 21:07 ` Thomas dot Koenig at online dot de
2005-03-01 21:14 ` pinskia at gcc dot gnu dot org
2005-03-01 21:26 ` Thomas dot Koenig at online dot de
2005-03-16 17:25 ` fredrik dot huss at home dot se

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).