Thread overview
Error: unknown opcode cdq
Nov 04, 2018
willo
Nov 06, 2018
willo
Nov 06, 2018
kinke
Nov 06, 2018
willo
November 04, 2018
LDC inline asm doesnt like the CDQ instruction, compiles fine on DMD. Any clues on how to get it to work?
November 06, 2018
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*


November 06, 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).
November 06, 2018
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.