From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6D6B63858020; Mon, 15 Nov 2021 18:07:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D6B63858020 From: "jason at zx2c4 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103252] questionable codegen with kmovd Date: Mon, 15 Nov 2021 18:07:10 +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: 11.2.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at zx2c4 dot 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: Mon, 15 Nov 2021 18:07:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103252 --- Comment #5 from Jason A. Donenfeld --- > This one is fine/ok as GCC is using k0 as a spill register rather than sp= illing to memory. 32bit x86 has limited registers and all. There is nothing= odd about this one even. Right, okay, I see what's happening there. I suppose it's a point of debate= as to whether using k0 is actually faster than having the frontend optimize aw= ay the stack access or whether it misses that and there's a memory latency pen= alty for spilling. Presumably the risk of penalty is too high, I guess. For the original example, though, it doesn't seem to even be saving a spill. The non-k0 code is clearly better than the k0 code. I don't know much about= how the allocator works and interacts with various passes of the optimizer, but= I wonder if spilling to a mask register should have a higher weight than spil= ling to a gpr?=