From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A1143858CDB; Thu, 18 Jan 2024 06:42:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A1143858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705560149; bh=RAGDu391NFXfKSiV4ojeglCNuw40ZBntKcYtcC5zfWA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LTfYtITL3z+HOHdvP9HHpl8BoDccFjm3qGEHp48tbBW1slDF+P65DyEOxFj/NPiBf xsK0NPFXByhpfhfm61Ka2TYvIYCEBrnkvlZGSmUB4DKydYDecr+1Do/mznL2r69dwZ x1bghStPGVDyRmFvfzvZz1BGfpyFG/KNHHUmAC8k= 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: Thu, 18 Jan 2024 06:42:29 +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: cc 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 Xin Li changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xin at zytor dot com --- Comment #22 from Xin Li --- 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/12c38143a5c33e89f2b= 3d8906629dd4f23f8d79c. And I compiled the linux code with a gcc built from https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/pr113312/gcc-13. Following are my observations: 1) the generated kernel boots fine on both FRED Simics model and bare metal. 2) the asm code generated for fred_entry_from_{user,kernel}() are the same, i.e., __attribute__((no_callee_saved_registers)) makes no difference (Peter said the FRED dispatch points simply do not have significant register press= ure =E2=80=93 intentionally). 3) other functions with __attribute__((no_callee_saved_registers)) do get r= id of pushing/popping clobbered registers, and cause no issues because they are top-level functions, only invoked by tail call, meaning the following case won't happen: : ... mov (%rbx), %r13 call foo mov %rax, (%r13) ... otherwise foo() is NOT a top-level function.=