www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Error: unknown opcode cdq

reply willo <no here.com> writes:
LDC inline asm doesnt like the CDQ instruction, compiles fine on 
DMD. Any clues on how to get it to work?
Nov 04 2018
parent reply willo <no here.com> writes:
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*
Nov 05 2018
parent reply kinke <noone nowhere.com> writes:
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).
Nov 05 2018
parent willo <no here.com> writes:
On Tuesday, 6 November 2018 at 01:47:08 UTC, kinke wrote:
 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.
Will do thanks.
 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).
Well its just what Im used to, and i've never really taken to intrinsics because when they first started becoming available up you could only do limited things with them. I mean can you branch on the flags after an addition? Or use stuff like the result of a multiply being split across EDX:EAX? Might seem like silly stuff but in tight loops those few cycles can make a big difference. Anyway I should have another look at intrinsics.
Nov 06 2018