Optimizer is putting result of a log into the wrong reg

Ulrich Drepper drepper@cygnus.com
Thu Sep 23 09:38:00 GMT 1999

Bernd Schmidt <bernds@cygnus.co.uk> writes:

>   register double __result;
>   __asm __volatile__ ("fldln2; fxch; fyl2x":"=t" (__result):"0" (__x));
>   return __result;

OK, so we would have to write

  register double __result;
  register double __tmp;
  __asm __volatile__ ("fldln2; fxch; fyl2x; fld %0"
                      :"=t" (__result), "=u" (__tmp):"0" (__x));

I.e., we have to artificially add another instruction.  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?

---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

More information about the Gcc-bugs mailing list