Inlineassembler mit VC++ 2010



  • Moin,

    ich habe hier folgenden Code, der von MinGW/gcc nach Visual C++ portiert werden soll. Dabei verschluckt sich MSVC an folgedem inline-assembercode:

    uint32_t masks[6]={ 0x1f, 0x1f, 0x3e0, 0x3e0, 0x7c00, 0x7c00 };
    
        __asm__ __volatile__
                (
                        // Load zero into mm0
                        "pxor       %%mm0, %%mm0\n\t"
    
                        // Load mm4 to mm6 with masks
                        "movq       (%%eax), %%mm4\n\t"
                        "add        $8, %%eax\n\t"
                        "movq       (%%eax), %%mm5\n\t"
                        "add        $8, %%eax\n\t"
                        "movq       (%%eax), %%mm6\n\t"
    
                        // loop begin
                        // TODO: Handle odd pixels
                        "0:         \n\t"
                        "sub        $2, %%ecx\n\t"
                        "jl         0f\n\t"
    
                        // Get input into mm1 and increment pointer
                        "movq       (%%ebx), %%mm1\n\t"
                        "add        $8, %%ebx\n\t"
    
                        "psrld      $3, %%mm1\n\t"
                        "movq       %%mm1, %%mm2\n\t"
                        "pand       %%mm4, %%mm2\n\t"
                        "psrld      $3, %%mm1\n\t"
                        "movq       %%mm1, %%mm3\n\t"
                        "pand       %%mm5, %%mm3\n\t"
                        "psrld      $3, %%mm1\n\t"
                        "pand       %%mm6, %%mm1\n\t"
                        "por        %%mm3, %%mm2\n\t"
                        "por        %%mm2, %%mm1\n\t"
    
                        "packssdw   %%mm0, %%mm1\n\t"
    
                        // Save result and increment pointer
                        "movd       %%mm1, (%%edx)\n\t"
                        "add        $4, %%edx\n\t"
    
                        // loop end
                        "jmp        0b\n\t"
                        "0:"
    
                        // output registers
                            : // none
    
                            // input registers
                                : "a" (masks), "b" (from), "c" (len), "d" (to)
    
                                // clobbers
                                    :
                                    );
    

    Gibt es ein equivalent für Visual C++? Wie sieht der korrespondiere Code dafür aus? Benutzen die das selbe Instruktion set oder muss man den ganzen Kram dafür neuschreiben?

    Gruß,
    Philipp



  • Hmm, 100 hits ohne Antwort, scheint wohl im falschen Forum zu stehen.
    Vielleicht mal ein moderator move ins Assemblerforum? Will keinen neuen Thread aufmachen.

    Philipp



  • Das geht so in der Art, mit der Intel-Syntax:

    __asm {
    movq       eax, mm4
               add  xxx, eax
    }
    

Anmelden zum Antworten