请看下面一段代码:
static int func_MMX(float * _f, int16_t * s16){
int32_t * f = (int32_t *) _f;
asm volatile(
"movl $-1024, %%esi
"
"movq "MANGLE(magicF2W)", %%mm7
"
"1:
"
"movq (%1, %%esi), %%mm0
"
"movq 8(%1, %%esi), %%mm1
"
"movq 1024(%1, %%esi), %%mm2
"
"movq 1032(%1, %%esi), %%mm3
"
"psubd %%mm7, %%mm0
"
"psubd %%mm7, %%mm1
"
"psubd %%mm7, %%mm2
"
"psubd %%mm7, %%mm3
"
"packssdw %%mm1, %%mm0
"
"packssdw %%mm3, %%mm2
"
"movq %%mm0, %%mm1
"
"punpcklwd %%mm2, %%mm0
"
"punpckhwd %%mm2, %%mm1
"
"movq %%mm0, (%0, %%esi)
"
"movq %%mm1, 8(%0, %%esi)
"
"addl $16, %%esi
"
" jnz 1b
"
"emms
"
:: "r" (s16+512), "r" (f+256)
:"%esi", "memory"
);
return 2*256;
}
编译出来的代码是:
push %ebp
mov %esp, %ebp
push %esi
mov 0xc(%ebp),%edx
mov 0x8(%ebp),%eax
add $0x400,%edx
add $0x400,%eax
mov $0xfffffc00,%esi
movq 0x9f5758,%mm7
1:
movq (%eax,%esi,1),%mm0
movq 0x8(%eax,%esi,1),%mm1
movq 0x400(%eax,%esi,1), %mm2
movq 0x408(%eax,%esi,1),%mm3
psubd %mm7,%mm0
psubd %mm7,%mm1
psubd %mm7,%mm2
psubd %mm7,%mm3
packssdw %mm1,%mm0
packssdw $mm3,%mm2
movq %mm0,%mm1
punpcklwd %mm2,%mm0
punpckhwd %mm2,%mm1
movq %mm0,(%edx,%esi,1)
movq %mm1,0x8(%edx,%esi,1)
add $0x10,%esi
jne 1b
emms
pop %esi
mov %$0x200,%eax
pop %ebp
ret
很明显, 编译器将s16放到edx中,将 f 放到eax中,但是编译器根据什么将edx和eax都加上0x400呢?是不是和:: "r" (s16+512), "r" (f+256)这行有关?在这行中,s16+512 和 f+256 是什么意思呢?
|
|