From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C150385842C; Wed, 4 Oct 2023 19:09:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C150385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696446566; bh=Uj/GtIc/k1+64Wtif5RKI7m0uuFjlruU8hNPo15NLLw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xW97QIpgd4k2x1RN0JP65BDH/HOCf8EoHiB3SLmkmiabfQu134I4No8ZwY8vsQ4Zf SNjG+ntE4pV5Nom9rrlMkGekL5XRJ6u+0xW8tIt1cmnbmQGC4L5s/Zdm0xzn5AGLb7 FAY8r3DwxGUlYf0VRn3tVdBEn0CWoY7exmeDsvuc= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111694] [13/14 Regression] Wrong behavior for signbit of negative zero when optimizing Date: Wed, 04 Oct 2023 19:09:25 +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.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone everconfirmed cf_reconfirmed_on bug_status 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=3D111694 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 Ever confirmed|0 |1 Last reconfirmed| |2023-10-04 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski --- Confirmed.=20 EVRP removes the second __bultin_signbit incorrectly. Most likely due to: ``` Folding statement: if (_3 !=3D 0) Registering value_relation (l_11(D) =3D=3D r_12(D)) on (2->3) ``` which then we get: ``` Predicate evaluates to: DON'T KNOW Matching expression match.pd:2679, gimple-match-2.cc:35 Matching expression match.pd:2682, gimple-match-1.cc:66 Matching expression match.pd:2689, gimple-match-2.cc:96 Not folded Folding statement: _20 =3D __builtin_signbit (r_12(D)); Queued stmt for removal. Folds to: 0 Folding statement: if (_20 !=3D 0) gimple_simplified to if (0 !=3D 0) gimple_simplified to if (0 !=3D 0) Folded into: if (0 !=3D 0) ``` For -O1 DOM does: ``` 1>>> STMT 1 =3D _8 le_expr 0 1>>> STMT 1 =3D _8 ge_expr 0 1>>> STMT 1 =3D _8 eq_expr 0 1>>> STMT 0 =3D _8 ne_expr 0 0>>> COPY _8 =3D 0 Optimizing statement _10 =3D __builtin_signbit (r_6(D)); Replaced 'r_6(D)' with constant '0.0' gimple_simplified to _10 =3D 0; Folded to: _10 =3D 0; LKUP STMT _10 =3D 0 =3D=3D=3D=3D ASGN _10 =3D 0 Optimizing statement if (_10 !=3D 0) Replaced '_10' with constant '0' gimple_simplified to if (0 !=3D 0) Folded to: if (0 !=3D 0) LKUP STMT 0 ne_expr 0 <<<< STMT 0 =3D _8 ne_expr 0 <<<< STMT 1 =3D _8 eq_expr 0 <<<< STMT 1 =3D _8 ge_expr 0 <<<< STMT 1 =3D _8 le_expr 0 <<<< COPY _8 =3D 0 ``` Which is wrong too.=