Optimizer is putting result of a log into the wrong reg

Singh, Kirat Kirat.Singh@gs.com
Thu Sep 30 19:57:00 GMT 1999


	I tried writing

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

	and this appeared to do the trick, there were only seven flds before
it started doing the log. The numbers were also right :-) But it does seem a
little hokey to me.

-Kirat

	-----Original Message-----
	From:	Ulrich Drepper [SMTP:drepper@cygnus.com]
	Sent:	Thursday, September 23, 1999 12:34 PM
	To:	Bernd Schmidt
	Cc:	Singh, Kirat; 'moshier@mediaone.net';
egcs-bugs@egcs.cygnus.com
	Subject:	Re: Optimizer is putting result of a log into the
wrong reg

	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