[Cfp-interest 2651] Re: Floating point rounding modes

Vincent Lefevre vincent at vinc17.net
Mon Jan 30 02:25:26 PST 2023


On 2023-01-27 09:07:21 -0800, Hans Boehm wrote:
> AFAICT, a significant problem with the current and proposed facilities is
> that they are so rarely used that implementations commonly don't pay enough
> attention to them. I think many implementations don't properly handle
> FENV_ACCESS correctly, so I have relatively little confidence in
> FENV_ROUND, especially since I think we agree it still doesn't handle
> constants.

The problem is known in GCC:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678
and
  https://gcc.gnu.org/legacy-ml/gcc-help/2004-05/msg00176.html
(where a hack to avoid CSE is described).

I think that the main issue is that with the current facility, it is
generally not possible to know with which rounding mode an operation
is done, so that the current GCC model used for CSE does not work,
and there does not seem to be a way to disable FP CSE alone (and even
CSE alone). I think that even -O0 is not enough, e.g. for constant
expressions. Anyway, even if FENV_ACCESS could be taken into account,
the current facility is bad for optimizations.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list