From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 59D543858C5E; Thu, 2 Mar 2023 23:21:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59D543858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677799299; bh=unO2V4CGVjMMrswtjrN48RYlawk+FavcMmncQn5dDFM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UPN41/J5Yg8Ld7GaSy8QzdfOhXVC1ya0vJKEapZzjq8Ha+4qw4UvPp3HlWm1dOfcx kfSeXT/NPRD3PX9AoDxMOrT2KCoEbA8jIL3lT0PNN0yv47y0hZk2uQ2hsqw+D9/vPs +4+lDXxb0G7V3bEODzwlqwnQ1eKtFYgAxcPKcfb8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108990] Too restrictive precision check in fold and simplify pattern for PR70920 Date: Thu, 02 Mar 2023 23:21:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords bug_status everconfirmed see_also cf_reconfirmed_on bug_severity 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=3D108990 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D70920 Last reconfirmed| |2023-03-02 Severity|normal |enhancement --- Comment #1 from Andrew Pinski --- There are other patterns which handle different precision integeral types though. e.g. match.pd:5780 /* If possible, express the comparison in the shorter mode. */ (if ((cmp =3D=3D EQ_EXPR || cmp =3D=3D NE_EXPR || TYPE_UNSIGNED (TREE_TYPE (@0)) =3D=3D TYPE_UNSIGNED (TREE_TYP= E (@00)) || (!TYPE_UNSIGNED (TREE_TYPE (@0)) && TYPE_UNSIGNED (TREE_TYPE (@00)))) && (types_match (TREE_TYPE (@10), TREE_TYPE (@00)) || ((TYPE_PRECISION (TREE_TYPE (@00)) >=3D TYPE_PRECISION (TREE_TYPE (@10))) && (TYPE_UNSIGNED (TREE_TYPE (@00)) =3D=3D TYPE_UNSIGNED (TREE_TYPE (@10)))) || (TREE_CODE (@10) =3D=3D INTEGER_CST && INTEGRAL_TYPE_P (TREE_TYPE (@00)) && int_fits_type_p (@10, TREE_TYPE (@00))))) (cmp @00 (convert @10)) I wonder if the pattern for PR 70920 should be combined with the above one = and fixed up.=