From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E8FF93858C54; Wed, 24 Aug 2022 10:02:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8FF93858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661335370; bh=WR1M2qwC/VP/eTxveEEumIv3wfo4+yTWkuKZ/mfAqOE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ho7ttEQIgCP95TRQO/tbIBW5EbaJwlPWc3I0A95gMAcQFGB2EcFKT61Wr9ufNRqxj obhFZBMX5+n7petSFag5WbKkISdhC4udZA1WSvm6ZZ8JsSl9eawMCEN2VmxRTdyP3k wGJf/rujGCyWmUI0DuhGceBJYLQQWPFT+7Nofp2k= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106701] Compiler does not take into account number range limitation to avoid subtract from immediate Date: Wed, 24 Aug 2022 10:02:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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=3D106701 --- Comment #2 from Richard Biener --- I'd say all single-operation magic shouldn't happen in match.pd, this really looks like something for RTL expansion to decide. For example some targets might have instructions that can either do cst - a or cst ^ a with an immed= iate (when integer_pow2p (cst + 1)). match.pd should be about canonicalization here (none of the two is "simpler= "), but canonicalization based on value-range looks a bit iffy.=