Inline asm SSE code, how to?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, new to the list here :)

I read on the Manual that there is an "x" constraint for using xmm registers, however, there is no example and I couldnt find any on the web, so I figured I could ask for one here.

Right now I want to turn this:

asm
(
     "movups %0,%%xmm0\n\t"
     "movups %1,%%xmm1\n\t"
     "addps %%xmm1,%%xmm0\n\t"
       "movups %%xmm0,%2\n\t"
       :
       : "m" (var1[0]), "m" (var2[0]),"m"(result[0])
       : "%xmm0", "%xmm1"
);

into this:

asm
(
       "addps %2,%1\n\t"
       "movups %1,%0\n\t"
       : "=x"(result[0])
       : "x" (var1[0]), "x" (var2[0])
);

but the second approach gives me an "impossible constraint in `asm'" error, the variables are float[4] 16bit aligned arrays, I wouldn't change the code if it wasnt because I am getting wierd, random results in runtime with the first piece of code.

Anyway, could someone give me an example on how to use the constraint?

Thank you very much :)


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux