From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 044AC3851C26; Fri, 19 Jun 2020 17:43:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 044AC3851C26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592588596; bh=d6PmvwUyY+pRwxKnoVpCAbzKVZYMP0iQmA94DU9u5+k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EjHLER1TxEVCp8iDAdy7tjlUnE0LN5Y2hQ5ghukVVSXESME/MRjOTfT7CkbPa/pFn 8P0rYG8EGDO0V5GdGNyCbjHI8lVN0CqREqx9eWRKi3n+XGRR5A2HU2EeovoMPUSvgc M4bPGTbETePFbCKcJK8K+Jsaxdydab/GX5HnADdY= From: "jens.seifert at de dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95737] PPC: Unnecessary extsw after negative less than Date: Fri, 19 Jun 2020 17:43:15 +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: jens.seifert at de 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: bug_status resolution 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: Fri, 19 Jun 2020 17:43:16 -0000 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 sample= . It has nothing to do with function result and ABI requirements. gcc assume that 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 long 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=