AT&T内嵌汇编

时间:2022-06-14 13:44:53
#include<iostream>
using namespace std;
int main(){

	int a = 3;
	int b = 5;
	int c = 0;
	__asm__ __volatile__("mov %1,%0":"=r"(c):"r"(b));//%0 --> c ; %1 --> b
	cout << "a := " << a << endl;
	cout << "b := " << b << endl;
	cout << "c := " << c << endl;

	return 0;
}

a := 3
b := 5
c := 5