public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-113312-4-aLTtxkklqD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113312-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113312

--- Comment #23 from H.J. Lu <hjl.tools at gmail dot com> ---
(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.
> 
> 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
> pressure – intentionally).
> 3) other functions with __attribute__((no_callee_saved_registers)) do get
> rid 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:
> 
> <func>:
> ...
> mov (%rbx), %r13
> call foo
> mov %rax, (%r13)
> ...
> 
> 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.

  parent reply	other threads:[~2024-01-18 13:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 16:28 [Bug target/113312] New: Update __attribute__((interrupt)) " hjl.tools at gmail dot com
2024-01-11  1:39 ` [Bug target/113312] " hpa at zytor dot com
2024-01-11  1:48 ` hjl.tools at gmail dot com
2024-01-11  2:10 ` hpa at zytor dot com
2024-01-11  2:10 ` hpa at zytor dot com
2024-01-11  2:19 ` hjl.tools at gmail dot com
2024-01-11  2:35 ` hpa at zytor dot com
2024-01-11  4:09 ` hjl.tools at gmail dot com
2024-01-11  4:10 ` hjl.tools at gmail dot com
2024-01-11  4:11 ` hjl.tools at gmail dot com
2024-01-11  5:29 ` hpa at zytor dot com
2024-01-11  5:38 ` liuhongt at gcc dot gnu.org
2024-01-11 15:47 ` fw at gcc dot gnu.org
2024-01-11 15:55 ` hpa at zytor dot com
2024-01-12  1:00 ` hjl.tools at gmail dot com
2024-01-12  1:25 ` hpa at zytor dot com
2024-01-12  4:31 ` hjl.tools at gmail dot com
2024-01-13  5:03 ` hjl.tools at gmail dot com
2024-01-13 18:25 ` hjl.tools at gmail dot com
2024-01-13 20:02 ` hpa at zytor dot com
2024-01-13 20:22 ` hjl.tools at gmail dot com
2024-01-13 20:51 ` hpa at zytor dot com
2024-01-18  6:42 ` [Bug target/113312] Add __attribute__((no_callee_saved_registers)) " xin at zytor dot com
2024-01-18 13:01 ` hjl.tools at gmail dot com [this message]
2024-01-19  6:23 ` xin at zytor dot com
2024-01-19  6:25 ` xin at zytor dot com
2024-01-19 13:40 ` hjl.tools at gmail dot com
2024-01-27 12:19 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113312-4-aLTtxkklqD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).