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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
floor rounds towards -inf.  Conversion to int rounds towards 0.  That is, 
it wouldn't be valid to omit the roundsd because results would be 
different for integer arguments.  That said, if you replace floor by 
trunc, the optimization should be valid (given the default 
-ffp-int-builtin-inexact, anyway, or -fno-trapping-math; as I understand 
it, cvttsd2si raises "inexact" for noninteger arguments, whereas with 
-fno-fp-int-builtin-inexact, trunc isn't allowed to and neither is a 
conversion of an integer floating-point value to an integer type).

Reply via email to