This is the mail archive of the
mailing list for the GCC project.
Re: asm operands (Was: Re: egcs 1.0.1 miscompiles Linux 2.0.33)
- To: Kamil Iskra <kiskra at ernie dot icslab dot agh dot edu dot pl>
- Subject: Re: asm operands (Was: Re: egcs 1.0.1 miscompiles Linux 2.0.33)
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 02 Mar 1998 10:47:14 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
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:
> 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");
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.