From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5B483858D35; Wed, 9 Nov 2022 16:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5B483858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668012020; bh=ys97kYS7qzv7YJU0SGxnj7P6eq4S6YQ0IIlSz5twyxI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bxwuswub2qOkEacF22qCOh+3HS1BBZIN2yFMLBNf2FLdkA8G/L2pWgns7HJe4uEbb Z6NFPPLU8kejtHgEGMnfEu2OsKpbjhkjvPwmzjighOVODEnOVdmw/Qrqvf5p3tt0XA vaFx/5A+Fa1/7/hCo/ShDfIIx/XE7heR1B45HGrs= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107591] range-op{,-float}.cc for x * x Date: Wed, 09 Nov 2022 16:40:07 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107591 --- Comment #8 from Jakub Jelinek --- (In reply to Aldy Hernandez from comment #6) > FYI, the range operators have a relation field, so it should be able to t= ell > you that both operands are equal with VREL_EQ (?). You could use that to > optimize things. You're right, at least for irange trio.op1_op2 () in the mult fold_range is VREL_EQ and we could just go from that. For frange perhaps it isn't as perfect because of signed zeros, so in float foo (float x, float y) { if (x =3D=3D y) return x * y; return 42.0f; } trio.op1_op2 () could be VREL_EQ even if one is signed and the other unsign= ed zero, and in that case -0.0 would need to be in the range too. But maybe t= hat is good enough for now.=