[Bug target/91502] suboptimal atomic_fetch_sub and atomic_fetch_add

nruslan_devel at yahoo dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 20 18:19:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91502

--- Comment #1 from Ruslan Nikolaev <nruslan_devel at yahoo dot com> ---
btw, the same problem for

#include <stdatomic.h>

int func(_Atomic(long) *a)
{
        return (atomic_fetch_sub(a, 1) <= 0);
}

In the previous case clang/llvm was just like gcc, i.e., unable to optimize; in
this case clang/llvm was able to produce better code, but gcc still cannot.


More information about the Gcc-bugs mailing list