From: Michael Meissner <meissner@linux.vnet.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Subject: [PATCH], Enable IBM/IEEE long double format to overriden more easily
Date: Sat, 21 Oct 2017 14:03:00 -0000 [thread overview]
Message-ID: <20171021130958.GA29672@ibm-tiger.the-meissners.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]
As Segher and I were discussing off-line, I have some problems with the current
-mabi={ieee,ibm}longdouble switches as we start to planning to modify GCC 9 and
GLIBC 2.27/2.28 to support __float128 as the default long double format for
power server systems.
My gripes are:
1) Using Warn() in rs6000.opt means that you get two warning messages when
you use the switches (one from the driver, and one from cc1).
2) I feel you should not get a warning if you select the option that
reflects the current default behavior (i.e. -mabi=ibmlongdouble
currently for power server systems).
3) There is no way to silenece the warning (i.e. -w doesn't work on
warnings in the .opt file). Both GLIBC and LIBGCC will need the
ability to build support modules with an explicit long double format.
4) In the future we will need a little more flexibility in how the default
is set.
5) There is a mis-match between the documentation and rs6000.opt, as these
switches are documented, but use Undocumented in the rs6000.opt.
These patches fix these issues. If you use -Wno-psabi, it will silence the
warning. I have built these patches on a little endian power8 system, and
there were no regressions. Can I check these patches into the trunk?
2017-10-21 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/aix.h (TARGET_IEEEQUAD_DEFAULT): Set long double
default to IBM.
* config/rs6000/darwin.h (TARGET_IEEEQUAD_DEFAULT): Likewise.
* config/rs6000/rs6000.opt (-mabi=ieeelongdouble): Move the
warning to rs6000.c. Remove the Undocumented flag, since it has
been documented.
(-mabi=ibmlongdouble): Likewise.
* config/rs6000/rs6000.c (TARGET_IEEEQUAD_DEFAULT): If it is not
already set, set the default format for long double.
(rs6000_debug_reg_global): Print whether long double is IBM or
IEEE.
(rs6000_option_override_internal): Rework setting long double
format. Only warn if the user is changing the long double default
and they did not use -Wno-psabi.
* doc/invoke.texi (PowerPC options): Update the documentation for
-mabi=ieeelongdouble and -mabi=ibmlongdouble.
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797
[-- Attachment #2: gcc-power9.patch298b --]
[-- Type: text/plain, Size: 5663 bytes --]
Index: gcc/config/rs6000/aix.h
===================================================================
--- gcc/config/rs6000/aix.h (revision 253961)
+++ gcc/config/rs6000/aix.h (working copy)
@@ -78,6 +78,9 @@
#undef TARGET_IEEEQUAD
#define TARGET_IEEEQUAD 0
+#undef TARGET_IEEEQUAD_DEFAULT
+#define TARGET_IEEEQUAD_DEFAULT 0
+
/* The AIX linker will discard static constructors in object files before
collect has a chance to see them, so scan the object files directly. */
#define COLLECT_EXPORT_LIST
Index: gcc/config/rs6000/rs6000.opt
===================================================================
--- gcc/config/rs6000/rs6000.opt (revision 253961)
+++ gcc/config/rs6000/rs6000.opt (working copy)
@@ -381,10 +381,10 @@ mabi=d32
Target RejectNegative Undocumented Warn(using old darwin ABI) Var(rs6000_darwin64_abi, 0)
mabi=ieeelongdouble
-Target RejectNegative Undocumented Warn(using IEEE extended precision long double) Var(rs6000_ieeequad) Save
+Target RejectNegative Var(rs6000_ieeequad) Save
mabi=ibmlongdouble
-Target RejectNegative Undocumented Warn(using IBM extended precision long double) Var(rs6000_ieeequad, 0)
+Target RejectNegative Var(rs6000_ieeequad, 0)
mcpu=
Target RejectNegative Joined Var(rs6000_cpu_index) Init(-1) Enum(rs6000_cpu_opt_value) Save
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h (revision 253961)
+++ gcc/config/rs6000/darwin.h (working copy)
@@ -274,6 +274,9 @@ extern int darwin_emit_branch_islands;
#undef TARGET_IEEEQUAD
#define TARGET_IEEEQUAD 0
+#undef TARGET_IEEEQUAD_DEFAULT
+#define TARGET_IEEEQUAD_DEFAULT 0
+
/* Since Darwin doesn't do TOCs, stub this out. */
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) ((void)X, (void)MODE, 0)
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 253961)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -86,6 +86,20 @@
#define TARGET_NO_PROTOTYPE 0
#endif
+ /* Set -mabi=ieeelongdouble on some old targets. In the future, power server
+ systems will also set long double to be IEEE 128-bit. AIX and Darwin
+ explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
+ those systems will not pick up this default. This needs to be after all
+ of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
+ properly defined. */
+#ifndef TARGET_IEEEQUAD_DEFAULT
+#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
+#define TARGET_IEEEQUAD_DEFAULT 1
+#else
+#define TARGET_IEEEQUAD_DEFAULT 0
+#endif
+#endif
+
#define min(A,B) ((A) < (B) ? (A) : (B))
#define max(A,B) ((A) > (B) ? (A) : (B))
@@ -2875,6 +2889,13 @@ rs6000_debug_reg_global (void)
fprintf (stderr, DEBUG_FMT_D, "tls_size", rs6000_tls_size);
fprintf (stderr, DEBUG_FMT_D, "long_double_size",
rs6000_long_double_type_size);
+ if (rs6000_long_double_type_size == 128)
+ {
+ fprintf (stderr, DEBUG_FMT_S, "long double type",
+ TARGET_IEEEQUAD ? "IEEE" : "IBM");
+ fprintf (stderr, DEBUG_FMT_S, "default long double type",
+ TARGET_IEEEQUAD_DEFAULT ? "IEEE" : "IBM");
+ }
fprintf (stderr, DEBUG_FMT_D, "sched_restricted_insns_priority",
(int)rs6000_sched_restricted_insns_priority);
fprintf (stderr, DEBUG_FMT_D, "Number of standard builtins",
@@ -4557,13 +4578,26 @@ rs6000_option_override_internal (bool gl
rs6000_long_double_type_size = RS6000_DEFAULT_LONG_DOUBLE_SIZE;
}
- /* Set -mabi=ieeelongdouble on some old targets. Note, AIX and Darwin
- explicitly redefine TARGET_IEEEQUAD to 0, so those systems will not
- pick up this default. */
-#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
+ /* Set -mabi=ieeelongdouble on some old targets. In the future, power server
+ systems will also set long double to be IEEE 128-bit. AIX and Darwin
+ explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
+ those systems will not pick up this default. Warn if the user changes the
+ default unless -Wno-psabi. */
if (!global_options_set.x_rs6000_ieeequad)
- rs6000_ieeequad = 1;
-#endif
+ rs6000_ieeequad = TARGET_IEEEQUAD_DEFAULT;
+
+ else if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
+ {
+ static bool warned_change_long_double;
+ if (!warned_change_long_double && warn_psabi)
+ {
+ warned_change_long_double = true;
+ if (TARGET_IEEEQUAD)
+ warning (0, "Using IEEE extended precision long double");
+ else
+ warning (0, "Using IBM extended precision long double");
+ }
+ }
/* Enable the default support for IEEE 128-bit floating point on Linux VSX
sytems. In GCC 7, we would enable the the IEEE 128-bit floating point
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 253961)
+++ gcc/doc/invoke.texi (working copy)
@@ -22607,12 +22607,14 @@ Disable Book-E SPE ABI extensions for th
@item -mabi=ibmlongdouble
@opindex mabi=ibmlongdouble
Change the current ABI to use IBM extended-precision long double.
-This is a PowerPC 32-bit SYSV ABI option.
+This is not likely to work if your system defaults to using IEEE
+extended-precision long double.
@item -mabi=ieeelongdouble
@opindex mabi=ieeelongdouble
Change the current ABI to use IEEE extended-precision long double.
-This is a PowerPC 32-bit Linux ABI option.
+This is not likely to work if your system defaults to using IBM
+extended-precision long double.
@item -mabi=elfv1
@opindex mabi=elfv1
next reply other threads:[~2017-10-21 13:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-21 14:03 Michael Meissner [this message]
2017-10-26 0:11 ` Segher Boessenkool
2017-10-26 17:47 ` Michael Meissner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171021130958.GA29672@ibm-tiger.the-meissners.org \
--to=meissner@linux.vnet.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).