From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E18D3844748; Tue, 14 May 2024 09:45:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E18D3844748 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715679936; bh=OCCZ94ZZW84yl5adOK1+QzkAmIpmujU7l436XkgG0Vs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=maEqKL0Ujw4Oc8uhEwJ/8/wr193wSixjB7IpOZmLWA/hoplOOCBlWmPzGPtIsozKG re0MXTpLE0LjYxyJ+kM6sH8SNaPZ0wOFWZNowL4ebFMJnACELubR70jkb/F5/COSme ZR+nHlJcvF+GrF6TGAwnVOvytpFcPiHfmSrnpJd0= From: "kamkaz at windowslive dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115084] Missed optimization in division for AVR target, not using __*divmodpsi4 Date: Tue, 14 May 2024 09:45:36 +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: 14.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: kamkaz at windowslive dot com 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=3D115084 --- Comment #2 from Kamil Kaznowski --- (In reply to Andrew Pinski from comment #1) > There is another bug dealing with division and truncation that was just > filed. It is a generic (non-avr) issue. I assume you mentioned this bug here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115036 It is not quite the same, since here we are dealing with literals. In case = of literals, it is an existing optimization. #include uint16_t functino(uint16_t num) { return (7500ULL) / num; } This snippet, even compiled with `avr-gcc -O0`, will use __udivmodhi4, 16-b= it routine. It seems that 24-bit routines are simply not considered, unless the operands are specifically typed __(u)int24.=