This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Optimizer is putting result of a log into the wrong reg
- To: Ulrich Drepper <drepper at cygnus dot com>
- Subject: Re: Optimizer is putting result of a log into the wrong reg
- From: Bernd Schmidt <bernds at cygnus dot co dot uk>
- Date: Thu, 23 Sep 1999 17:43:34 +0100 (BST)
- cc: "Singh, Kirat" <Kirat dot Singh at gs dot com>, "'moshier at mediaone dot net'" <moshier at mediaone dot net>, egcs-bugs at egcs dot cygnus dot com
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