This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch / RFA] Use builtins for the classification macros


Hi,

I'm finishing testing on x86_64-linux this patch: in my experiments, we
get optimal code generation for constant arguments and we shave a couple
of K of templates from a very used header. Can you imagine anything
wrong with it? (I'm explicitly adding Richard in CC, as middle-end
maintainer).

Paolo.

////////////////////
2007-11-26  Paolo Carlini  <pcarlini@suse.de>

	* include/c_std/cmath (__gnu_cxx::__capture_isfinite,
	__capture_isinf, __capture_isnan, __capture_isnormal,
	__capture_signbit, __capture_isgreater, __capture_isgreaterequal,
	__capture_isless, __capture_islessequal, __capture_islessgreater,
	__capture_isunordered): Remove.
	(std::isfinite, isinf, isnan, isnormal, signbit, isgreater,
	isgreaterequal, isless, islessequal, islessgreater, isunordered):
	Use the corresponding builtin.
	* include/c_global/cmath: Likewise.
Index: include/c_std/cmath
===================================================================
--- include/c_std/cmath	(revision 130433)
+++ include/c_std/cmath	(working copy)
@@ -467,55 +467,6 @@
     inline int
     __capture_fpclassify(_Tp __f) { return fpclassify(__f); }
 
-  template<typename _Tp>
-    inline int
-    __capture_isfinite(_Tp __f) { return isfinite(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isinf(_Tp __f) { return isinf(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isnan(_Tp __f) { return isnan(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isnormal(_Tp __f) { return isnormal(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_signbit(_Tp __f) { return signbit(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isgreater(_Tp __f1, _Tp __f2)
-    { return isgreater(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isgreaterequal(_Tp __f1, _Tp __f2)
-    { return isgreaterequal(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_islessequal(_Tp __f1, _Tp __f2)
-    { return islessequal(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_islessgreater(_Tp __f1, _Tp __f2)
-    { return islessgreater(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isunordered(_Tp __f1, _Tp __f2)
-    { return isunordered(__f1, __f2); }
-
 _GLIBCXX_END_NAMESPACE
 
 // Only undefine the C99 FP macros, if actually captured for namespace movement
@@ -540,53 +491,51 @@
 
   template<typename _Tp>
     inline int
-    isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }
+    isfinite(_Tp __f) { return __builtin_isfinite(__f); }
 
   template<typename _Tp>
     inline int
-    isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); }
+    isinf(_Tp __f) { return __builtin_isinf(__f); }
 
   template<typename _Tp>
     inline int
-    isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
+    isnan(_Tp __f) { return __builtin_isnan(__f); }
 
   template<typename _Tp>
     inline int
-    isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); }
+    isnormal(_Tp __f) { return __builtin_isnormal(__f); }
 
   template<typename _Tp>
     inline int
-    signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); }
+    signbit(_Tp __f) { return __builtin_signbit(__f); }
 
   template<typename _Tp>
     inline int
-    isgreater(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); }
+    isgreater(_Tp __f1, _Tp __f2) { return __builtin_isgreater(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     isgreaterequal(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); }
+    { return __builtin_isgreaterequal(__f1, __f2); }
 
   template<typename _Tp>
     inline int
-    isless(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isless(__f1, __f2); }
+    isless(_Tp __f1, _Tp __f2) { return __builtin_isless(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     islessequal(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); }
+    { return __builtin_islessequal(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     islessgreater(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); }
+    { return __builtin_islessgreater(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     isunordered(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); }
+    { return __builtin_isunordered(__f1, __f2); }
 
 _GLIBCXX_END_NAMESPACE
 
Index: include/c_global/cmath
===================================================================
--- include/c_global/cmath	(revision 130433)
+++ include/c_global/cmath	(working copy)
@@ -478,55 +478,6 @@
     inline int
     __capture_fpclassify(_Tp __f) { return fpclassify(__f); }
 
-  template<typename _Tp>
-    inline int
-    __capture_isfinite(_Tp __f) { return isfinite(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isinf(_Tp __f) { return isinf(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isnan(_Tp __f) { return isnan(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isnormal(_Tp __f) { return isnormal(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_signbit(_Tp __f) { return signbit(__f); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isgreater(_Tp __f1, _Tp __f2)
-    { return isgreater(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isgreaterequal(_Tp __f1, _Tp __f2)
-    { return isgreaterequal(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_islessequal(_Tp __f1, _Tp __f2)
-    { return islessequal(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_islessgreater(_Tp __f1, _Tp __f2)
-    { return islessgreater(__f1, __f2); }
-
-  template<typename _Tp>
-    inline int
-    __capture_isunordered(_Tp __f1, _Tp __f2)
-    { return isunordered(__f1, __f2); }
-
 _GLIBCXX_END_NAMESPACE
 
 // Only undefine the C99 FP macros, if actually captured for namespace movement
@@ -551,53 +502,51 @@
 
   template<typename _Tp>
     inline int
-    isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }
+    isfinite(_Tp __f) { return __builtin_isfinite(__f); }
 
   template<typename _Tp>
     inline int
-    isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); }
+    isinf(_Tp __f) { return __builtin_isinf(__f); }
 
   template<typename _Tp>
     inline int
-    isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
+    isnan(_Tp __f) { return __builtin_isnan(__f); }
 
   template<typename _Tp>
     inline int
-    isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); }
+    isnormal(_Tp __f) { return __builtin_isnormal(__f); }
 
   template<typename _Tp>
     inline int
-    signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); }
+    signbit(_Tp __f) { return __builtin_signbit(__f); }
 
   template<typename _Tp>
     inline int
-    isgreater(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); }
+    isgreater(_Tp __f1, _Tp __f2) { return __builtin_isgreater(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     isgreaterequal(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); }
+    { return __builtin_isgreaterequal(__f1, __f2); }
 
   template<typename _Tp>
     inline int
-    isless(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isless(__f1, __f2); }
+    isless(_Tp __f1, _Tp __f2) { return __builtin_isless(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     islessequal(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); }
+    { return __builtin_islessequal(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     islessgreater(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); }
+    { return __builtin_islessgreater(__f1, __f2); }
 
   template<typename _Tp>
     inline int
     isunordered(_Tp __f1, _Tp __f2)
-    { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); }
+    { return __builtin_isunordered(__f1, __f2); }
 
 _GLIBCXX_END_NAMESPACE
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]