D ASM. Program fails

Iakh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 22 12:54:46 PST 2016


On Friday, 22 January 2016 at 17:27:35 UTC, userABCabc123 wrote:
> int pmovmskb(byte16 v)
> {
>     asm
>     {
>         naked;
>         push RBP;
>         mov RBP, RSP;
>         sub RSP, 0x10;
>         movdqa dword ptr[RBP-0x10], XMM0;
>         movdqa XMM0, dword ptr[RBP-0x10];
>         pmovmskb EAX, XMM0;
>         mov RSP, RBP;
>         pop RBP;
>         ret;
>     }
> }

Thanks. It works.
Buth shorter version too:

                 asm
                 {
                     naked;
                     push RBP;
                     mov RBP, RSP;
                     //sub RSP, 0x10;
                     //movdqa dword ptr[RBP-0x10], XMM0;
                     //movdqa XMM0, dword ptr[RBP-0x10];
                     pmovmskb EAX, XMM0;
                     mov RSP, RBP;
                     pop RBP;
                     ret;
                 }

Looks like the SIMD param is passed by SIMD reg



More information about the Digitalmars-d-learn mailing list