Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 264335
Collapse All | Expand All

(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_ceil.c (-10 / +15 lines)
Lines 27-46 Link Here
27
double
27
double
28
__ceil (double x)
28
__ceil (double x)
29
{
29
{
30
  double two52 = copysign (0x1.0p52, x);
30
  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
31
  double r, tmp;
31
    {
32
  
32
      double tmp1, new_x;
33
  __asm (
33
34
      new_x = -x;
35
      __asm (
34
#ifdef _IEEE_FP_INEXACT
36
#ifdef _IEEE_FP_INEXACT
35
	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
37
	     "cvttq/svim %2,%1\n\t"
36
#else
38
#else
37
	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
39
	     "cvttq/svm %2,%1\n\t"
38
#endif
40
#endif
39
	 : "=&f"(r), "=&f"(tmp)
41
	     "cvtqt/m %1,%0\n\t"
40
	 : "f"(-x), "f"(-two52));
42
	     : "=f"(new_x), "=&f"(tmp1)
43
	     : "f"(new_x));
41
44
42
  /* Fix up the negation we did above, as well as handling -0 properly. */
45
      /* Fix up the negation we did above, as well as handling -0 properly. */
43
  return copysign (r, x);
46
      x = copysign(new_x, x);
47
    }
48
  return x;
44
}
49
}
45
50
46
weak_alias (__ceil, ceil)
51
weak_alias (__ceil, ceil)
(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_ceilf.c (-10 / +20 lines)
Lines 26-45 Link Here
26
float
26
float
27
__ceilf (float x)
27
__ceilf (float x)
28
{
28
{
29
  float two23 = copysignf (0x1.0p23, x);
29
  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
30
  float r, tmp;
30
    {
31
  
31
      /* Note that Alpha S_Floating is stored in registers in a
32
  __asm (
32
	 restricted T_Floating format, so we don't even need to
33
	 convert back to S_Floating in the end.  The initial
34
	 conversion to T_Floating is needed to handle denormals.  */
35
36
      float tmp1, tmp2, new_x;
37
38
      new_x = -x;
39
      __asm ("cvtst/s %3,%2\n\t"
33
#ifdef _IEEE_FP_INEXACT
40
#ifdef _IEEE_FP_INEXACT
34
	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
41
	     "cvttq/svim %2,%1\n\t"
35
#else
42
#else
36
	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
43
	     "cvttq/svm %2,%1\n\t"
37
#endif
44
#endif
38
	 : "=&f"(r), "=&f"(tmp)
45
	     "cvtqt/m %1,%0\n\t"
39
	 : "f"(-x), "f"(-two23));
46
	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
47
	     : "f"(new_x));
40
48
41
  /* Fix up the negation we did above, as well as handling -0 properly. */
49
      /* Fix up the negation we did above, as well as handling -0 properly. */
42
  return copysignf (r, x);
50
      x = copysignf(new_x, x);
51
    }
52
  return x;
43
}
53
}
44
54
45
weak_alias (__ceilf, ceilf)
55
weak_alias (__ceilf, ceilf)
(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_floor.c (-12 / +18 lines)
Lines 21-46 Link Here
21
#include <math_ldbl_opt.h>
21
#include <math_ldbl_opt.h>
22
22
23
23
24
/* Use the -inf rounding mode conversion instructions to implement floor.  */
24
/* Use the -inf rounding mode conversion instructions to implement
25
   floor.  We note when the exponent is large enough that the value
26
   must be integral, as this avoids unpleasant integer overflows.  */
25
27
26
double
28
double
27
__floor (double x)
29
__floor (double x)
28
{
30
{
29
  double two52 = copysign (0x1.0p52, x);
31
  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
30
  double r, tmp;
32
    {
31
  
33
      double tmp1, new_x;
32
  __asm (
34
35
      __asm (
33
#ifdef _IEEE_FP_INEXACT
36
#ifdef _IEEE_FP_INEXACT
34
	 "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
37
	     "cvttq/svim %2,%1\n\t"
35
#else
38
#else
36
	 "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
39
	     "cvttq/svm %2,%1\n\t"
37
#endif
40
#endif
38
	 : "=&f"(r), "=&f"(tmp)
41
	     "cvtqt/m %1,%0\n\t"
39
	 : "f"(x), "f"(two52));
42
	     : "=f"(new_x), "=&f"(tmp1)
43
	     : "f"(x));
40
44
41
  /* floor(-0) == -0, and in general we'll always have the same
45
      /* floor(-0) == -0, and in general we'll always have the same
42
     sign as our input.  */
46
	 sign as our input.  */
43
  return copysign (r, x);
47
      x = copysign(new_x, x);
48
    }
49
  return x;
44
}
50
}
45
51
46
weak_alias (__floor, floor)
52
weak_alias (__floor, floor)
(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_floorf.c (-12 / +23 lines)
Lines 20-45 Link Here
20
#include <math.h>
20
#include <math.h>
21
21
22
22
23
/* Use the -inf rounding mode conversion instructions to implement floor.  */
23
/* Use the -inf rounding mode conversion instructions to implement
24
   floor.  We note when the exponent is large enough that the value
25
   must be integral, as this avoids unpleasant integer overflows.  */
24
26
25
float
27
float
26
__floorf (float x)
28
__floorf (float x)
27
{
29
{
28
  float two23 = copysignf (0x1.0p23, x);
30
  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
29
  float r, tmp;
31
    {
30
  
32
      /* Note that Alpha S_Floating is stored in registers in a
31
  __asm (
33
	 restricted T_Floating format, so we don't even need to
34
	 convert back to S_Floating in the end.  The initial
35
	 conversion to T_Floating is needed to handle denormals.  */
36
37
      float tmp1, tmp2, new_x;
38
39
      __asm ("cvtst/s %3,%2\n\t"
32
#ifdef _IEEE_FP_INEXACT
40
#ifdef _IEEE_FP_INEXACT
33
	 "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
41
	     "cvttq/svim %2,%1\n\t"
34
#else
42
#else
35
	 "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
43
	     "cvttq/svm %2,%1\n\t"
36
#endif
44
#endif
37
	 : "=&f"(r), "=&f"(tmp)
45
	     "cvtqt/m %1,%0\n\t"
38
	 : "f"(x), "f"(two23));
46
	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
47
	     : "f"(x));
39
48
40
  /* floor(-0) == -0, and in general we'll always have the same
49
      /* floor(-0) == -0, and in general we'll always have the same
41
     sign as our input.  */
50
	 sign as our input.  */
42
  return copysignf (r, x);
51
      x = copysignf(new_x, x);
52
    }
53
  return x;
43
}
54
}
44
55
45
weak_alias (__floorf, floorf)
56
weak_alias (__floorf, floorf)
(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_rint.c (-8 / +17 lines)
Lines 24-38 Link Here
24
double
24
double
25
__rint (double x)
25
__rint (double x)
26
{
26
{
27
  double two52 = copysign (0x1.0p52, x);
27
  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
28
  double r;
28
    {
29
  
29
      double tmp1, new_x;
30
  r = x + two52;
30
      __asm (
31
  r = r - two52;
31
#ifdef _IEEE_FP_INEXACT
32
	     "cvttq/svid %2,%1\n\t"
33
#else
34
	     "cvttq/svd %2,%1\n\t"
35
#endif
36
	     "cvtqt/d %1,%0\n\t"
37
	     : "=f"(new_x), "=&f"(tmp1)
38
	     : "f"(x));
32
39
33
  /* rint(-0.1) == -0, and in general we'll always have the same sign
40
      /* rint(-0.1) == -0, and in general we'll always have the same
34
     as our input.  */
41
	 sign as our input.  */
35
  return copysign (r, x);
42
      x = copysign(new_x, x);
43
    }
44
  return x;
36
}
45
}
37
46
38
weak_alias (__rint, rint)
47
weak_alias (__rint, rint)
(-)glibc-2.9-20081201.old/sysdeps/alpha/fpu/s_rintf.c (-7 / +22 lines)
Lines 23-37 Link Here
23
float
23
float
24
__rintf (float x)
24
__rintf (float x)
25
{
25
{
26
  float two23 = copysignf (0x1.0p23, x);
26
  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
27
  float r;
27
    {
28
      /* Note that Alpha S_Floating is stored in registers in a
29
	 restricted T_Floating format, so we don't even need to
30
	 convert back to S_Floating in the end.  The initial
31
	 conversion to T_Floating is needed to handle denormals.  */
28
32
29
  r = x + two23;
33
      float tmp1, tmp2, new_x;
30
  r = r - two23;
31
34
32
  /* rint(-0.1) == -0, and in general we'll always have the same sign
35
      __asm ("cvtst/s %3,%2\n\t"
33
     as our input.  */
36
#ifdef _IEEE_FP_INEXACT
34
  return copysign (r, x);
37
	     "cvttq/svid %2,%1\n\t"
38
#else
39
	     "cvttq/svd %2,%1\n\t"
40
#endif
41
	     "cvtqt/d %1,%0\n\t"
42
	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
43
	     : "f"(x));
44
45
      /* rint(-0.1) == -0, and in general we'll always have the same
46
	 sign as our input.  */
47
      x = copysignf(new_x, x);
48
    }
49
  return x;
35
}
50
}
36
51
37
weak_alias (__rintf, rintf)
52
weak_alias (__rintf, rintf)

Return to bug 264335