https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115710

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> I wonder if we could also add:
> +/* cabs(x+0i) or cabs(0+xi) -> abs(x).  */
> +(simplify
> + (CABS (complex:c @0 real_zerop@1))
> + (abs @0))
> 
> 
> + /* cabs(x+xi) -> fabs(x)*sqrt(2).  */
> + (simplify
> +  (CABS (complex @0 @0))
> +  (mult (abs @0) { build_real_truncate (type, dconst_sqrt2 ()); })))
> 
> 
> to the lowering part.
> 
> let me look into doing that but it will be 3rd part to the patch series.
> Since we should have this info already ...

This is needed to get the same code generation as before for:
```
double f(double a, double c)
{
  _Complex double b = a;
  b+= c;
  return __builtin_cabs(b);
}
```

Reply via email to