From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6DB983858430; Tue, 16 Nov 2021 12:06:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DB983858430 From: "jason at zx2c4 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103252] questionable codegen with kmovd Date: Tue, 16 Nov 2021 12:06:23 +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: NEW 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: Tue, 16 Nov 2021 12:06:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103252 --- Comment #9 from Jason A. Donenfeld --- > When the mask registers are available for use, RA considers them and whe= n spilling to those is cheaper than to memory, it spills to them and not me= mory. Yes, this is the thing I don't get. When you compare the codegen for avx512= vs non-avx512, the non-avx512 doesn't spill at all there. So this isn't "spill= to memory" vs "spill to mask register". This is "don't spill" vs "spill to mask register". And the latter seems clearly worse. ------------- (As an aside, Agner reports a certain "fast forwarding" on Tigerlake+, with zero latency write-to-read for certain addresses, with stack computations b= eing easy ones. Looking at 'MOV r32,[m32]+MOV [m32],r32' here:=20 http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00506E3_Skylake2_In= stLatX64.txt http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00606A6_ICX_InstLat= X64.txt http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00806C1_TigerLake3_= InstLatX64.txt http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel0090672_AlderLake_B= C_AVX512_InstLatX64.txt you can see the huge reduction on Tigerlake and Alderlake. This is totally irrelevant and immaterial for the purposes of this bug report, but I idly wonder if at some point there'll be a slightly different cost model for this between Icelake and Tigerlake+.)=