[Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 18 16:56:00 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20838

--- Comment #8 from mw <mingwu at gmail.com> ---
And for GDC:

--------------------------------------------------------------------------------
$ gdc-10 -m64 -c c.d
$ obj2asm c.o > c.o.asm
$ grep -i xch  c.o.asm
        extrn   __atomic_compare_exchange
                call      __atomic_compare_exchange at PLT32

--------------------------------------------------------------------------------

On this page:  https://d.godbolt.org/z/HesA24

I changed the compiler to "gdc 9.2.0", and searched the window, and search for
'xch':

        mov     rsi, rax
        mov     edi, 16
        call    __atomic_compare_exchange
        mov     BYTE PTR [rbp-1], al
        .loc 3 1413 9
        movzx   eax, BYTE PTR [rbp-1]


I'm not an asm guy, can someone help to read where is this
__atomic_compare_exchange? and confirm it's calling the correct CMPXCHG16B?


Thanks.

--


More information about the Digitalmars-d-bugs mailing list