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 Thu, May 13, 2004 at 03:21:28PM +0200, Segher Boessenkool wrote:
> Hi Gunther,
> 
> Try:
> 
> 
> #define osfunc(v1,v2)                                   \
> ({                                                      \
>  int _v1 = (v1);                                        \
>  int _v2 = (v2);                                        \
>  {                                                      \
>    register int _d0 __asm("d0") = _v1;                  \
>    register int _d1 __asm("d1") = 0xDEADBEAF;           \
>    register int _a0 __asm("a0") = _v2;                  \
>    register int _a1 __asm("a1") = 0xDEADBEAF;           \
>    register void *const _a6 __asm("a6") = (base);       \
>    __asm volatile ("jsr a6@(-0x84:W)"                   \
>    : "+r" (_d0), "=r" (_d1), "+r" (_a0), "=r" (_a1), "+r"(_a6) \
>    : : "fp0", "fp1", "cc", "memory");                   \
>   }                                                     \
> })
> 
> (Note: I merged the multiple register asm's referring to the same reg
> into one.  I don't think it will always work correctly, otherwise).

  The 0xDEADBEEF was only there to check that GCC deletes these dead
  stores. But I need the four asm regs as ouputs. There is another
  layer that uses macros like the above which specifies which registers
  are used. There is no way to know which registers will be used.

> Any register asm that's used in the asm block has to be either a clobber
> or an output.  Yes I learnt this the hard way.

  This would be odd. AFAICT, only those registers must be clobbered or
  output that are changed by the asm(). In my case these are only scratch
  registers (d0/d1/a0/a1). Since inputs might be passed in these registers
  I use different variables bound to these registers as outputs.

> Yes it would be so much nicer if we could specify specific regs in
> asm inputs.  \end{rant}

  I was under the impression that this is possible since I use local
  hard register variables as inputs but the documenation doesn't really
  cover this. I mean the local hard register variable is used as an input.
  It would be pretty suprising that the value is suddenly in a different
  register.

  Gunther
  


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