www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there a place I can learn LLD inline assembly with GCC syntax?

reply rempas <rempas tutanota.com> writes:
I want to learn how to use inline assembly for LDC with GCC 
syntax specifically so I can support all the targets (as 
[here](https://wiki.dlang.org/Compilers) it is said that DMD 
intel-like syntax only supports the "i386" and "amd64" targets) 
but I cannot find anything other 
[this](https://wiki.dlang.org/LDC_inline_assembly_expressions) 
outdated page where It seems that it doesn't work (at least not 
for the sys_write example). Any ideas?
Dec 15 2021
parent reply Johan <j j.nl> writes:
On Wednesday, 15 December 2021 at 09:26:28 UTC, rempas wrote:
 I want to learn how to use inline assembly for LDC with GCC 
 syntax specifically so I can support all the targets (as 
 [here](https://wiki.dlang.org/Compilers) it is said that DMD 
 intel-like syntax only supports the "i386" and "amd64" targets) 
 but I cannot find anything other 
 [this](https://wiki.dlang.org/LDC_inline_assembly_expressions) 
 outdated page where It seems that it doesn't work (at least not 
 for the sys_write example). Any ideas?
The wiki page you linked to describes LDC's own inline assembly syntax, which supports all targets but is no longer recommended. If you want GCC-style inline assembly, it's probably best to have a look at GCC's documentation: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html and examples here in LDC source: https://github.com/ldc-developers/druntime/pull/171/files cheers, Johan
Dec 15 2021
parent rempas <rempas tutanota.com> writes:
On Wednesday, 15 December 2021 at 21:57:39 UTC, Johan wrote:
 The wiki page you linked to describes LDC's own inline assembly 
 syntax, which supports all targets but is no longer recommended.
 If you want GCC-style inline assembly, it's probably best to 
 have a look at GCC's documentation:
 https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
 and examples here in LDC source:
 https://github.com/ldc-developers/druntime/pull/171/files

 cheers,
   Johan
Oh!! We can use pure GCC syntax? That's sweet as there will be a lot more sources and people knowing how to use it! I already test it and it works!!! Thanks a lot for your help!!!
Dec 15 2021