This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/81906] [7/8 Regression] Calls to rint() wrongly optimized away starting in g++ 6


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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #12 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
[my comment collided with Joseph's, I'm pointing out that one additional
copysign is sufficient under -frounding-math)

I think this expansion works as intended for to-nearest and towards-zero
rounding modes, and swaps upwards and downwards rounding for negative operands.
Which implies that under -frounding-math the approach is fixable by swapping
signs of the 2**52 operands:

  xa = fabs (operand1);
  a2_52 = 2**52;
  [if flag_rounding_math]
    a2_52 = copysign (a2_52, operand1);
  xa = xa + a2_52 - a2_52;
  return copysign (xa, operand1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]