我有一个关于 64 位乘法的 x86 汇编中的实现的问题。据我所知,我已经发布了代码。我不知道其余的做了什么(我可能在我已经做过的事情上犯了错误)。任何方向将不胜感激。
dest at %ebp+8
x at %ebp+12
y at %ebp+16
movl 16(%ebp), %esi //Move y into %esi
movl 12(%ebp), %eax //Move x into %eax
movl %eax, %edx //Move x into %edx
sarl $31, %edx //Shift x right 31 bits (only sign bit remains)
movl 20(%ebp), %ecx //Move the low order bits of y into %ecx
imull %eax, %ecx //Multiply the contents of %ecx (low order bits of y) by x
movl %edx, %ebx //Copy sign bit of x to ebx
imull %esi, %ebx //Multiply sign bit of x in ebx by high order bits of y
addl %ebx, %ecx //Add the signed upper order bits of y to the lower order bits (What happens when this overflows?)
mull %esi //Multiply the contents of eax (x) by y
leal (%ecx,%edx), %edx
movl 8(%ebp), %ecx
movl %eax, (%ecx)
movl %edx, 4(%ecx)