This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, AArch64, v3 0/6] LSE atomics out-of-line
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <richard dot henderson at linaro dot org>, Kyrylo Tkachov <Kyrylo dot Tkachov at arm dot com>
- Cc: nd <nd at arm dot com>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, "agraf at suse dot de" <agraf at suse dot de>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, James Greenhalgh <James dot Greenhalgh at arm dot com>, Richard Henderson <rth at twiddle dot net>
- Date: Thu, 5 Sep 2019 14:35:51 +0000
- Subject: Re: [PATCH, AArch64, v3 0/6] LSE atomics out-of-line
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J7OHI9s7/t24fSbdSImMLioL6kJe1vjQkxn0Bk6n+44=; b=JsSqmGMVH+vXXueztHbySyPDoETAZEjUkRAUKgXkRPrF4hbN1ms4eL6Sj1xB/2K2MfkypBwVLSAiqB9Gou3MIoigBPde/bS5jgmfUL1d+qWxauaYMtZwQ06WQXoKQtJRSTRwxrf+AbGteUpMKLrbjt+Nsamc8SApYdsOeqnwlF2G2bxyF/II1t7vkol5TkymHgluQLcprHRwIIMMLt0snt/y3MUXr6e5GZZYV4n0eYp9qjHX5Lr+/hBGqA0CbzaBT8Yj0QAbiPIMuG1+crGruy3zPJzSuTfhlphbwLHOVsrvOqsXL2r7OWFjeP6as35ww89DHmPb090fcgdFFE0pkQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+QKw+zePDuyMUYzKL8MnahNuxlS6c6mOug7c7Bbv0UrvoJZ59o9sPjp9989Z64d8upswPs/mVUj80Jxls/l6V3ddFWb731WXFDdp4vt5Xo44fNfLKiNFJs9NQzzprHT/NJsMWx/VCU4AMCFzXkxO1EiSKvC+1NfP8WHseDwQmQiADX7RAdIHsZ89WjLREdv5bW+DkY834QrlWCig4t+BkhU7pX/S8aa3T4oyIMRIhjLdvway/HRUZ3frDO8EGVZ07w2yJC3ftUF9D8nsxG7JsXtj+wtXNTW3oJBU3sGP3GQhl9DGMDmQTXvaEZi9xQHTv1630vx/MBFXobXSSQvWg==
- Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco dot Dijkstra at arm dot com;
Hi Richard,
> What I have not done, but is now a possibility, is to use a custom
> calling convention for the out-of-line routines. I now only clobber
> 2 (or 3, for TImode) temp regs and set a return value.
This would be a great feature to have since it reduces the overhead of
outlining considerably.
> I think this patch series would be great to have for GCC 10!
Agreed. I've got a couple of general comments:
* The option name -matomic-ool sounds too abbreviated. I think eg.
-moutline-atomics is more descriptive and user friendlier.
* Similarly the exported __aa64_have_atomics variable could be named
__aarch64_have_lse_atomics so it's clear that it is about LSE atomics.
+@item -matomic-ool
+@itemx -mno-atomic-ool
+Enable or disable calls to out-of-line helpers to implement atomic operations.
+These helpers will, at runtime, determine if ARMv8.1-Atomics instructions
+should be used; if not, they will use the load/store-exclusive instructions
+that are present in the base ARMv8.0 ISA.
+
+This option is only applicable when compiling for the base ARMv8.0
+instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
+or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
+used directly.
So what is the behaviour when you explicitly select a specific CPU?
+/* Branch to LABEL if LSE is enabled.
+ The branch should be easily predicted, in that it will, after constructors,
+ always branch the same way. The expectation is that systems that implement
+ ARMv8.1-Atomics are "beefier" than those that omit the extension.
+ By arranging for the fall-through path to use load-store-exclusive insns,
+ we aid the branch predictor of the smallest cpus. */
I'd say that by the time GCC10 is released and used in distros, systems without
LSE atomics would be practically non-existent. So we should favour LSE atomics
by default.
Cheers,
Wilco