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]
Other format: [Raw text]

Re: [m68k] asm regression with 3.3/3.4/3.5


On Wed, May 12, 2004 at 05:04:08PM +0100, Dave Korn wrote:
> > -----Original Message-----
> > From: gcc-owner On Behalf Of Gunther Nikl
> > Sent: 12 May 2004 16:44
> 
> > with m68k-amigaos A6 is a free register and A5 is the framepointer)
> 
>   'Free' ?  I'd have said it was fairly seriously reserved for the OS
> myself!

  In GCC context A6 is a general free register since with m68k-amigaos
  A5 is the framepointer. Most (all?) other m68k targets use A6 as
  framepointer. For GCC it's not important to know that A6 is used for
  system calls.

> > For me this is a serious bug which could be triggered at 
> > random places.
> > I would appriciate any help finding this bug.
> 
>   I suspect the answer is going to be that your inline asm is faulty.
> 
> > #define osfunc(v1,v2)					\
> > ({							\
> >  int _v1 = (v1);					\
> >  int _v2 = (v2);					\
> >  {							\
> >    register int _d0 __asm("d0") = 0xDEADBEAF;		\
> >    register int _d1 __asm("d1") = 0xDEADBEAF;		\
> >    register int _a0 __asm("a0") = 0xDEADBEAF;		\
> >    register int _a1 __asm("a1") = 0xDEADBEAF;		\
> >    register void *const _bn __asm("a6") = (base);	\
> >    register int __v1 __asm("d0") = (_v1);		\
> >    register int __v2 __asm("a0") = (_v2);		\
> >    __asm volatile ("jsr a6@(-0x84:W)"			\
> >    : "=r" (_d0), "=r" (_d1), "=r" (_a0), "=r" (_a1)	\
> >    : "r" (_bn), "rf" (__v1), "rf" (__v2)		\
> >    : "fp0", "fp1", "cc", "memory");			\
> >   }							\
> > })
> 
>   The register ... _asm("...") construct doesn't actually tell gcc
> anything useful about clobbers and usage.  It's actually not a terribly
> useful construction.

  If you really think the asm() isn't useful you don't understand it :)
  This asm() has inputs, outputs and clobbers. Since inputs/outputs are
  not allowed to overlap with clobbers all ABI scratch registers are
  outputs which for GCC means their content changes within the asm().
  fp-registers will never be inputs they are in the clobber list. The
  asm() is a function call differently done which shall obey the usual
  function call constraints.
  
>   I'm also curious why isn't a6 in the list of clobbers along with fp0/1,
> cc and memory?

  Because A6 isn't changed, its not a scratch register.

  Gunther

  PS: Please reply to all recipients of an original mail. Its no fun to only
  see a reply on the ML (to which I am not subscribed!)


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