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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 
06:43:55 UTC ---
Reduced testcase:
  int best_state[256][256];
 __attribute__((cold)) 
int encode_init(double p) {
  return best_state[(int)round(p)][0];
}

--- CUT ---
(define_expand "lround<X87MODEF:mode><SWI248x:mode>2"
  [(match_operand:SWI248x 0 "nonimmediate_operand" "")
   (match_operand:X87MODEF 1 "register_operand" "")]
  "(TARGET_USE_FANCY_MATH_387
    && (!(SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH)
        || TARGET_MIX_SSE_I387)
    && flag_unsafe_math_optimizations)
   || (SSE_FLOAT_MODE_P (<X87MODEF:MODE>mode) && TARGET_SSE_MATH
       && <SWI248x:MODE>mode != HImode
       && ((<SWI248x:MODE>mode != DImode) || TARGET_64BIT)
       && !flag_trapping_math && !flag_rounding_math)"
{
  if (optimize_insn_for_size_p ())
    FAIL;

--- CUT ---
Looks like there is a disconnect about when choosing iround over lround.

I bet the code that handles the expanding of __builtin_iround
(expand_builtin_int_roundingfn_2) should do exactly what the expanding of iceil
does (expand_builtin_int_roundingfn).

Reply via email to