digitalmars.D.bugs - [Issue 20131] New: Bad codegen from inline asm; possible REX prefix
- d-bugmail puremagic.com (48/49) Aug 15 2019 https://issues.dlang.org/show_bug.cgi?id=20131
https://issues.dlang.org/show_bug.cgi?id=20131 Issue ID: 20131 Summary: Bad codegen from inline asm; possible REX prefix missing Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: turkeyman gmail.com Compile and dump using:dmd asmtest.d -O -c -m64 && objdump asmtest.o -Sasmtest.d --------- bool cas(byte*, byte*, byte) { asm pure nothrow nogc trusted { naked; mov AL, [RSI]; lock; cmpxchg [RDX], DIL; mov DL, AL; setz AL; je skip_writeback; mov [RSI], DL; skip_writeback: ret; } } Emits: Disassembly of section .text._D7asmtest3casFPgQcgZb: 0000000000000000 <_D7asmtest3casFPgQcgZb>: 0: 8a 06 mov (%rsi),%al 2: f0 0f b0 3a lock cmpxchg %bh,(%rdx) 6: 88 c2 mov %al,%dl 8: 0f 94 c0 sete %al b: 74 02 je f <_D7asmtest3casFPgQcgZb+0xf> d: 88 16 mov %dl,(%rsi) f: c3 retq Note: Src: lock; cmpxchg [RDX], DIL; Output: lock cmpxchg %bh,(%rdx) DIL turned into %bh. only 4 bytes including LOCK... REX prefix missing maybe? Blocks https://github.com/dlang/druntime/pull/2735 --
Aug 15 2019