]> git.pld-linux.org Git - packages/glibc.git/blame - glibc-ppc-inline-fsqrt.patch
- note from H. J. Lu.
[packages/glibc.git] / glibc-ppc-inline-fsqrt.patch
CommitLineData
1d239e43 12006-11-03 Steven Munroe <sjmunroe@us.ibm.com>
2
3 * sysdeps/powerpc/fpu/bits/mathinline.h
4 [__LIBC_INTERNAL_MATH_INLINES]: Moved to math_private.h.
5 * sysdeps/powerpc/fpu/math_private.h: New file.
6
7diff -urN libc25-cvstip-20061018/sysdeps/powerpc/fpu/bits/mathinline.h libc24/sysdeps/powerpc/fpu/bits/mathinline.h
8--- libc25-cvstip-20061018/sysdeps/powerpc/fpu/bits/mathinline.h 2006-04-14 00:43:58.000000000 -0500
9+++ libc24/sysdeps/powerpc/fpu/bits/mathinline.h 2006-11-03 17:45:55.517445184 -0600
10@@ -124,59 +124,6 @@
11
12 /* This code is used internally in the GNU libc. */
13 #ifdef __LIBC_INTERNAL_MATH_INLINES
14-
15-#include <sysdep.h>
16-#include <ldsodefs.h>
17-#include <dl-procinfo.h>
18-
19-# if __WORDSIZE == 64 || defined _ARCH_PWR4
20-# define __CPU_HAS_FSQRT 1
21-# else
22-# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
23-# endif
24-
25-extern double __slow_ieee754_sqrt (double);
26-__MATH_INLINE double
27-__NTH (__ieee754_sqrt (double __x))
28-{
29- double __z;
30-
31- /* If the CPU is 64-bit we can use the optional FP instructions. */
32- if (__CPU_HAS_FSQRT)
33- {
34- /* Volatile is required to prevent the compiler from moving the
35- fsqrt instruction above the branch. */
36- __asm __volatile (
37- " fsqrt %0,%1\n"
38- : "=f" (__z)
39- : "f" (__x));
40- }
41- else
42- __z = __slow_ieee754_sqrt(__x);
43-
44- return __z;
45-}
46-
47-extern float __slow_ieee754_sqrtf (float);
48-__MATH_INLINE float
49-__NTH (__ieee754_sqrtf (float __x))
50-{
51- float __z;
52-
53- /* If the CPU is 64-bit we can use the optional FP instructions. */
54- if (__CPU_HAS_FSQRT)
55- {
56- /* Volatile is required to prevent the compiler from moving the
57- fsqrts instruction above the branch. */
58- __asm __volatile (
59- " fsqrts %0,%1\n"
60- : "=f" (__z)
61- : "f" (__x));
62- }
63- else
64- __z = __slow_ieee754_sqrtf(__x);
65-
66- return __z;
67-}
68+/* Moved to math_private.h */
69 #endif /* __LIBC_INTERNAL_MATH_INLINES */
70 #endif /* __GNUC__ && !_SOFT_FLOAT */
71diff -urN libc25-cvstip-20061018/sysdeps/powerpc/fpu/math_private.h libc24/sysdeps/powerpc/fpu/math_private.h
72--- libc25-cvstip-20061018/sysdeps/powerpc/fpu/math_private.h Wed Dec 31 18:00:00 1969
73+++ libc24/sysdeps/powerpc/fpu/math_private.h Fri Nov 03 17:54:05 2006
74@@ -0,0 +1,83 @@
75+/* Private inline math functions for powerpc.
76+ Copyright (C) 2006
77+ Free Software Foundation, Inc.
78+ This file is part of the GNU C Library.
79+
80+ The GNU C Library is free software; you can redistribute it and/or
81+ modify it under the terms of the GNU Lesser General Public
82+ License as published by the Free Software Foundation; either
83+ version 2.1 of the License, or (at your option) any later version.
84+
85+ The GNU C Library is distributed in the hope that it will be useful,
86+ but WITHOUT ANY WARRANTY; without even the implied warranty of
87+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
88+ Lesser General Public License for more details.
89+
90+ You should have received a copy of the GNU Lesser General Public
91+ License along with the GNU C Library; if not, write to the Free
92+ Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
93+ MA 02110-1301 USA */
94+
95+#ifndef _PPC_MATH_PRIVATE_H_
96+#define _PPC_MATH_PRIVATE_H_
97+
98+#include <sysdep.h>
99+#include <ldsodefs.h>
100+#include <dl-procinfo.h>
101+
102+# if __WORDSIZE == 64 || defined _ARCH_PWR4
103+# define __CPU_HAS_FSQRT 1
104+# else
105+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
106+# endif
107+
108+# ifndef __LIBC_INTERNAL_MATH_INLINES
109+extern double __slow_ieee754_sqrt (double);
110+__inline double
111+__ieee754_sqrt (double __x)
112+{
113+ double __z;
114+
115+ /* If the CPU is 64-bit we can use the optional FP instructions. */
116+ if (__CPU_HAS_FSQRT)
117+ {
118+ /* Volatile is required to prevent the compiler from moving the
119+ fsqrt instruction above the branch. */
120+ __asm __volatile (
121+ " fsqrt %0,%1\n"
122+ : "=f" (__z)
123+ : "f" (__x));
124+ }
125+ else
126+ __z = __slow_ieee754_sqrt(__x);
127+
128+ return __z;
129+}
130+
131+extern float __slow_ieee754_sqrtf (float);
132+
133+__inline float
134+__ieee754_sqrtf (float __x)
135+{
136+ float __z;
137+
138+ /* If the CPU is 64-bit we can use the optional FP instructions. */
139+ if (__CPU_HAS_FSQRT)
140+ {
141+ /* Volatile is required to prevent the compiler from moving the
142+ fsqrts instruction above the branch. */
143+ __asm __volatile (
144+ " fsqrts %0,%1\n"
145+ : "=f" (__z)
146+ : "f" (__x));
147+ }
148+ else
149+ __z = __slow_ieee754_sqrtf(__x);
150+
151+ return __z;
152+}
153+#endif /* __LIBC_INTERNAL_MATH_INLINES */
154+
155+# include_next <math_private.h>
156+
157+#endif /* _PPC_MATH_PRIVATE_H_ */
This page took 0.060806 seconds and 4 git commands to generate.