This is the mail archive of the gcc@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]

Re: asm operands (Was: Re: egcs 1.0.1 miscompiles Linux 2.0.33)


  In message <Pine.GSO.3.95.980302123005.21281B-100000@ernie>you write:
  > On Sun, 1 Mar 1998, Jeffrey A Law wrote:
  > 
  > > You've set up a case where the inputs
  > > and clobbers must be in the same register.  This can't work and
  > > is just going to cause problems.
  > 
  > Is this only true for x86 and other SMALL_REGISTER_CLASSES targets, or is
  > it a general rule that the same registers cannot be specified in input and
  > clobber parts of asm statements?
It's a general rule.


  > Say, on m68k, if I do an asm like this:
  > 
  > whatever=({
  >   register int ret __asm__("d0");
  >   register int arg1 __asm__("d0")=whatever;
  >   register int arg2 __asm__("d1")=whatever;
  > 
  >   __asm__ __volatile__ ("/* some os-specific hackery */"
  >   : "=r" (ret)
  >   : "r" (arg1), "r" (arg2)
  >   : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  > 
  >   ret;
  > });
I think you get away with this because you've assigned those variables
to registers.  If you hadn't bound arg1 and arg2 to registers, then
I would have expected the compiler to eventually crash on this kind
of asm statement if it ever needed to use d0/d1 as spill regs.

Obviously since you have more regs than the x86, the compiler is
less likely to need to spill in general and is even less likely to
need to use d0/d1 as spill regs.

jeff


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