On Fri, Oct 14, 2022 at 4:33 PM Jakub Jelinek wrote: > > On Fri, Oct 14, 2022 at 04:26:50PM +0200, Aldy Hernandez via Gcc-patches wrote: > > Similar to what we do for NANs when !HONOR_NANS and Inf when > > flag_finite_math_only, we can remove -0.0 from the range at creation > > time. > > > > We were kinda sorta doing this because there is a bug in > > real_isdenormal that is causing flush_denormals_to_zero to saturate > > [x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS. Fixing this bug > > (upcoming), causes us to leave -0.0 in places where we aren't > > expecting it (the intersection code). > > > > gcc/ChangeLog: > > > > * value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS. > > This looks wrong to me. > !HONOR_NANS is different from !HONOR_SIGNED_ZEROS. > The former says that either NaNs aren't supported or if they appear, > it will be UB. > The latter says that either -0.0 doesn't exist, or user doesn't care > if -0.0 or 0.0 is used. > > So, what you do is ok for !MODE_HAS_SIGNED_ZEROS (TYPE_MODE (m_type)), > but otherwise we want to canonicalize [x, -0.0] to [x, 0.0] and > [0.0, y] to [-0.0, y]. If the user doesn't care, I would expect they'd be ok with it being +0.0, but I must say, this is way beyond my paygrade. How does this patch in testing look? Thanks. Aldy