From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81E2C3858413; Wed, 6 Apr 2022 10:30:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81E2C3858413 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/24021] VRP does not work with floating points Date: Wed, 06 Apr 2022 10:30:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2022 10:30:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D24021 --- Comment #23 from Aldy Hernandez --- (In reply to Aldy Hernandez from comment #22) > > This doesn't take flag_rounding_math or not always exactly precise floa= ting > > point computations into account. > > It is also missing real_convert after real_arithmetics that performs at= least > > some of the rounding (and perhaps the inexact return value from > > real_arithmetic > > should be taken into account). > > Without flag_rounding_math and on non-MODE_COMPOSITE_P the basic arithm= etics > > will be probably exact most of the time, except perhaps for denormals w= hich > > are > > sometimes flushed to zero. But as soon as one jumps to even sqrt and o= ther > > math functions, one needs to allow some epsilon up for upper bound and = down > > for lower bound, similarly for the basic ops with inexact and > > flag_rounding_math. > > For MODE_COMPOSITE_P, our emulation doesn't match what is done at runti= me, > > so we need to be more forgiving. >=20 > Definitely. I'm pretty sure there's even more stuff I'm missing :). We'= re > only providing the core infrastructure-- the ability for ranger / vrp to > handle basic floats. We're hoping some float savvy hacker can fill in the > rest. >=20 > The above does handle open and closed internals, though. So it should be > able to handle (5.0, 10.0] + [1.0, 1.0] if I understand correctly. But I > don't pretend to remotely know anything about floats. I'm hoping the > range-op entries can be implemented by a floating expert. >=20 > A bare bones implementation would provide relops, and maybe ?? singleton > floats ([1.23, 1.23]). Or...we could just use const_binop() instead of calling real_arithmetic directly. Wouldn't that handle all the cases you mention?=