LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   asm in gcc (https://www.linuxquestions.org/questions/programming-9/asm-in-gcc-442700/)

snowing 05-08-2006 03:21 AM

asm in gcc
 
I am a new bie to asm. And today I encounter a problem, but I don't know why? I use embedded asm in gcc on IA64.
The following code can work well.
asm("mov r12=%0;;"::"r"(esp-16)); //putting esp-16 to r12
but this code cannot work, when compiling it reports that
"output operand constraint lacks '=' "
asm("mov %0=r12;;":"r"(esp):);//getting esp from r12
I searched this error on google, but the two results didn't bring me much hints.
And on x86_64, the situation is alomst the same, though the asm codes maybe a little different.
asm("\tmov %0, %%rsp\n" :: "r"(rsp)); //compling good
asm("\tmov %%rsp, %0\n" :"r"(rsp):); //compling error
Could you please give me some suggestion?

snowing 05-08-2006 03:52 AM

sorry for this stupid question. it should be:
asm("mov %0=r12;;":"=r"(esp));


All times are GMT -5. The time now is 03:17 PM.