Thread overview | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 17, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #1 from mw <mingwu@gmail.com> --- BTW, I only tested on x86_64 Linux, I think this bug on other platform too MacOS, Windows (on modern x86_64 CPUs with CX16 support). -- |
May 17, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pro.mathias.lang@gmail.com --- Comment #2 from Mathias LANG <pro.mathias.lang@gmail.com> --- Doesn't affect OSX (used objdump, grepped for cmpxchg). -- |
May 17, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #3 from mw <mingwu@gmail.com> --- Yes, verified, not on MacOS. Thank you (at least there is a system I can use now). $ objdump -disassemble-all c.o > c.o.asm $ grep -i cmpxchg c.o.asm 80a: 49 0f c7 08 cmpxchg16b (%r8) $ uname -a Darwin 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64 -- |
May 17, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 Seb <greeenify@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |greeenify@gmail.com --- Comment #4 from Seb <greeenify@gmail.com> --- > at least there is a system I can use now). Well, you could just use LDC like almost everyone else ;-) -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #5 from mw <mingwu@gmail.com> --- LDC ? did I miss sth? -------------------------------------------------------------------------------- $ ldc2 -m64 -c c.d $ obj2asm c.o > c.o.asm $ grep -i xchg c.o.asm cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] .data._D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ segment _D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ: .data._D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ ends $ ldc2 --version LDC - the LLVM D compiler (1.21.0): based on DMD v2.091.1 and LLVM 10.0.0 built with LDC - the LLVM D compiler (1.21.0) Default target: x86_64-unknown-linux-gnu Host CPU: skylake http://dlang.org - http://wiki.dlang.org/LDC -------------------------------------------------------------------------------- Want to file a bug against LDC ? -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #6 from kinke <kinke@gmx.net> --- (In reply to mw from comment #5) > Want to file a bug against LDC ? No need, cmpxchg16 is used for all x86_64 CPUs: https://d.godbolt.org/z/HesA24 For the few old CPUs not supporting it, it can be disabled via `-mattr=-cx16` (but then it doesn't fall back to cmpxchg8 anway, so no idea how your results came about). -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #7 from mw <mingwu@gmail.com> --- Hi kinke, > so no idea how your results came about I downloaded directly from: https://github.com/ldc-developers/ldc/releases/download/v1.21.0/ldc2-1.21.0-linux-x86_64.tar.xz And I just downloaded 1.20, which is on the d.godbolt.org page you mentioned, but the result is the same: -------------------------------------------------------------------------------- $ wget https://github.com/ldc-developers/ldc/releases/download/v1.20.0/ldc2-1.20.0-linux-x86_64.tar.xz $ ldc2 -m64 -c c.d $ obj2asm c.o > c.o.asm $ grep -i xchg c.o.asm cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] cmpxchg8b [RSI] .data._D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ segment _D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ: .data._D100TypeInfo_S3ldc10intrinsics__T13CmpXchgResultTS4core8internal6atomic__T11_AtomicTypeTS1c1NZ5UCentZQCq6__initZ ends $ ldc2 --version LDC - the LLVM D compiler (1.20.0): based on DMD v2.090.1 and LLVM 9.0.1 built with LDC - the LLVM D compiler (1.20.0) Default target: x86_64-unknown-linux-gnu Host CPU: skylake http://dlang.org - http://wiki.dlang.org/LDC $ uname -a Linux titan 4.15.0-99-generic #100-Ubuntu SMP Wed Apr 22 20:32:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux -------------------------------------------------------------------------------- What else should I check? Or, can try my step on a Linux box? -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #8 from mw <mingwu@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@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. -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #9 from mw <mingwu@gmail.com> --- Oh, $ gdc-10 --version gdc-10 (Debian 10.1.0-1) 10.1.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- |
May 18, 2020 [Issue 20838] on modern (x86_64) CPUs, dmd emit cmpxchg8b instead of CMPXCHG16B | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20838 --- Comment #10 from kinke <kinke@gmx.net> --- (In reply to mw from comment #7) > What else should I check? Wrt. LDC, I'm almost certain this is solely an issue with your 'workflow' involving obj2asm. - Godbolt runs on Linux (but you can inspect the produced assembly for any target using LDC's -mtriple option). -- |
Copyright © 1999-2021 by the D Language Foundation