From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] __atomic_test_and_set: Fall back to library, not non-atomic code
Date: Tue, 26 Sep 2023 09:23:56 -0600 [thread overview]
Message-ID: <02f7abe5-5612-4508-9047-16f924e3246b@gmail.com> (raw)
In-Reply-To: <20230926143439.B589920431@pchp3.se.axis.com>
On 9/26/23 08:34, Hans-Peter Nilsson wrote:
> Tested cris-elf, native x86_64-pc-linux-gnu and arm-eabi.
>
> For arm-eabi, notably lacking any atomic support for the
> default multilib, with --target_board=arm-sim it regressed
> 29_atomics/atomic_flag/cons/value_init.cc with the expected
> linker failure due to lack of __atomic_test_and_set - which
> is a good thing. With this one, there are 44 unexpected
> FAILs for libstdc+++ at r14-4210-g94982a6b9cf4. This number
> was 206 as late as r14-3470-g721f7e2c4e5e, but mitigated by
> r14-3980-g62b29347c38394, deliberately. To fix the
> regression, I'll do the same and follow up with adding
> dg-require-thread-fence on
> 29_atomics/atomic_flag/cons/value_init.cc (and if approved,
> commit it before this one).
>
> Incidentally, the fortran test-results for arm-eabi are
> riddled with missing-__sync_synchronize linker errors
> causing some 18134 unexpected failures, where cris-elf has
> 121.
>
> Ok to commit?
>
> -- >8 --
> Make __atomic_test_and_set consistent with other __atomic_ and __sync_
> builtins: call a matching library function instead of emitting
> non-atomic code when the target has no direct insn support.
>
> There's special-case code handling targetm.atomic_test_and_set_trueval
> != 1 trying a modified maybe_emit_sync_lock_test_and_set. Previously,
> if that worked but its matching emit_store_flag_force returned NULL,
> we'd segfault later on. Now that the caller handles NULL, gcc_assert
> here instead.
>
> While the referenced PR:s are ARM-specific, the issue is general.
>
> PR target/107567
> PR target/109166
> * builtins.cc (expand_builtin) <case BUILT_IN_ATOMIC_TEST_AND_SET>:
> Handle failure from expand_builtin_atomic_test_and_set.
> * optabs.cc (expand_atomic_test_and_set): When all attempts fail to
> generate atomic code through target support, return NULL
> instead of emitting non-atomic code. Also, for code handling
> targetm.atomic_test_and_set_trueval != 1, gcc_assert result
> from calling emit_store_flag_force instead of returning NULL.
OK
jeff
next prev parent reply other threads:[~2023-09-26 15:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 14:34 Hans-Peter Nilsson
2023-09-26 15:23 ` Jeff Law [this message]
2023-10-03 13:20 ` Christophe Lyon
2023-10-03 15:16 ` Hans-Peter Nilsson
[not found] ` <CAPS5khY5fNB+AuOJOJPT7U6SgyfnvBKc+PNE4jY9oVG7UNOTCg@mail.gmail.com>
[not found] ` <20231004004929.9F76B2042E@pchp3.se.axis.com>
2023-10-04 8:53 ` Christophe Lyon
2023-10-04 2:55 ` [PATCH 1/2] testsuite: Add dg-require-atomic-exchange " Hans-Peter Nilsson
2023-10-04 8:13 ` Jonathan Wakely
2023-10-04 3:11 ` [PATCH 2/2] testsuite: Replace many dg-require-thread-fence with dg-require-atomic-exchange Hans-Peter Nilsson
2023-10-04 8:29 ` Jonathan Wakely
2023-10-04 15:15 ` Hans-Peter Nilsson
2023-10-04 16:01 ` Jonathan Wakely
2023-10-04 17:04 ` [PATCH v2 1/2] testsuite: Add dg-require-atomic-cmpxchg-word Hans-Peter Nilsson
2023-10-12 2:21 ` Ping: " Hans-Peter Nilsson
2023-10-12 14:38 ` Christophe Lyon
2023-10-12 16:10 ` Jeff Law
2023-10-12 22:23 ` Jonathan Wakely
2024-02-07 16:31 ` Torbjorn SVENSSON
2024-02-07 16:33 ` Jonathan Wakely
2024-02-07 17:37 ` Torbjorn SVENSSON
2023-10-04 17:08 ` [PATCH v2 2/2] testsuite: Replace many dg-require-thread-fence with dg-require-atomic-cmpxchg-word Hans-Peter Nilsson
2023-10-12 2:22 ` Ping: " Hans-Peter Nilsson
2023-10-12 14:40 ` Christophe Lyon
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=02f7abe5-5612-4508-9047-16f924e3246b@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@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).