This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch: Optionally use -mlong-double-128 by default on sparc
> > +#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
> > + if (target_flags_explicit & MASK_LONG_DOUBLE_128)
> > + target_flags |= MASK_LONG_DOUBLE_128;
> > +#endif
>
> ... has changed since the first version (disregarding !TARGET_64BIT):
>
> +#if defined SPARC_LINUX && defined TARGET_DEFAULT_LONG_DOUBLE_128
> + if (!TARGET_64BIT && !(target_flags_explicit & MASK_LONG_DOUBLE_128))
> + target_flags |= MASK_LONG_DOUBLE_128;
> +#endif
In the patch I'm attaching below I now have:
#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
target_flags |= MASK_LONG_DOUBLE_128;
#endif
I swear, that "!" deleted itself ;-).
How does this look?
* config/sparc/linux.h (TARGET_ALTERNATE_LONG_DOUBLE_MANGLING):
Define.
* config/sparc/linux64.h (TARGET_ALTERNATE_LONG_DOUBLE_MANGLING):
Define.
* config/sparc/sparc.c (sparc_override_options): Handle
TARGET_DEFAULT_LONG_DOUBLE_128.
(TARGET_MANGLE_FUNDAMENTAL_TYPE): Define.
(sparc_mangle_fundamental_type): New.
Index: config/sparc/linux.h
===================================================================
--- config/sparc/linux.h (revision 110556)
+++ config/sparc/linux.h (working copy)
@@ -229,3 +229,6 @@ do { \
/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */
#define TARGET_THREAD_SSP_OFFSET 0x14
#endif
+
+/* Define if long doubles should be mangled as 'g'. */
+#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
Index: config/sparc/linux64.h
===================================================================
--- config/sparc/linux64.h (revision 110556)
+++ config/sparc/linux64.h (working copy)
@@ -364,3 +364,6 @@ do { \
sparc64 glibc provides it at [%g7 + 0x28]. */
#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
#endif
+
+/* Define if long doubles should be mangled as 'g'. */
+#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c (revision 110556)
+++ config/sparc/sparc.c (working copy)
@@ -368,6 +368,9 @@ static int sparc_arg_partial_bytes (CUMU
static void sparc_dwarf_handle_frame_unspec (const char *, rtx, int);
static void sparc_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static void sparc_file_end (void);
+#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+static const char *sparc_mangle_fundamental_type (tree);
+#endif
#ifdef SUBTARGET_ATTRIBUTE_TABLE
const struct attribute_spec sparc_attribute_table[];
#endif
@@ -527,6 +530,11 @@ static bool fpu_option_set = false;
#undef TARGET_ASM_FILE_END
#define TARGET_ASM_FILE_END sparc_file_end
+#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+#undef TARGET_MANGLE_FUNDAMENTAL_TYPE
+#define TARGET_MANGLE_FUNDAMENTAL_TYPE sparc_mangle_fundamental_type
+#endif
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@@ -782,6 +790,11 @@ sparc_override_options (void)
sparc_costs = &ultrasparc3_costs;
break;
};
+
+#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
+ if (!(target_flags_explicit & MASK_LONG_DOUBLE_128))
+ target_flags |= MASK_LONG_DOUBLE_128;
+#endif
}
#ifdef SUBTARGET_ATTRIBUTE_TABLE
@@ -8713,6 +8726,23 @@ sparc_file_end (void)
file_end_indicate_exec_stack ();
}
+#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
+/* Implement TARGET_MANGLE_FUNDAMENTAL_TYPE. */
+
+static const char *
+sparc_mangle_fundamental_type (tree type)
+{
+ if (!TARGET_64BIT
+ && TYPE_MAIN_VARIANT (type) == long_double_type_node
+ && TARGET_LONG_DOUBLE_128)
+ return "g";
+#endif
+
+ /* For all other types, use normal C++ mangling. */
+ return NULL;
+}
+#endif
+
/* Expand code to perform a 8 or 16-bit compare and swap by doing 32-bit
compare and swap on the word containing the byte or half-word. */