|Subject:||Re: [Tinycc-devel] sqlite on windows|
|Date:||Mon, 21 Jun 2021 11:55:01 +0200|
Hello I confirm that it is implemented by “lock orl $0,($rsp)” and I also vote to include this intrinsic. Below here are asm and objdump results
C:>type foo.c && cl -nologo -Ox -Fa -c foo.c && type foo.asm && objdump -d foo.obj
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.29.30038.1
_volmd DDSymXIndex: FLAT:foo
; Function compile flags: /Ogtpy
; File c:\usr\jullien\foo.c
; Line 3
lock or DWORD PTR [rsp], 0
; Line 4
foo.obj: file format pe-x86-64
Disassembly of section .text$mn:
0: f0 83 0c 24 00 lock orl $0x0,(%rsp)
5: c3 ret
On Sun, 20 Jun 2021, Tyge Løvset wrote:
> on win64 I get an undefined intrinsic symbol __faststorefence(). It
> can be implemented as an mfence instruction, but I think microsoft
> implements it with xchgl or similar
It appears to be implemented as lock or $0,(%rsp).
I would guess the reasoning that or with 0 is special-cased by the processor as a no-op, so it doesn't actually perform a write, but the lock still takes effect?
Regardless, I think it's a good idea to implement such intrinsics.
|[Prev in Thread]||Current Thread||[Next in Thread]|