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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's first canonicalized to

  <bb 2> [local count: 1073741824]:
  _4 = ABS_EXPR <a_1(D)>;
  _2 = __builtin_pow (_4, 3.125e-2);

and then expanded again to

  <bb 2> [local count: 1073741824]:
  _4 = ABS_EXPR <a_1(D)>;
  powroot_5 = __builtin_sqrt (_4);
  powroot_6 = __builtin_sqrt (powroot_5);
  powroot_7 = __builtin_sqrt (powroot_6);
  powroot_8 = __builtin_sqrt (powroot_7);
  powroot_9 = __builtin_sqrt (powroot_8);

with -Os you get the library call.

  /* Attempt to expand the POW as a product of square root chains.
     Expand the 0.25 case even when otpimising for size.  */
  if (flag_unsafe_math_optimizations
      && sqrtfn
      && hw_sqrt_exists
      && (speed_p || real_equal (&c, &dconst1_4))
      && !HONOR_SIGNED_ZEROS (mode))
    { 
      unsigned int max_depth = speed_p
                                ? PARAM_VALUE (PARAM_MAX_POW_SQRT_DEPTH)
                                : 2;

      tree expand_with_sqrts
        = expand_pow_as_sqrts (gsi, loc, arg0, arg1, max_depth);

      if (expand_with_sqrts)
        return expand_with_sqrts;  
    }

limited by --param max-pow-sqrt-depth (the limit is 5 by default).

Reply via email to