On Tuesday, 10 January 2017 at 13:13:17 UTC, Basile B. wrote:
On Tuesday, 10 January 2017 at 11:38:43 UTC, Guillaume Piolat
wrote:
On Tuesday, 10 January 2017 at 10:41:54 UTC, Basile B. wrote:
don't forget to flag
asm pure nothrow {}
otherwise it's slow.
Why?
It's an empirical observation. In september I tried to get why
an inline asm function was slow. What happened was that I
didn't mark the asm block as nothrow
https://forum.dlang.org/post/xznocpxtalpayvkrw...@forum.dlang.org
I opened an issue asking the specifications to explain that
clearly.
Huh, that's really interesting, thanks for posting. I guess my
other question would be how do I determine if a block of assembly
is pure?
I also figured out moving *op1 directly into RAX, guess it makes
sense that a 64-bit value would need a 64-bit register :)
private void rot(string ins)(int *op1, int op2)
{
mixin("
asm
{
mov RAX, op1;
mov ECX, op2[EBP];" ~
ins ~ " [RAX], CL;
}
");
}