https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
--- Comment #6 from Hongtao.liu ---
(In reply to H.J. Lu from comment #5)
> (In reply to Hongtao.liu from comment #4)
> > Change testcase a little bit, gcc now can generate lock btc
> >
> >
> > void func1();
> >
> > void func(unsigned long
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
--- Comment #5 from H.J. Lu ---
(In reply to Hongtao.liu from comment #4)
> Change testcase a little bit, gcc now can generate lock btc
>
>
> void func1();
>
> void func(unsigned long *counter)
> {
> if (__atomic_fetch_xor(counter, 1,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
--- Comment #4 from Hongtao.liu ---
Change testcase a little bit, gcc now can generate lock btc
void func1();
void func(unsigned long *counter)
{
if (__atomic_fetch_xor(counter, 1, __ATOMIC_ACQ_REL) & 1) {
func1();
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
Andrew Pinski changed:
What|Removed |Added
Severity|normal |enhancement
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
--- Comment #3 from Ruslan Nikolaev ---
(In reply to Jakub Jelinek from comment #1)
> The reason why this works for sub/add is that x86 has xadd instruction, so
> we expand it as xadd and later on during combine find out we are actually
>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
--- Comment #2 from Ruslan Nikolaev ---
Also may be (partially) related the following cases:
1.
#include
#include
void func2();
void func(_Atomic(unsigned long) * obj, void * obj2)
{
if (atomic_fetch_sub(obj, 1) == 1 && obj2)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
Jakub Jelinek changed:
What|Removed |Added
CC||jakub at gcc dot gnu.org
--- Comment #1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693
Richard Biener changed:
What|Removed |Added
Keywords||missed-optimization