This is the mail archive of the gcc-bugs@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: Optimizer is putting result of a log into the wrong reg




On 23 Sep 1999, Ulrich Drepper wrote:

> Bernd Schmidt <bernds@cygnus.co.uk> writes:
> 
> >   register double __result;
> >   __asm __volatile__ ("fldln2; fxch; fyl2x":"=t" (__result):"0" (__x));
> >   return __result;

> What we really would have to write is something like
> 
>   __asm __volatile__ ("fldln2; fxch; fyl2x" :"=t" (__result):"0" (__x):"st7");
> 
> but this isn't possible.  So, what's the best way to write it?

The comment at the top of reg-stack.c says
   6. Some asm statements may need extra stack space for internal
      calculations.  This can be guaranteed by clobbering stack registers
      unrelated to the inputs and outputs.

So, it seems that you need to to write it this way:

  __asm __volatile__ ("fldln2; fxch; fyl2x":"=t" (__result):"0" (__x) : "st(1)");

That appears to fix the problem for me.

Bernd


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