From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3EC6388B03C; Sun, 21 Jun 2020 15:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3EC6388B03C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592753740; bh=XoanTYbPxQbcFVR+IajKhxLscR19KDlS5j1ypkYvgxE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WdXw8bBqdkTn3rPEyAAzsGVByK4t+xQBmO7Za0WTYIgViIPoLd4zPR8gRM9GfHhfI 8SNpcYrTst+kdBwyl27dgRXUPTLhEDF2d+oLWHNkfn6z2ItVEP5eyUzlOZPigddKgn sOliACPJJIorDhi+CKVzQKVphsUQftmBwCOmf3Bs= From: "wschmidt at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95737] PPC: Unnecessary extsw after negative less than Date: Sun, 21 Jun 2020 15:35:40 +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: 8.3.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: wschmidt at linux dot ibm.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: Sun, 21 Jun 2020 15:35:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95737 --- Comment #4 from wschmidt at linux dot ibm.com --- On 6/19/20 12:43 PM, jens.seifert at de dot ibm.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95737 > > Jens Seifert changed: > > What |Removed |Added > -------------------------------------------------------------------------= --- > Status|RESOLVED |UNCONFIRMED > Resolution|DUPLICATE |--- > > --- Comment #3 from Jens Seifert --- > This is different as the extsw also happens if the result gets used e.g. > followed by a andc, which is my case. I obviously oversimplified the samp= le. It > has nothing to do with function result and ABI requirements. gcc assume t= hat > the result of -(a < b) implemented by subfc, subfe is signed 32-bit. But = the > result is already 64-bit. > > unsigned long long branchlesconditional(unsigned long long a, unsigned lo= ng > long b, unsigned long long c) > { > unsigned long long mask =3D -(a < b); > return c &~ mask; > } > > results in > > _Z20branchlesconditionalyyy: > .LFB1: > .cfi_startproc > subfc 4,4,3 > subfe 3,3,3 > not 3,3 > extsw 3,3 > and 3,3,5 > blr > > expected > subfc > subfe > andc > Thanks for verifying, Jens!=