[Bug target/83638] atomic_is_lock_free should return false on pa-risc
dave.anglin at bell dot net
gcc-bugzilla@gcc.gnu.org
Mon Mar 26 22:49:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83638
--- Comment #4 from dave.anglin at bell dot net ---
On 2018-03-26 2:23 PM, mikulas at artax dot karlin.mff.cuni.cz wrote:
> If the userspace wants to optimize different code paths for lockless atomics
> and for locked atomics, atomic_is_lock_free should return false, to indicate
> that the atomic operation is as costly as taking a lock.
At the moment, there's not really any way to specify this in the
backend. I believe the function returns true
in your examples because the call to can_compare_and_swap_p() in
fold_builtin_atomic_always_lock_free()
passes true for the allow_libcall argument.
/* Check if a compare_and_swap pattern exists for the mode which
represents
the required size. The pattern is not allowed to fail, so the
existence
of the pattern indicates support is present. Also require that an
atomic load exists for the required size. */
if (can_compare_and_swap_p (mode, true) && can_atomic_load_p (mode))
return boolean_true_node;
else
return boolean_false_node;
More information about the Gcc-bugs
mailing list