struggling with inline assembler

Kai Nacke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Apr 9 08:51:42 PDT 2015


On Thursday, 9 April 2015 at 15:31:34 UTC, salsa wrote:
> I'm trying to use Intel's AES instruction set for AES 
> encryption. The following piece of code works well with DMD2 
> but won't compile with LDC. ldc2 tells me this:
>
> Basic Block in function 
> '_D4main48__T21AES_128_KEY_EXPANSIONVAyaa7_656e6372797074Z21AES_128_KEY_EXPANSIONFNaNbNiNexPhPhZv' 
> does not have terminator!
> label %endentry
> LLVM ERROR: Broken function found, compilation aborted!
>
> Flow control in the asm block might be the problem.

Hi salsa!

The function has several asm { .. } blocks. Jumping between these 
blocks is not supported by ldc.

A possible workaround could be to load the target address into a 
register and do an indirect call. You could also write a mixin 
for the aes_128_assist and aesimc128 subroutines and replace the 
calls with the assembler text.

Regards,
Kai


More information about the digitalmars-d-ldc mailing list