On Sun, Apr 26, 2020 at 1:31 AM Cholerae Hu <cholerae...@gmail.com> wrote:
>
> Atomic.StoreX doesn't return the old value of the given pointer, so lock mov 
> would work. Why do we use a xchg instead? It there any performance issue?

I assume that you are talking about Intel processors.  Intel
processors do not have a lock mov instruction.

>From the Intel architecture manual:

    The LOCK prefix can be prepended only to the following
instructions and only to those forms
    of the instructions where the destination operand is a memory
operand: ADD, ADC, AND,
    BTC, BTR, BTS, CMPXCHG, CMPXCH8B, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR,
    XADD, and XCHG.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXXxenESQFDBaAwu5-bfi8zfQBwMr8Jce4cMi3Phex9Hg%40mail.gmail.com.

Reply via email to