i386.c (TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
authorJoseph Myers <joseph@codesourcery.com>
Sun, 19 Jun 2005 20:12:16 +0000 (21:12 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Sun, 19 Jun 2005 20:12:16 +0000 (21:12 +0100)
* config/i386/i386.c (TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
(ix86_mangle_fundamental_type): New.
* config/ia64/ia64.c (TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
(ia64_mangle_fundamental_type): New.

testsuite:
* g++.dg/abi/mangle24.C, g++.dg/abi/mangle25.C: New tests.

From-SVN: r101191

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle24.C [new file with mode: 0644]
gcc/testsuite/g++.dg/abi/mangle25.C [new file with mode: 0644]

index 4d0fbeb..ab9dcd3 100644 (file)
@@ -1,3 +1,10 @@
+2005-06-19  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * config/i386/i386.c (TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
+       (ix86_mangle_fundamental_type): New.
+       * config/ia64/ia64.c (TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
+       (ia64_mangle_fundamental_type): New.
+
 2005-06-19  Roger Sayle  <roger@eyesopen.com>
 
        * c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on
index d2484cd..8425ef8 100644 (file)
@@ -905,6 +905,7 @@ static bool ix86_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
                                    tree, bool);
 static void ix86_init_builtins (void);
 static rtx ix86_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
+static const char *ix86_mangle_fundamental_type (tree);
 
 /* This function is only used on Solaris.  */
 static void i386_solaris_elf_named_section (const char *, unsigned int, tree)
@@ -1077,6 +1078,9 @@ static void init_ext_80387_constants (void);
 #define TARGET_INSERT_ATTRIBUTES SUBTARGET_INSERT_ATTRIBUTES
 #endif
 
+#undef TARGET_MANGLE_FUNDAMENTAL_TYPE
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE ix86_mangle_fundamental_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
@@ -17539,4 +17543,22 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags,
   default_elf_asm_named_section (name, flags, decl);
 }
 
+/* Return the mangling of TYPE if it is an extended fundamental type.  */
+
+static const char *
+ix86_mangle_fundamental_type (tree type)
+{
+  switch (TYPE_MODE (type))
+    {
+    case TFmode:
+      /* __float128 is "g".  */
+      return "g";
+    case XFmode:
+      /* "long double" or __float80 is "e".  */
+      return "e";
+    default:
+      return NULL;
+    }
+}
+
 #include "gt-i386.h"
index 5c6d11f..e64962a 100644 (file)
@@ -262,6 +262,7 @@ static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *);
 static bool ia64_scalar_mode_supported_p (enum machine_mode mode);
 static bool ia64_vector_mode_supported_p (enum machine_mode mode);
 static bool ia64_cannot_force_const_mem (rtx);
+static const char *ia64_mangle_fundamental_type (tree);
 \f
 /* Table of valid machine attributes.  */
 static const struct attribute_spec ia64_attribute_table[] =
@@ -429,6 +430,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_CANNOT_FORCE_CONST_MEM
 #define TARGET_CANNOT_FORCE_CONST_MEM ia64_cannot_force_const_mem
 
+#undef TARGET_MANGLE_FUNDAMENTAL_TYPE
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE ia64_mangle_fundamental_type
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 typedef enum
@@ -8639,4 +8643,21 @@ ia64_profile_hook (int labelno)
                     label, Pmode);
 }
 
+/* Return the mangling of TYPE if it is an extended fundamental type.  */
+
+static const char *
+ia64_mangle_fundamental_type (tree type)
+{
+  /* On HP-UX, "long double" is mangled as "e" so __float128 is
+     mangled as "e".  */
+  if (!TARGET_HPUX && TYPE_MODE (type) == TFmode)
+    return "g";
+  /* On HP-UX, "e" is not available as a mangling of __float80 so use
+     an extended mangling.  Elsewhere, "e" is available since long
+     double is 80 bits.  */
+  if (TYPE_MODE (type) == XFmode)
+    return TARGET_HPUX ? "u9__float80" : "e";
+  return NULL;
+}
+
 #include "gt-ia64.h"
index 6178d5f..92b2b71 100644 (file)
@@ -1,3 +1,7 @@
+2005-06-19  Joseph S. Myers  <joseph@codesourcery.com>
+
+       * g++.dg/abi/mangle24.C, g++.dg/abi/mangle25.C: New tests.
+
 2005-06-19  Aldy Hernandez  <aldyh@redhat.com>
 
         PR c++/22115
diff --git a/gcc/testsuite/g++.dg/abi/mangle24.C b/gcc/testsuite/g++.dg/abi/mangle24.C
new file mode 100644 (file)
index 0000000..3a9f629
--- /dev/null
@@ -0,0 +1,12 @@
+// Test mangling of __float80.
+// The C++ ABI document says __float80 is mangled as "e".  It
+// also says that "long double" is mangled as "e", so these conflict on
+// ia64-hpux where "long double" is "e" and __float80 is "u9__float80".
+// Origin: Joseph Myers <joseph@codesourcery.com>
+// { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
+// { dg-options "" } */
+// { dg-final { scan-assembler "_Z1fe" { target i?86-*-* x86_64-*-* } } } */
+// { dg-final { scan-assembler "_Z1fe" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */
+// { dg-final { scan-assembler "_Z1fu9__float80" { target ia64-*-hpux* } } } */
+
+int f(__float80 x) { return 0; }
diff --git a/gcc/testsuite/g++.dg/abi/mangle25.C b/gcc/testsuite/g++.dg/abi/mangle25.C
new file mode 100644 (file)
index 0000000..981f02c
--- /dev/null
@@ -0,0 +1,13 @@
+// Test mangling of __float128.
+// The C++ ABI document says __float128 is mangled as "g".  It
+// also says that "long double" is mangled as "e", so these conflict on
+// ia64-hpux where "long double" is "e" and __float128 is synonymous with
+// "long double".
+// Origin: Joseph Myers <joseph@codesourcery.com>
+// { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
+// { dg-options "" } */
+// { dg-final { scan-assembler "_Z1fg" { target i?86-*-* x86_64-*-* } } } */
+// { dg-final { scan-assembler "_Z1fg" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */
+// { dg-final { scan-assembler "_Z1fe" { target ia64-*-hpux* } } } */
+
+int f(__float128 x) { return 0; }