SSE opcodes to TCC assembler (i386, x86_64)
commiteb870b006c969d16002fc724d5bbfe33287801e5
authorseyko <seyko2@gmail.com>
Wed, 23 Sep 2015 11:58:06 +0000 (23 14:58 +0300)
committerseyko <seyko2@gmail.com>
Wed, 23 Sep 2015 11:58:06 +0000 (23 14:58 +0300)
tree2f56b231d86158596287a70560ee5ee88ea229f7
parent8f620c8af8f664d8e17144b3f29f0c22d5ea190f
SSE opcodes to TCC assembler (i386, x86_64)

    patch from AnaĆ«l Seghezzi
    a test program:
    ============================
    #include <stdio.h>
    struct fl4{ float x, y, z, w; };
    void asm_test(void)
    {
struct fl4 v1, v2, v3;
v1.x = 0.1;
v1.y = 0.2;
v1.z = 0.4;
v1.w = 0.3;
v2.x = 0.11;
v2.y = 0.0;
v2.z = 0.01;
v2.w = 0.04;
asm volatile (
    "movups %0, %%xmm0;"
    "movups %1, %%xmm1;"
    "addps %%xmm1, %%xmm0;"
    "movups %%xmm0, %2"
:: "g" (v1), "g" (v2), "g" (v3) : "memory");
printf("sse fl4 add : %f %f %f %f\n", v3.x, v3.y, v3.z, v3.w);
printf("expected : %f %f %f %f\n", v1.x+v2.x, v1.y+v2.y, v1.z+v2.z, v1.w+v2.w);
    }
    int main() { asm_test(); }
    /*
sse fl4 add : 0.210000 0.200000 0.410000 0.340000
expected : 0.210000 0.200000 0.410000 0.340000
    */
    ============================
i386-asm.h
x86_64-asm.h