错误:没有大小后缀的指令助记符的未知使用

时间:2019-03-29 13:01:33

标签: gcc x86-64 inline-assembly att

这里是完整的源代码

void asmFunction() {
    unsigned char threshold[16];
    initArray(threshold, 75-128, 16);
    unsigned char counterC2[16];
    initArray(counterC2, 128, 16);
    unsigned char buffer[SIZE];

    FILE *fp;
    fp = fopen(FILE_INPUT, "rb");
    FILE *foutput;
    foutput = fopen(FILE_OUTPUT_ASM, "wb");

    fread(buffer, sizeof(unsigned char), SIZE, fp);
    fclose(fp);
    __asm__(

            "mov $65536, %%edx\n"
            "mov %[thr], %%eax\n" // <--- this line
            "mov %[buf], %%ebx\n"
            "mov %[cc2], %%ecx\n"
            "movdqu (%%ecx), %%xmm2;\n"
            "movdqu (%%eax), %%xmm0;\n"
            "loop: movdqu (%%ebx), %%xmm1;\n"
            "psubb %%xmm2, %%xmm1;\n"
            "pcmpgtb %%xmm0, %%xmm1;\n"
            "movdqu %%xmm1, (%%ebx);\n"
            "add $16, %%ebx;\n"
            "sub $1, %%edx;\n"
            "mov $0, %%esi;\n"
            "cmp %%edx, %%esi;\n"
            "jnz loop;\n"
            : "=m" (buffer) // Output
            : [thr]"r" (threshold), [buf]"r" (buffer), [cc2]"r" (counterC2)
            : "xmm0", "eax", "ebx", "ecx"
        );

    fwrite(buffer, sizeof(unsigned char), SIZE, foutput);
    fclose(foutput);
}

但是我收到以下错误,但我不明白为什么:

  

不带大小后缀的指令助记符的未知使用               “ mov%[thr],%% eax \ n”

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

尝试将mov替换为movl吗? at&t和intel汇编语言之间有一点区别。