From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 146303894C18; Thu, 11 Mar 2021 23:35:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 146303894C18 From: "unlvsur at live dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99548] Help me! Lost the fight against the compiler. Date: Thu, 11 Mar 2021 23:35:52 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: unlvsur at live 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 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: Thu, 11 Mar 2021 23:35:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99548 --- Comment #2 from cqwrteur --- (In reply to Andrew Pinski from comment #1) > For aarch64 we get: > ldp x4, x3, [x1] > mov x7, 38 > ldp x6, x5, [x2] > ldr x8, [x1, 16] > add x6, x4, x6 > cmp x4, x6 > adc x5, x3, x5 > cmp x3, x5 > ldr x3, [x1, 24] > ldp x4, x1, [x2, 16] > adc x4, x8, x4 > cmp x8, x4 > adc x1, x3, x1 > cmp x3, x1 > csetm x2, cs > and x2, x2, x7 > add x2, x2, x6 > cmp x2, x6 > cinc x6, x5, ls > cmp x6, x5 > cinc x5, x4, ls > cmp x5, x4 > cinc x3, x1, ls > cmp x3, x1 > csetm x1, ls > and x1, x1, x7 > add x1, x1, x2 > str x1, [x0] > cmp x1, x2 > cinc x1, x6, ls > str x1, [x0, 8] > cmp x1, x6 > cinc x1, x5, ls > cmp x1, x5 > cinc x3, x3, ls > stp x1, x3, [x0, 16] > ret > There is only one missing optimization there really: > csetm x1, ls > and x1, x1, x7 > Should be turned into: > csel x1, x7, xzw, ls > Which is repeated a few times. >=20 > It looks like x86_64 has other issues. my add carry implementation for none-x86_64 platforms is wrong on godbolt.=