From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E3B2F3858282; Wed, 27 Mar 2024 09:21:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3B2F3858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711531288; bh=2/eHEMZiuP7hUaaVBrUUAFeG57ARDzH5WF6YBTNP7T0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TIKp7L4ukpH8ZRXVllgzCq1UMfhUMg1CcJWOseCMuHqtf9QHBGkMZu3eV/g0B2znj 6kwc0lCBD1sGfUduyEliNr5s2DTA8yaxuIhbV/MH1LD9rXbzUNzgKBFlk2rxa5p/E7 ebT68WjH9VWR36oYPdP6VB/X4ReTrmZeKGDsxcYQ= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114487] ICE when building libsdl2 on -mfpmath=sse x86 with LTO Date: Wed, 27 Mar 2024 09:21:28 +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: 14.0 X-Bugzilla-Keywords: ice-on-valid-code, lto X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114487 --- Comment #2 from Uro=C5=A1 Bizjak --- (In reply to Richard Biener from comment #1) > (insn 6 5 0 (set (reg/v:SF 99 [ gamma ]) > (reg:SF 20 xmm0)) "testautomation-testautomation_pixels.i":15:17 = -1 > (nil)) >=20 > I'm not sure what's wrong - looks like a target issue to me. We are working with SFmode, so -msse is enough to trigger the bug. This is known issue. GCC assumes that at least moves of all hard registers = are working, which is not the case when LTO-compiling testautomation-testautomation_pixels.i with SDL_test_fuzzer.o (that enables= and uses XMM registers via -msse -mfpmath=3Dsse). It looks to me that the compiler hits this part in function_value_32 when LTO-compiling: --cut here-- /* Override FP return register with %xmm0 for local functions when SSE math is enabled or for functions with sseregparm attribute. */ if ((fn || fntype) && (mode =3D=3D SFmode || mode =3D=3D DFmode)) { int sse_level =3D ix86_function_sseregparm (fntype, fn, false); if (sse_level =3D=3D -1) { error ("calling %qD with SSE calling convention without " "SSE/SSE2 enabled", fn); sorry ("this is a GCC bug that can be worked around by adding " "attribute used to function called"); } else if ((sse_level >=3D 1 && mode =3D=3D SFmode) || (sse_level =3D=3D 2 && mode =3D=3D DFmode)) regno =3D FIRST_SSE_REG; } --cut here-- Adding -msse to the second compilation works OK, removing -mfpmath=3Dsse fr= om the first compilation also works OK.=