From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E2653858C60; Fri, 19 Jan 2024 06:23:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E2653858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705645438; bh=rrmuujdOlzav/OVsOo+RxTZ23LM7dcg/Qkoyb/ZdRW0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tnbgcLUK79a+lZ+vnlFNACiu28Li73k8af/iRKWP4zSgvRYb5fP6BsuvictlAbOu7 0T8+P9tZ39JOxhf3mbFU/wvKClbp6Wh06snfqM8nLZtb1ikKcd2hewFsAmWR9nqUTv +S6HlOrAPCYWmvMZ18hJENvAB0rilVcAweLpGnf4= From: "xin at zytor dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113312] Add __attribute__((no_callee_saved_registers)) for Intel FRED Date: Fri, 19 Jan 2024 06:23:58 +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: xin at zytor 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 #24 from Xin Li --- (In reply to H.J. Lu from comment #23) > (In reply to Xin Li from comment #22) > > Per Peter's suggestion, I added __attribute__((no_callee_saved_register= s)) > > 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 m= etal. > > 2) the asm code generated for fred_entry_from_{user,kernel}() are the s= ame, > > i.e., __attribute__((no_callee_saved_registers)) makes no difference (P= eter > > 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 g= et > > rid of pushing/popping clobbered registers, and cause no issues because= they > > are top-level functions, only invoked by tail call, meaning the followi= ng > > case won't happen: > >=20 > > : > > ... > > mov (%rbx), %r13 > > call foo > > mov %rax, (%r13) > > ... > >=20 > > otherwise foo() is NOT a top-level function. >=20 > Do these mean that __attribute__((no_callee_saved_registers)) works for y= ou? Yes, it works as expected. > BTW, my patches also avoid saving callee-saved registers in > __attribute__((noreturn)) > functions. I also checked do_exit, which is the same as what you posted.=