From 4e11e0fcfb96a3ff9d4a8445b22bcfdaabc5c226 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sun, 19 Jun 2005 20:12:16 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101191 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 22 ++++++++++++++++++++++ gcc/config/ia64/ia64.c | 21 +++++++++++++++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/abi/mangle24.C | 12 ++++++++++++ gcc/testsuite/g++.dg/abi/mangle25.C | 13 +++++++++++++ 6 files changed, 79 insertions(+) create mode 100644 gcc/testsuite/g++.dg/abi/mangle24.C create mode 100644 gcc/testsuite/g++.dg/abi/mangle25.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d0fbebdc90..ab9dcd36919 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-06-19 Joseph S. Myers + + * 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 * c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d2484cd15c2..8425ef83b95 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; @@ -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" diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 5c6d11fd371..e64962a8bd0 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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); /* 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; 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" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6178d5f10e3..92b2b715925 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-06-19 Joseph S. Myers + + * g++.dg/abi/mangle24.C, g++.dg/abi/mangle25.C: New tests. + 2005-06-19 Aldy Hernandez 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 index 00000000000..3a9f629d5bf --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle24.C @@ -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 +// { 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 index 00000000000..981f02c4ef8 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle25.C @@ -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 +// { 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; } -- 2.11.0