无标题。
#include<iostream> using namespace std; int sum() { __asm( "movl $1,%ebx\n" "movl $0,%ecx\n" //"xor %ecx,%ecx \n" "startfor: \n" "cmp $100,%ebx\n" "jg endfor \n" "movl %ebx,%eax\n" "mul %eax\n" "addl %eax,%ecx\n" "incl %ebx\n" "jmp startfor\n" "endfor: \n" "movl $0,%edx\n" //"xor %edx,%edx \n" "movl %ecx,%eax\n" ); } int main() { cout<<sum()<<endl; }
1-100的平方和?那个 movl $0,%edx 有什么作用?
好像没用 不过如果返回值是long long的话貌似会有一定影响