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]

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


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?

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;
});

Is this correct or not? I'm asking, for we've been using this construction
extensively for years under the AmigaOS target to access the system
libraries, and it worked fine (unless we passed too many arguments, but
that's a different story, I think).

/ Kamil Iskra    AmigaOS  Linux/i386  Linux/m68k               \
| GeekGadgets GCC maintainer   UNIX system administrator       |
| iskra@student.uci.agh.edu.pl  kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl   http://student.uci.agh.edu.pl/~iskra /



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