__float128 typeinfo

Marc Glisse marc.glisse@inria.fr
Fri Jun 6 17:21:00 GMT 2014


On Fri, 6 Jun 2014, Jason Merrill wrote:

> On 06/06/2014 11:58 AM, Marc Glisse wrote:
>> On Fri, 6 Jun 2014, Jason Merrill wrote:
>> 
>>> What's your rationale for keeping this in a separate version block
>>> rather than in 1.3.9 (like __int128)?
>> 
>> Powerpc already has those symbols in CXXABI_LDBL_1.3 (for a type that
>> isn't __float128 but (de)mangles that way). That doesn't prevent from
>> using CXXABI_1.3.9 in the x86/ia64-specific file though, so I can do
>> that if you prefer. If a new target implements __float128 in 4.11 or
>> 4.12, they will have to refine the configure test and provide a
>> different .ver file to avoid adding symbols to an old version.
>
> Fair enough.  Let's stick with your approach then, but drop the 1.3.9 from 
> the name.

Ok. To help with the review, I am appending the updated patch (untested). 
(if we add numeric_limits<__float128> later, I think it should go into 
GLIBCXX_FLOAT128_1)

> Why is __float128 handled as a target type, anyway?  I'd think it ought to be 
> a standard type that just isn't supported on all targets, like __int128.

I don't know. Since it is implemented in software on all platforms as far 
as I know, it shouldn't be that specific to a target. But it isn't just 
__float128, on some targets my patch may start generating extra symbols 
for half-floats (ARM) or __float80.

DJ Delorie's work on __intN may be a good direction for __floatN as well, 
IIUC we will have a global list of 4 __intN types, and the target decides 
the value of N for each of them, so we can refer to those type nodes in 
common code but they are still target-specific. Or maybe there isn't 
enough variety in float types to deserve this.

-- 
Marc Glisse
-------------- next part --------------
Index: gcc/cp/rtti.c
===================================================================
--- gcc/cp/rtti.c	(revision 211311)
+++ gcc/cp/rtti.c	(working copy)
@@ -1540,20 +1540,31 @@ emit_support_tinfos (void)
 			/*tag_scope=*/ts_current, false);
   pop_abi_namespace ();
   if (!COMPLETE_TYPE_P (bltn_type))
     return;
   dtor = CLASSTYPE_DESTRUCTORS (bltn_type);
   if (!dtor || DECL_EXTERNAL (dtor))
     return;
   doing_runtime = 1;
   for (ix = 0; fundamentals[ix]; ix++)
     emit_support_tinfo_1 (*fundamentals[ix]);
+
+  /* Search for an extra floating point type like __float128.  */
+  for (enum machine_mode mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT);
+       mode != VOIDmode;
+       mode = GET_MODE_WIDER_MODE (mode))
+    {
+      tree type = c_common_type_for_mode (mode, false);
+      if (type && type != float_type_node && type != double_type_node
+	  && type != long_double_type_node)
+	emit_support_tinfo_1 (type);
+    }
 }
 
 /* Finish a type info decl. DECL_PTR is a pointer to an unemitted
    tinfo decl.  Determine whether it needs emitting, and if so
    generate the initializer.  */
 
 bool
 emit_tinfo_decl (tree decl)
 {
   tree type = TREE_TYPE (DECL_NAME (decl));
Index: libstdc++-v3/config/abi/pre/float128.ver
===================================================================
--- libstdc++-v3/config/abi/pre/float128.ver	(revision 0)
+++ libstdc++-v3/config/abi/pre/float128.ver	(working copy)
@@ -0,0 +1,10 @@
+# Appended to version file.
+
+CXXABI_FLOAT128 {
+
+    # typeinfo and typeinfo name for __float128
+    _ZT[IS]g;
+    _ZT[IS]Pg;
+    _ZT[IS]PKg;
+
+};
Index: libstdc++-v3/configure
===================================================================
--- libstdc++-v3/configure	(revision 211311)
+++ libstdc++-v3/configure	(working copy)
@@ -15698,20 +15698,23 @@ $as_echo "#define _GLIBCXX_USE_FLOAT128
 $as_echo "$enable_float128" >&6; }
     rm -f conftest*
 
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+if test "$enable_float128" = yes; then
+  port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/abi/pre/float128.ver"
+fi
 
 # Checks for compiler support that doesn't require linking.
 
   # All these tests are for C++; save the language and the compiler flags.
   # The CXXFLAGS thing is suspicious, but based on similar bits previously
   # found in GLIBCXX_CONFIGURE.
 
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Index: libstdc++-v3/configure.ac
===================================================================
--- libstdc++-v3/configure.ac	(revision 211311)
+++ libstdc++-v3/configure.ac	(working copy)
@@ -146,20 +146,23 @@ GLIBCXX_ENABLE_HOSTED
 # Enable descriptive messages to standard output on termination.
 GLIBCXX_ENABLE_VERBOSE
 
 # Enable compiler support that doesn't require linking.
 GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
 GLIBCXX_ENABLE_PCH($is_hosted)
 GLIBCXX_ENABLE_THREADS
 GLIBCXX_ENABLE_ATOMIC_BUILTINS
 GLIBCXX_ENABLE_DECIMAL_FLOAT
 GLIBCXX_ENABLE_INT128_FLOAT128
