------- Comment #2 from merkert at comcast dot net  2008-01-05 15:38 -------
Ok, so how then would one accomplish this in std c without resorting to asm? I
still assume the original code is correct even though the rounding-math doesn't
do what I wanted.

At any rate, I played a little with it and there was hint in the asm manual how
to do it. This seems to work for me, but I'm not sure I'm using the constraints
as efficiently as possible:

#include <fenv.h>

inline void reload(double* x)
{
  asm volatile ("" : "=m"(x) );
}

void xdiv (double x, double y, double* lo, double* hi)
{
  #pragma STDC FENV_ACCESS ON
  fesetround(FE_DOWNWARD);
  *lo = x/y;

  reload(&y);

  fesetround(FE_UPWARD);
  *hi = x/y;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678

Reply via email to