https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111870
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-10-18
Status|UNCONFIRMED |WAITING
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>atomicity of load gets elided.
No IT DOES NOT.
mov rax, QWORD PTR [rdi]
.L3:
mov rsi, rax
mov rdx, rax
or rsi, 1
lock cmpxchg QWORD PTR [rdi], rsi
jne .L3
That is correct as far as I know.
an atomic load from [rdi] and then do the or and then do a compare-and-exchange
with the new value (old value was in rdx for the comparison and the new value
is stored into rax).
That is very much atomically doing the IOR.