From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 23C323858D39; Tue, 20 Dec 2022 03:59:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23C323858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671508784; bh=jWPjRHObg9IwWG3O/8lx1GqwuxTTKFI1pDz8mOsDOro=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gjiaxEpI2+YW9sLuDala/hKKvIYPkhW5zEP4xL117vlJXKR6fBSCd/UVylT5TS/bh xshs8zJnxhZBfMjk22Qn6Ku+s5zeG0louyWaClq7NHsShpJls7fr/WvQFV3n905TYz eChSTyK3vM2K3kN9Q3JltG0OfyehB0OM4nadGvnE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103743] PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part Date: Tue, 20 Dec 2022 03:59:43 +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.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: guojiufu 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103743 --- Comment #7 from CVS Commits --- The master branch has been updated by Jiu Fu Guo : https://gcc.gnu.org/g:1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca commit r13-4803-g1060cd2ad00b5174f4f8ef8ca3d8c283e321ffca Author: Jiufu Guo Date: Tue Dec 20 11:43:57 2022 +0800 rs6000: Optimize cmp on rotated 16bits constant Hi, When checking eq/ne with a constant which has only 16bits, it can be optimized to check the rotated data. By this, the constant building is optimized. As the example in PR103743: For "in =3D=3D 0x8000000000000000LL", this patch generates: rotldi 3,3,1 ; cmpldi 0,3,1 instead of: li 9,-1 ; rldicr 9,9,0,0 ; cmpd 0,3,9 Compare with previous version: https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600475.html. This patch refactor the code according to review comments. e.g. updating function names/comments/code. This patch pass bootstrap and regtest on ppc64 and ppc64le. Is it ok for trunk? Thanks for comments! BR, Jeff(Jiufu) PR target/103743 gcc/ChangeLog: * config/rs6000/rs6000-protos.h (can_be_rotated_to_lowbits): Ne= w. (can_be_rotated_to_positive_16bits): New. (can_be_rotated_to_negative_15bits): New. * config/rs6000/rs6000.cc (can_be_rotated_to_lowbits): New definition. (can_be_rotated_to_positive_16bits): New definition. (can_be_rotated_to_negative_15bits): New definition. * config/rs6000/rs6000.md (*rotate_on_cmpdi): New define_insn_and_split. (eqne): Move earlier. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr103743.c: New test. * gcc.target/powerpc/pr103743_1.c: New test.=