From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4FACB3858D28; Wed, 9 Nov 2022 18:35:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FACB3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668018958; bh=PwelN+qlxecBErwo/mYIFlXcLISCfUFIIYHI25bZM+I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AwaehmBgjuhvkuiOecpccYYBVu4++cj2bVtihfLdiPXmMI348iuKnDSdrxo+cejB0 dEJWsQCLjdaF2getpaBOian4tmUezJ5hY1Mtg8rRnNF7ZYCZHTdie6xosvxEKjHdi2 awBdd1BYKo1S7qSfRgaz09lgQOtSKA3C4dHLMf8g= 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 18:35:58 +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: missed-optimization 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 #12 from Jakub Jelinek --- (In reply to Andrew Macleod from comment #11) > no, I meant in addition to the VREL_EQ. so=20 > if (rel =3D=3D VREL_EQ && op1_range !=3D op2_range) > then you know you have something like if (x =3D=3D y) z=3Dx*y and m= ay have > to check for various signed zero cobinations in each range,=20 > whereas is op1_range =3D=3D op2_range in this case, it should be perfectl= y safe.. I don't understand. Let's modify the testcase to: float foo (float x, y) { if (x < -13.f || x > 26.f) return -1.0f; if (y < -13.f || y > 26.f) return -1.0f; if (x =3D=3D y) return x * y; return 42.0f; } I'd expect that fold_range on the x * y should see trio.op1_op2 () =3D=3D V= REL_EQ because of the guarding x =3D=3D y condition. And the ranges of both are [= -13.f, 26.f] +-NAN too. Still, x could be -0.0f and y 0.0f or vice versa, and so x * y could be -0.0f, so we need [-0.f, 676.f] +-NAN. While if it is x * x= , we know the result will have always sign bit of 0 (except if NAN), so [0.f, 67= 6.f] +-NAN.=