Possible Duplicate: Not sure why we add the registers %rdx and %rax when the assembly code has been using %eax and %edx 全部。 所以,這是我最小的方案: int main(int argc, char * argv[]){
volatile int a;
vo
// Code I'll be working with
int shift_left2_rightn(int x, int n)
{
x <<= 2;
x >>= n;
return x;
}
問題1.左移= SAL和SHL。我的書說他們有同樣的效果。那麼爲什麼有兩次輪班? 例如: movl 8(%ebp), %eax //Get x
_______
C版: int arith(int x, int y, int z)
{
int t1 = x+y;
int t2 = z*48;
int t3 = t1 & 0xFFFF;
int t4 = t2 * t3;
return t4;
}
ATT大會相同程序的版本: X在的%ebp + 8,Y在的%ebp + 12,Z在的%ebp + 16