This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/82153] missed optimization: double rounding
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 08 Sep 2017 22:24:36 +0000
- Subject: [Bug rtl-optimization/82153] missed optimization: double rounding
- Auto-submitted: auto-generated
- References: <bug-82153-4@http.gcc.gnu.org/bugzilla/>
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).