D ASM. Program fails
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 22 04:18:53 PST 2016
On 22.01.2016 06:59, Iakh wrote:
> import std.stdio;
> import core.simd;
>
> int pmovmskb(inout byte16 v)
> {
> asm
> {
> movdqa XMM0, v;
> pmovmskb EAX, XMM0;
> ret;
> }
> }
> void main()
> {
> byte16 a = [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
> auto i = pmovmskb(a);
> }
I don't know much about these things, but it seems to be the `ret;`.
This doesn't segfault:
----
int pmovmskb(byte16 v)
{
int r;
asm
{
movdqa XMM0, v;
pmovmskb EAX, XMM0;
mov r, EAX;
}
return r;
}
----
Removed the `inout` because it doesn't make sense. You may be looking
for `ref`.
More information about the Digitalmars-d-learn
mailing list