From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2F777386EC6E; Thu, 18 Jan 2024 13:01:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F777386EC6E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705582896; bh=4vEQlLKmaWkKezhOHcz2TpmY7j7TzfQQ9X/DAe1/d6c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hij1wSLPUVRZSppLkTEl4u7KMpX6hYWILv+85P1Bk42/Ez6ly7zXlY2JvASrtAbtP az1OCFrZcfULXvMPUec17t6ECJbOlf/NA31kJC0PzoMUKH+UbXfnZzve86oNOQa14W eDgNdkE72jPpS2J1ERCkOPJmFhnvYSgnEUXWNjHs= From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113312] Add __attribute__((no_callee_saved_registers)) for Intel FRED Date: Thu, 18 Jan 2024 13:01:34 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools 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=3D113312 --- Comment #23 from H.J. Lu --- (In reply to Xin Li from comment #22) > Per Peter's suggestion, I added __attribute__((no_callee_saved_registers)) > to a linux source tree containing FRED patches: > https://github.com/xinli-intel/linux-fred-public/commit/ > 12c38143a5c33e89f2b3d8906629dd4f23f8d79c. And I compiled the linux code > with a gcc built from > https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/pr113312/gcc-13. >=20 > Following are my observations: > 1) the generated kernel boots fine on both FRED Simics model and bare met= al. > 2) the asm code generated for fred_entry_from_{user,kernel}() are the sam= e, > i.e., __attribute__((no_callee_saved_registers)) makes no difference (Pet= er > said the FRED dispatch points simply do not have significant register > pressure =E2=80=93 intentionally). > 3) other functions with __attribute__((no_callee_saved_registers)) do get > rid of pushing/popping clobbered registers, and cause no issues because t= hey > are top-level functions, only invoked by tail call, meaning the following > case won't happen: >=20 > : > ... > mov (%rbx), %r13 > call foo > mov %rax, (%r13) > ... >=20 > otherwise foo() is NOT a top-level function. Do these mean that __attribute__((no_callee_saved_registers)) works for you? BTW, my patches also avoid saving callee-saved registers in __attribute__((noreturn)) functions.=