Error: unknown opcode cdq

kinke noone at nowhere.com
Tue Nov 6 01:47:08 UTC 2018


On Tuesday, 6 November 2018 at 01:13:39 UTC, willo wrote:
> On Sunday, 4 November 2018 at 23:55:25 UTC, willo wrote:
>> LDC inline asm doesnt like the CDQ instruction, compiles fine 
>> on DMD. Any clues on how to get it to work?
>
> Great.. so cant figure it out and decide put the opcode in 
> directly and get this....
>
> "Error: Data definition directives inside inline asm are not 
> supported yet."
>
> *banging head on desk*

To prevent a bloodshed - grep the druntime src for `__asm`. 
That's for LLVM inline asm in AT&T syntax, check out the LLVM 
language reference for the constraints string syntax.

DMD-style inline asm isn't really maintained in LDC. It's 
x86(_64) only and thus less and less interesting; GDC doesn't 
support it at all. I also find it highly questionable whether 
user code should really work on the asm level nowadays, e.g., 
with architecture-neutral LLVM intrinsics (with varying support) 
and architecture-specific GCC builtins being available etc. See 
the LDC-specific import files in ldc/, e.g., gccbuiltins_*, 
intrinsics, llvmasm, simd (which also allows you to write code in 
LLVM IR for example).


More information about the digitalmars-d-ldc mailing list