From: Christophe Lyon <christophe.lyon@linaro.org>
To: gcc-patches@gcc.gnu.org, kyrylo.tkachov@arm.com,
richard.earnshaw@arm.com, Mike Stump <mikestump@comcast.net>
Subject: Re: [PATCH 1/2] testsuite: Add and use thread_fence effective-target
Date: Mon, 2 Oct 2023 10:24:18 +0200 [thread overview]
Message-ID: <CAPS5khYTLuTWv0sVSwXo=-7T982EiEaWwE+-OKSRLZxu7VSVug@mail.gmail.com> (raw)
In-Reply-To: <20230910193045.3549775-1-christophe.lyon@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3955 bytes --]
ping?
On Sun, 10 Sept 2023 at 21:31, Christophe Lyon <christophe.lyon@linaro.org>
wrote:
> Some targets like arm-eabi with newlib and default settings rely on
> __sync_synchronize() to ensure synchronization. Newlib does not
> implement it by default, to make users aware they have to take special
> care.
>
> This makes a few tests fail to link.
>
> This patch adds a new thread_fence effective target (similar to the
> corresponding one in libstdc++ testsuite), and uses it in the tests
> that need it, making them UNSUPPORTED instead of FAIL and UNRESOLVED.
>
> 2023-09-10 Christophe Lyon <christophe.lyon@linaro.org>
>
> gcc/
> * doc/sourcebuild.texi (Other attributes): Document thread_fence
> effective-target.
>
> gcc/testsuite/
> * g++.dg/init/array54.C: Require thread_fence.
> * gcc.dg/c2x-nullptr-1.c: Likewise.
> * gcc.dg/pr103721-2.c: Likewise.
> * lib/target-supports.exp (check_effective_target_thread_fence):
> New.
> ---
> gcc/doc/sourcebuild.texi | 4 ++++
> gcc/testsuite/g++.dg/init/array54.C | 1 +
> gcc/testsuite/gcc.dg/c2x-nullptr-1.c | 1 +
> gcc/testsuite/gcc.dg/pr103721-2.c | 1 +
> gcc/testsuite/lib/target-supports.exp | 12 ++++++++++++
> 5 files changed, 19 insertions(+)
>
> diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> index 1a78b3c1abb..a5f61c29f3b 100644
> --- a/gcc/doc/sourcebuild.texi
> +++ b/gcc/doc/sourcebuild.texi
> @@ -2860,6 +2860,10 @@ Compiler has been configured to support link-time
> optimization (LTO).
> Compiler and linker support link-time optimization relocatable linking
> with @option{-r} and @option{-flto} options.
>
> +@item thread_fence
> +Target implements @code{__atomic_thread_fence} without relying on
> +non-implemented @code{__sync_synchronize()}.
> +
> @item naked_functions
> Target supports the @code{naked} function attribute.
>
> diff --git a/gcc/testsuite/g++.dg/init/array54.C
> b/gcc/testsuite/g++.dg/init/array54.C
> index f6be350ba72..5241e451d6d 100644
> --- a/gcc/testsuite/g++.dg/init/array54.C
> +++ b/gcc/testsuite/g++.dg/init/array54.C
> @@ -1,5 +1,6 @@
> // PR c++/90947
> // { dg-do run { target c++11 } }
> +// { dg-require-effective-target thread_fence }
>
> #include <atomic>
>
> diff --git a/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
> b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
> index 4e440234d52..97a31c27409 100644
> --- a/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
> +++ b/gcc/testsuite/gcc.dg/c2x-nullptr-1.c
> @@ -1,5 +1,6 @@
> /* Test valid usage of C23 nullptr. */
> /* { dg-do run } */
> +// { dg-require-effective-target thread_fence }
> /* { dg-options "-std=c2x -pedantic-errors -Wall -Wextra
> -Wno-unused-variable" } */
>
> #include <stdarg.h>
> diff --git a/gcc/testsuite/gcc.dg/pr103721-2.c
> b/gcc/testsuite/gcc.dg/pr103721-2.c
> index aefa1f0f147..e059b1cfc2d 100644
> --- a/gcc/testsuite/gcc.dg/pr103721-2.c
> +++ b/gcc/testsuite/gcc.dg/pr103721-2.c
> @@ -1,4 +1,5 @@
> // { dg-do run }
> +// { dg-require-effective-target thread_fence }
> // { dg-options "-O2" }
>
> extern void abort ();
> diff --git a/gcc/testsuite/lib/target-supports.exp
> b/gcc/testsuite/lib/target-supports.exp
> index d353cc0aaf0..7ac9e7530cc 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -9107,6 +9107,18 @@ proc check_effective_target_sync_char_short { } {
> || [check_effective_target_mips_llsc] }}]
> }
>
> +# Return 1 if thread_fence does not rely on __sync_synchronize
> +# library function
> +
> +proc check_effective_target_thread_fence {} {
> + return [check_no_compiler_messages thread_fence executable {
> + int main () {
> + __atomic_thread_fence (__ATOMIC_SEQ_CST);
> + return 0;
> + }
> + } ""]
> +}
> +
> # Return 1 if the target uses a ColdFire FPU.
>
> proc check_effective_target_coldfire_fpu { } {
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2023-10-02 8:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-10 19:30 Christophe Lyon
2023-09-10 19:30 ` [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests Christophe Lyon
2023-09-11 10:59 ` Jonathan Wakely
2023-09-11 12:36 ` Christophe Lyon
2023-09-11 13:10 ` Jonathan Wakely
2023-09-11 13:57 ` Christophe Lyon
2023-09-11 15:22 ` Jonathan Wakely
2023-09-11 15:27 ` Richard Earnshaw (lists)
2023-09-11 15:39 ` Christophe Lyon
2023-09-11 16:11 ` Jonathan Wakely
2023-09-12 7:59 ` Christophe Lyon
2023-09-12 9:07 ` Jonathan Wakely
2023-09-13 15:37 ` Christophe Lyon
2023-09-13 15:56 ` Jonathan Wakely
2023-09-14 9:09 ` [PATCH v2 " Christophe Lyon
2023-09-14 9:25 ` Jonathan Wakely
2023-10-02 8:24 ` Christophe Lyon [this message]
2023-10-24 10:43 ` [PATCH 1/2] testsuite: Add and use thread_fence effective-target Christophe Lyon
2023-11-05 20:43 ` Mike Stump
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='CAPS5khYTLuTWv0sVSwXo=-7T982EiEaWwE+-OKSRLZxu7VSVug@mail.gmail.com' \
--to=christophe.lyon@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=kyrylo.tkachov@arm.com \
--cc=mikestump@comcast.net \
--cc=richard.earnshaw@arm.com \
/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).