From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A3B6B3839DF9; Mon, 13 Feb 2023 20:36:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3B6B3839DF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676320583; bh=wSnWWbjXWPAIVRrElOx3eHygy37ZAPpYX82BGOimRDA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r6tYeG7aBhPF4Z6s1sTEwrJC/K4e9ffohjei31+Yq1YWFswDRKC9oO4LQ/sVbFAz7 PlYv3yENQFycBJXOpCUrvd1h5PdRxTquK2zuKGT3XSOWI19HzppZkjD5lKDpmtV1vl jBBjKtCuNQ+NkQsZrre5iy3+Wy+GGk/TvplCpsFQ= From: "chip.kerchner at ibm dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/108757] We do not simplify (a - (N*M)) / N + M -> a / N Date: Mon, 13 Feb 2023 20:36:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: chip.kerchner at ibm dot com 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=3D108757 --- Comment #15 from Chip Kerchner --- How about this (from Peter's testcase)? Does it still have issues? It produces the same assembly. #define N 32 #define M 2 unsigned long int foo (unsigned long int a) { return (a - (N*M)) / N + M; }=