This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Inline assembly constraints for a specific register


Avi Kivity writes:
 > How can I specify a constraint for a specific register, for example r8 
 > on x86_64?
 > 
 > I can specify any of rax, rbx, rcx, and rdx using a,b, c, and d.  But 
 > what about the rest of the register file?

Like this:

int poo (int N)
{
  register int zz __asm__ ("r8") = N;
  
  __asm__ ("mov %0, %0" : "+r"(zz));
  
  return zz;
}

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]