[Bug middle-end/102566] [i386] GCC should emit LOCK BTS for simple bit-test-and-set operations with std::atomic

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 1 16:46:10 GMT 2022


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

--- Comment #34 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 53813
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53813&action=edit
A patch to handle if (_5 < 0)

A patch to extend optimization for

_1 = __atomic_fetch_or_4 (ptr_6, 0x80000000, _3);
_5 = (signed int) _1;
_4 = _5 >= 0;

to

_1 = __atomic_fetch_or_4 (ptr_6, 0x80000000, _3);
_5 = (signed int) _1;
if (_5 >= 0)


More information about the Gcc-bugs mailing list