From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B96FE38930D0; Wed, 29 Apr 2020 12:12:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B96FE38930D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588162349; bh=8g6xdGOIu6fE+4NtdySKVGO56WFdnHtA6hxOY+sXRTc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UDD8TSUy/K//VHv3YGkFu5+exwXCtXiGdFXddzxU+hlmM/eOyObSz/cCfWrjVIpQ+ TfKKa72irniWfhtDu4t4wzUoVBgPCfG/XSEmrY3QSo+uMWDcgUi6yfCSY28k4LEWG4 1x9Krn5DT7tN1ODgiHYkQKUhA/rUIz6Ve/UqcOAM= From: "gabravier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94846] Failure to optimize jnc+inc into adc Date: Wed, 29 Apr 2020 12:12:29 +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: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gabravier at gmail 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: cf_gcctarget 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 12:12:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94846 Gabriel Ravier changed: What |Removed |Added ---------------------------------------------------------------------------- Target|x86_64-* i?86-*-* | --- Comment #1 from Gabriel Ravier --- Some extra notes :=20 This also occurs on i?86. This is the LLVM output : f(unsigned int*, unsigned int): # @f(unsigned int*, unsigned int) mov ecx, dword ptr [esp + 4] mov eax, dword ptr [ecx] add eax, dword ptr [esp + 8] adc eax, 0 mov dword ptr [ecx], eax ret This is the GCC output : f(unsigned int*, unsigned int): mov edx, DWORD PTR [esp+4] mov eax, DWORD PTR [edx] add eax, DWORD PTR [esp+8] jnc .L6 add eax, 1 .L6: mov DWORD PTR [edx], eax ret This also occurs on aarch64. This is the LLVM output :=20 f(unsigned int*, unsigned int): // @f(unsigned int*, unsigned int) ldr w8, [x0] adds w8, w8, w1 cinc w8, w8, hs str w8, [x0] mov w0, w8 ret This is the GCC output (as of GCC 9.2, didn't have the time to check GCC 10= for aarch64 ) : f: ldr w2, [x0] mov x3, x0 adds w0, w2, w1 bcc .L6 add w0, w0, 1 .L6: str w0, [x3] ret=