~ubuntu-branches/ubuntu/precise/eglibc/precise

« back to all changes in this revision

Viewing changes to sysdeps/powerpc/fpu/e_sqrt.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-10-04 17:48:26 UTC
  • mfrom: (216.1.23 oneiric)
  • Revision ID: package-import@ubuntu.com-20111004174826-2cyb9ewn3ucymlsx
Tags: 2.13-20ubuntu5
libc6-dev: Don't break the current {gnat,gcj}-4.4-base versons. LP: #853688.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Double-precision floating point square root.
2
 
   Copyright (C) 1997, 2002-2004, 2008, 2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
3
3
   This file is part of the GNU C Library.
4
4
 
5
5
   The GNU C Library is free software; you can redistribute it and/or
46
46
   generated guesses (which mostly runs on the integer unit, while the
47
47
   Newton-Raphson is running on the FPU).  */
48
48
 
 
49
#ifdef __STDC__
49
50
double
50
51
__slow_ieee754_sqrt (double x)
 
52
#else
 
53
double
 
54
__slow_ieee754_sqrt (x)
 
55
     double x;
 
56
#endif
51
57
{
52
58
  const float inf = a_inf.value;
53
59
 
54
60
  if (x > 0)
55
61
    {
56
62
      /* schedule the EXTRACT_WORDS to get separation between the store
57
 
         and the load.  */
 
63
         and the load.  */
58
64
      ieee_double_shape_type ew_u;
59
65
      ieee_double_shape_type iw_u;
60
66
      ew_u.value = (x);
141
147
  else if (x < 0)
142
148
    {
143
149
      /* For some reason, some PowerPC32 processors don't implement
144
 
         FE_INVALID_SQRT.  */
 
150
         FE_INVALID_SQRT.  */
145
151
#ifdef FE_INVALID_SQRT
146
152
      feraiseexcept (FE_INVALID_SQRT);
147
153
 
154
160
  return f_wash (x);
155
161
}
156
162
 
157
 
#undef __ieee754_sqrt
 
163
#ifdef __STDC__
158
164
double
159
165
__ieee754_sqrt (double x)
 
166
#else
 
167
double
 
168
__ieee754_sqrt (x)
 
169
     double x;
 
170
#endif
160
171
{
161
172
  double z;
162
173
 
164
175
  if (__CPU_HAS_FSQRT)
165
176
    {
166
177
      /* Volatile is required to prevent the compiler from moving the
167
 
         fsqrt instruction above the branch.  */
 
178
         fsqrt instruction above the branch.  */
168
179
      __asm __volatile ("       fsqrt   %0,%1\n"
169
180
                                :"=f" (z):"f" (x));
170
181
    }
173
184
 
174
185
  return z;
175
186
}
176
 
strong_alias (__ieee754_sqrt, __sqrt_finite)