Assembly x64 Intro - GAS Assembly Issue




movslq %eax,%rbx <=> movsx rbx, eax

40056e:       8b 45 d0                mov    -0x30(%rbp),%eax
400571:       48 63 d8                movslq %eax,%rbx
400574:       48 8b 45 f0             mov    -0x10(%rbp),%rax
400578:       48 99                   cqto
40057a:       48 f7 fb                idiv   %rbx
40057d:       48 89 45 f0             mov    %rax,-0x10(%rbp)
400581:       8b 45 10                mov    0x10(%rbp),%eax
400584:       48 98                   cltq
400586:       48 01 45 f0             add    %rax,-0x10(%rbp)


movslq %eax,%rbx  => 拷贝eax 到 rbx, 并对rbx进行符号扩展
cqto => 符号扩展rax到 rdx:rax

400581:       8b 45 10                mov    0x10(%rbp),%eax
400584:       48 98                   cltq
cltq => 提升 eax (int32_t) 到 int64_t



你可能感兴趣的:(Assembly x64 Intro - GAS Assembly Issue)