[Bug tree-optimization/126690] New: Missed folding of nested cproj, cabs of a cproj

"ktkachov at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126690

            Bug ID: 126690
           Summary: Missed folding of nested cproj, cabs of a cproj
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: easyhack, missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

cproj maps a value with an infinite part to (Inf, +-0) and is the
identity everywhere else, so it is idempotent.  cabs already returns
+Inf whenever a part is infinite, which is exactly the value cproj
produces, so cabs absorbs a cproj.

_Complex double
f (_Complex double a)
{
  return __builtin_cproj (__builtin_cproj (a));
}

double
g (_Complex double a)
{
  return __builtin_cabs (__builtin_cproj (a));
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.