Are RMW instructions considered harmful on modern x86?
问题 I recall that read-modify-write instructions are generally to be avoided when optimizing x86 for speed. That is, you should avoid something like add [rsi], 10 , which adds to the memory location stored in rsi . The recommendation was usually to split it into a read-modify instruction, followed by a store, so something like: mov rax, 10 add rax, [rsp] mov [rsp], rax Alternately, you might use explicit load and stores and a reg-reg add operation: mov rax, [esp] add rax, 10 mov [rsp], rax Is