Equivalent in D for .p2align 4,,15 ?
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 29 10:44:45 PDT 2014
On Wednesday, 29 October 2014 at 17:16:23 UTC, Etienne wrote:
> I'm looking for the D inline assembler equivalent of the
> .p2align 4,,15 directive to optimize a loop.
>
> Here's more information:
> http://stackoverflow.com/questions/21546946/what-p2align-does-in-asm-code
>
> I tried searching through a turbo assembler tutorial (because
> D's is based on it) and found nothing except a few hints here:
> http://www.csn.ul.ie/~darkstar/assembler/manual/a10.txt
>
> There might be a way through segments, directives, but I'm not
> sure at all if D supports it.
>
> Does anyone have any idea if/how I can align my code this way
> or if the compiler handles it?
As far as I understand, `.p2align 4,,15` aligns to a 16 byte
boundary, and the third argument could be left out, because more
than 15 bytes wouldn't ever be skipped anyway.
D inline assembler has an 'align' directive [1]. Aligning to a 16
byte boundary in D: `align 16;`.
[1] http://dlang.org/iasm.html -- "align IntegerExpression", near
the top
More information about the Digitalmars-d-learn
mailing list