From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 90DD438930F9; Mon, 4 May 2020 16:54:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90DD438930F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588611258; bh=jOBvNoveec0V0ACVepz+zwXws4IkV+D7DUh4SzZ7ZC0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GpxrXuMts4zZY1m8rcFzjlI2N6QJQYoByiqiodpqGL994lHj3BF9RkSGdTKqAm1eb 3StdvyZTMPNdnlddtFkmHQWONeUNoWUn7Kj+Yl9aK/2zDvb6LY57TRYPQla73ndnmP eBE4d0iVkA6Z0vbXdMA7SI8Y/rTtEW+I5BFGTDFk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94795] Failure to use fast sbb method on x86 for spreading any set bit to all bits Date: Mon, 04 May 2020 16:54:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ubizjak at gmail dot com 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: Mon, 04 May 2020 16:54:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94795 --- Comment #5 from CVS Commits --- The master branch has been updated by Uros Bizjak : https://gcc.gnu.org/g:9decd08b7b153a593a0b61e4f5373cb9574a1973 commit r11-45-g9decd08b7b153a593a0b61e4f5373cb9574a1973 Author: Uros Bizjak Date: Mon May 4 18:53:30 2020 +0200 i386: Use SBB more [PR94650] When returning 0 or -1, "SBB reg,reg" instruction that borrows carry flag can be used. Carry flag can be generated by converting compare with zero to a LTU compare with one, so e.g. return -(x =3D=3D 0) generates: cmpq $1, %rdi sbbq %rax, %rax instead of: xorl %eax, %eax testq %rdi, %rdi sete %al negq %rax A similar conversion can be used for return -(x !=3D 0) where NEG insn can be used instead of compare. According to x86 ISA, NEG insn sets carry flag when the source operand is !=3D 0, resulting i= n: negq %rdi sbbq %rax, %rax The conversion avoids partial register stall with SETcc instructions. PR target/94795 * config/i386/i386.md (*neg_ccc): New insn pattern. (EQ compare->LTU compare splitter): New splitter. (NE compare->NEG splitter): Ditto. testsuite/ChangeLog: PR target/94795 * gcc.target/i386/pr94795-1.c: New test. * gcc.target/i386/pr94795-2.c: New test.=