On Tue, Jun 30, 2026 at 04:12:46PM +0200, Paul-Antoine Arras wrote:
> On 26/06/2026 11:43, Jakub Jelinek wrote:
> > So, makes me wonder if it shouldn't be instead a compile test
> > (in addition to int128 effective target of course) whether
> > __atomic_compare_exchange_16 appears in the assembly or not.
> 
> Is it something like this that you have in mind?

Yes.  With appropriate ChangeLog entry this is ok for trunk.

> diff --git gcc/testsuite/lib/target-supports.exp
> gcc/testsuite/lib/target-supports.exp
> index ae3af5893cc..394580ed871 100644
> --- gcc/testsuite/lib/target-supports.exp
> +++ gcc/testsuite/lib/target-supports.exp
> @@ -10364,7 +10364,15 @@ proc check_effective_target_section_anchors { } {
>  # Return 1 if the target supports atomic operations on "int_128" values.
> 
>  proc check_effective_target_sync_int_128 { } {
> -    return 0
> +    return [check_no_messages_and_pattern sync_int_128 \
> +           "__atomic_compare_exchange_16" assembly {
> +       __int128 v;
> +       void foo (__int128 *expected, __int128 desired)
> +       {
> +           __atomic_compare_exchange_n (&v, expected, desired, 0,
> +                                       __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
> +       }
> +    } ""]

Just please tweak indentation a little bit, the 7 columns indentation
and then further 4 is just weird.
Elsewhere the check_no_messages_and_pattern body is
one tab indented and __atomic would be 2 more columns to the right from
that.

        Jakub

Reply via email to