[Bug target/86693] inefficient atomic_fetch_xor

2021-12-27 Thread crazylht at gmail dot com via Gcc-bugs
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

[Bug target/86693] inefficient atomic_fetch_xor

2021-12-26 Thread hjl.tools at gmail dot com via Gcc-bugs
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,

[Bug target/86693] inefficient atomic_fetch_xor

2021-12-26 Thread crazylht at gmail dot com via Gcc-bugs
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();

[Bug target/86693] inefficient atomic_fetch_xor

2021-12-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693 Andrew Pinski changed: What|Removed |Added Severity|normal |enhancement

[Bug target/86693] inefficient atomic_fetch_xor

2018-07-28 Thread nruslan_devel at yahoo dot com
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 >

[Bug target/86693] inefficient atomic_fetch_xor

2018-07-28 Thread nruslan_devel at yahoo dot com
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)

[Bug target/86693] inefficient atomic_fetch_xor

2018-07-27 Thread jakub at gcc dot gnu.org
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

[Bug target/86693] inefficient atomic_fetch_xor

2018-07-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86693 Richard Biener changed: What|Removed |Added Keywords||missed-optimization