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));
}

Reply via email to