aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Quinn <jlquinn@optonline.net>2003-03-22 04:57:46 +0000
committerJerry Quinn <jlquinn@gcc.gnu.org>2003-03-22 04:57:46 +0000
commit442c0874ea857deaed375a626f848ac97a4fbcaf (patch)
treef76ebc4c815b88c0e3338e18655c64f0fec362b2
parentd9b2742a3d4bfc03500e14e4e9bcc7ae9275a079 (diff)
downloadgcc-442c0874ea857deaed375a626f848ac97a4fbcaf.zip
gcc-442c0874ea857deaed375a626f848ac97a4fbcaf.tar.gz
gcc-442c0874ea857deaed375a626f848ac97a4fbcaf.tar.bz2
re PR libstdc++/5730 (complex<double>::norm() -- huge slowdown from egcs-2.91.66)
2003-03-21 Jerry Quinn <jlquinn@optonline.net> PR libstdc++/5730 * include/bits/c++config (_GLIBCPP_FAST_MATH): Define. * include/std/std_complex.h (norm): Use faster, less accurate computation for builtin float types under --fast-math. From-SVN: r64701
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/c++config7
-rw-r--r--libstdc++-v3/include/std/std_complex.h2
3 files changed, 15 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 71793c6..30583b0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-21 Jerry Quinn <jlquinn@optonline.net>
+
+ PR libstdc++/5730
+ * include/bits/c++config (_GLIBCPP_FAST_MATH): Define.
+ * include/std/std_complex.h (norm): Use faster,
+ less accurate computation for builtin float types under --fast-math.
+
2003-03-21 Magnus Fromreide <gnats@magfr.user.lysator.liu.se>
* testsuite/testsuite_hooks.h: Fix warning nits.
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index f833b41..829fe7e 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -87,6 +87,13 @@
#error __USE_MALLOC should never be defined. Read the release notes.
#endif
+// Create a boolean flag to be used to determine if --fast-math is set.
+#ifdef __FAST_MATH__
+#define _GLIBCPP_FAST_MATH 1
+#else
+#define _GLIBCPP_FAST_MATH 0
+#endif
+
// The remainder of the prewritten config is mostly automatic; all the
// user hooks are listed above.
diff --git a/libstdc++-v3/include/std/std_complex.h b/libstdc++-v3/include/std/std_complex.h
index 955a12c..87e4bcb 100644
--- a/libstdc++-v3/include/std/std_complex.h
+++ b/libstdc++-v3/include/std/std_complex.h
@@ -456,7 +456,7 @@ namespace std
inline _Tp
norm(const complex<_Tp>& __z)
{
- return _Norm_helper<__is_floating<_Tp>::_M_type>::_S_do_it(__z);
+ return _Norm_helper<__is_floating<_Tp>::_M_type && !_GLIBCPP_FAST_MATH>::_S_do_it(__z);
}
template<typename _Tp>