+if test "$enable_float128" = yes; then
+  port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/abi/pre/float128.ver"
+fi
 
 # Checks for compiler support that doesn't require linking.
 GLIBCXX_CHECK_COMPILER_FEATURES
 
 # Enable all the variable C++ runtime options that don't require linking.
 GLIBCXX_ENABLE_CSTDIO
 GLIBCXX_ENABLE_CLOCALE
 GLIBCXX_ENABLE_ALLOCATOR
 GLIBCXX_ENABLE_CHEADERS($c_model)  dnl c_model from configure.host
 GLIBCXX_ENABLE_LONG_LONG([yes])
Index: libstdc++-v3/testsuite/util/testsuite_abi.cc
===================================================================
--- libstdc++-v3/testsuite/util/testsuite_abi.cc	(revision 211311)
+++ libstdc++-v3/testsuite/util/testsuite_abi.cc	(working copy)
@@ -206,47 +206,50 @@ check_version(symbol& test, bool added)
       known_versions.push_back("CXXABI_1.3.1");
       known_versions.push_back("CXXABI_1.3.2");
       known_versions.push_back("CXXABI_1.3.3");
       known_versions.push_back("CXXABI_1.3.4");
       known_versions.push_back("CXXABI_1.3.5");
       known_versions.push_back("CXXABI_1.3.6");
       known_versions.push_back("CXXABI_1.3.7");
       known_versions.push_back("CXXABI_1.3.8");
       known_versions.push_back("CXXABI_1.3.9");
       known_versions.push_back("CXXABI_TM_1");
+      known_versions.push_back("CXXABI_FLOAT128");
     }
   compat_list::iterator begin = known_versions.begin();
   compat_list::iterator end = known_versions.end();
 
   // Check for compatible version.
   if (test.version_name.size())
     {
       compat_list::iterator it1 = find(begin, end, test.version_name);
       compat_list::iterator it2 = find(begin, end, test.name);
       if (it1 != end)
 	test.version_status = symbol::compatible;
       else
 	test.version_status = symbol::incompatible;
 
       // Check that added symbols are added in the latest pre-release version.
       bool latestp = (test.version_name == "GLIBCXX_3.4.21"
 		     || test.version_name == "CXXABI_1.3.9"
+		     || test.version_name == "CXXABI_FLOAT128"
 		     || test.version_name == "CXXABI_TM_1");
       if (added && !latestp)
 	test.version_status = symbol::incompatible;
 
       // Check that long double compatibility symbols demangled as
-      // __float128 are put into some _LDBL_ version name.
+      // __float128 and regular __float128 symbols are put into some _LDBL_
+      // or _FLOAT128 version name.
       if (added && test.demangled_name.find("__float128") != std::string::npos)
 	{
-	  // Has to be in _LDBL_ version name.
-	  if (test.version_name.find("_LDBL_") == std::string::npos)
+	  if (test.version_name.find("_LDBL_") == std::string::npos
+	      && test.version_name.find("_FLOAT128") == std::string::npos)
 	    test.version_status = symbol::incompatible;
 	}
 
       // Check for weak label.
       if (it1 == end && it2 == end)
 	test.version_status = symbol::incompatible;
 
       // Check that
       // GLIBCXX_3.4
       // GLIBCXX_3.4.5


More information about the Gcc-patches mailing list