From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm64: lse: use register variables instead of -ffixed, -fcall flags
Date: Fri, 10 Aug 2018 10:46:13 +0100 [thread overview]
Message-ID: <20180810094611.GA12273@arm.com> (raw)
In-Reply-To: <20180810020751.44859-1-trong@android.com>
On Thu, Aug 09, 2018 at 07:07:51PM -0700, Tri Vo wrote:
> -ffixed, -fcall-used, -fcall-saved flags are used to build LL/SC
> fallback atomic implementations in such a way that:
> 1. LSE implementations only assume x16, x17, x30 to be clobbered by a
> function call to LL/SC fallbacks.
> 2. LL/SC fallbacks are responsible for saving/restoring the rest of the
> GPRs.
> 3. LL/SC fallbacks always prefer to allocate in x16, x17 since there is
> no need to save/restore them.
>
> Same result can be achieved without -ffixed, -fcall-used, -fcall-saved
> flags by explicitly telling the compiler where to allocate each variable
> in LL/SC atomic implementations. This patch makes all functions use x16,
> x17 registers. 'fetch' variants of the functions need one more scratch
> register, so we allocate one from the PCS's set of callee-saved
> registers (in this case x19).
>
> With this patch:
> 1. the desired register allocation is reflected in the code rather than
> in compiler flags.
> 2. LSE atomic support can be built with both clang and gcc.
> 3. Number of preserved registers in LL/SC fallbacks is unchanged.
>
> The tradeoff is that the compiler loses flexibility in allocating
> registers for inline LL/SC atomic implementations.
This impacts the atomics code when !CONFIG_LSE, and causes the fetch*
variants to spill x19 in most cases.
Please just fix clang, or augment the lseinstr check in our Makefile to
check for ffixed support as well.
Thanks,
Will
next prev parent reply other threads:[~2018-08-10 9:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 2:07 [RFC PATCH] arm64: lse: use register variables instead of -ffixed, -fcall flags Tri Vo
2018-08-10 9:46 ` Will Deacon [this message]
2018-08-10 22:04 ` Tri Vo
2018-08-13 17:28 ` Will Deacon
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=20180810094611.GA12273@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 NNTP newsgroup(s).