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: serious inline math pb i386


> 
> Yes! I have a test case!
> 

Thanks a lot. Here is the simplied version. The good news is the
current egcs in CVS seems ok. The bad news is the current egcs in
CVS is basically broken :-(.



H.J.
----
static __inline  double
__log2 (double __x)
{
  register double __value;
  __asm __volatile__
    ("fld1\n\t"
     "fxch\n\t"
     "fyl2x"
     : "=t" (__value) : "0" (__x));
  return __value;
}
static __inline  double
pow (double __x, double __y)
{
  register double __value, __exponent;
  long long int __p = (long long int) __y;
  if (__x == 0.0 && __y > 0.0)
    return 0.0;
  if (__y == (double) __p)
    {
      double __r = 1.0;
      if (__p == 0)
	return 1.0;
      if (__p < 0)
	{
	  __p = -__p;
	  __x = 1.0 / __x;
	}
      while (1)
	{
	  if (__p & 1)
	    __r *= __x;
	  __p >>= 1;
	  if (__p == 0)
	    return __r;
	  __x *= __x;
	}
    }
  __asm __volatile__
    ("fmul	%%st(1)		# y * log2(x)\n\t"
     "fstl	%%st(1)\n\t"
     "frndint			# int(y * log2(x))\n\t"
     "fxch\n\t"
     "fsub	%%st(1)		# fract(y * log2(x))\n\t"
     "f2xm1			# 2^(fract(y * log2(x))) - 1\n\t"
     : "=t" (__value), "=u" (__exponent) :  "0" (__log2 (__x)), "1" (__y));
  __value += 1.0;
  __asm __volatile__
    ("fscale"
     : "=t" (__value) : "0" (__value), "u" (__exponent));
  return __value;
}
double pc_ceiling;
double pc_step;
double pc_threshold_dB = 17;
double pc_threshold;
main () {
  double pc_command[1 ];
  int i_pc_loopdelay;
  for (i_pc_loopdelay = 0; i_pc_loopdelay < 1 ; i_pc_loopdelay++)
    pc_command[i_pc_loopdelay] = 0;
  pc_ceiling = pow (10.0, -4.9691  / 10.0);
  pc_step = pow (10.0, 0.5  / 10.0);
  pc_threshold = pow (10.0, pc_threshold_dB / 10.0);
  return 0;
}


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