From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 922713858D35; Thu, 16 Dec 2021 06:46:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 922713858D35 From: "jens.seifert at de dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103743] New: PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part Date: Thu, 16 Dec 2021 06:46:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 8.3.1 X-Bugzilla-Keywords: 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 16 Dec 2021 06:46:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103743 Bug ID: 103743 Summary: PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jens.seifert at de dot ibm.com Target Milestone: --- int overflow(); int negOverflow(long long in) { if (in =3D=3D 0x8000000000000000LL) { return overflow(); } return 0; } Generates: negOverflow(long long): .quad .L.negOverflow(long long),.TOC.@tocbase,0 .L.negOverflow(long long): li 9,-1 rldicr 9,9,0,0 cmpd 0,3,9 beq 0,.L10 li 3,0 blr .L10: mflr 0 std 0,16(1) stdu 1,-112(1) bl overflow() nop addi 1,1,112 ld 0,16(1) mtlr 0 blr .long 0 .byte 0,9,0,1,128,0,0,0 Instead of: li 9,-1 rldicr 9,9,0,0 cmpd 0,3,9 Expected output: rotldi 3,3,1 cmpdi 0,3,1 This should be only applied if constant fits into 16-bit and if those 16-bit are in the first 32-bit.=