1 /* Test generic __atomic routines for proper function calling.
3 /* { dg-options "-w -fno-inline-atomics" } */
5 /* { dg-additional-sources "atomic-noinline-aux.c" } */
7 /* Test that -fno-inline-atomics works as expected.
8 atomic-generic-aux provide the expected routines which simply set the
9 value of the first parameter to */
22 ac
= __atomic_exchange_n (&bc
, cc
, __ATOMIC_RELAXED
);
26 as
= __atomic_load_n (&bs
, __ATOMIC_SEQ_CST
);
30 __atomic_store_n (&ac
, bc
, __ATOMIC_RELAXED
);
34 __atomic_compare_exchange_n (&as
, &bs
, cs
, 0, __ATOMIC_SEQ_CST
, __ATOMIC_SEQ_CST
);
38 ac
= __atomic_fetch_add (&cc
, 15, __ATOMIC_SEQ_CST
);
42 /* This should be translated to __atomic_fetch_add for the library */
43 as
= __atomic_add_fetch (&cs
, 10, __ATOMIC_RELAXED
);
48 /* The fake external function should return 10. */
49 if (__atomic_is_lock_free (4, 0) != 10)
52 /* PR 51040 was caused by arithmetic code not patching up nand_fetch properly
53 when used an an external function. Look for proper return value here. */
55 bc
= __atomic_nand_fetch (&ac
, 0x0f, __ATOMIC_RELAXED
);