[Bug tree-optimization/23452] New: Optimizing CONJG_EXPR (a) * a

tkoenig at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Aug 18 07:26:00 GMT 2005


$ cat conj.f
      program main
      complex c1,c2
      call foo(c1)
      c2 = c1 * conjg(c1)
      call bar(c2)
      end

This is translated into a CONJ_EXPR:

  foo (&c1);
  c2 = CONJ_EXPR <c1> * c1;
  bar (&c2);

The .optimized dump shows:

 foo (&c1);
  CR.11 = REALPART_EXPR <c1>;
  CI.12 = IMAGPART_EXPR <c1>;
  CI.13 = -CI.12;
  REALPART_EXPR <c2> = CR.11 * CR.11 - CI.12 * CI.13;
  IMAGPART_EXPR <c2> = CR.11 * CI.13 + CR.11 * CI.12;
  bar (&c2);
  return;

This could be simplified to

   REALPART_EXPR <c2> = CR.11 * CR.11 + CR.12 * CR.12;
   IMAGPART_EXPR <c2> = 0;

-- 
           Summary: Optimizing CONJG_EXPR (a) * a
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list