From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Meissner <meissner@linux.ibm.com>,
gcc-patches@gcc.gnu.org, David Edelsohn <dje.gcc@gmail.com>,
Bill Schmidt <wschmidt@linux.ibm.com>,
Peter Bergner <bergner@linux.ibm.com>, Jeff Law <law@redhat.com>,
Jonathan Wakely <jwakely@redhat.com>
Subject: Re: [PATCH 1/9, revised] PowerPC: Map long double built-in functions if IEEE 128-bit long double.
Date: Fri, 16 Oct 2020 15:30:56 -0500 [thread overview]
Message-ID: <20201016203056.GM2672@gate.crashing.org> (raw)
In-Reply-To: <20201009043543.GA11343@ibm-toto.the-meissners.org>
On Fri, Oct 09, 2020 at 12:35:44AM -0400, Michael Meissner wrote:
> This patch is revised from the first version of the patch posted.
In the future, please send a NEW series, in a NEW thread, when you have
a new series. I was waiting for a new series (because you needed
changes), and I missed that you posted it in the old thread.
If you do not want to because the patches are independent (and not
actually a series), you can send them as independent patches as well
(and that is easier to handle, independent things become much more
obviously independent!)
> Normally the mapping is done in the math.h and stdio.h files. However, not
> everybody uses these files, which means we also need to change the external
> name for the built-in function within the compiler.
Because those are *not* defined in those headers. So those headers are
completely irrelevant to this.
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -26897,56 +26897,156 @@ rs6000_globalize_decl_name (FILE * stream, tree decl)
> library before you can switch the real*16 type at compile time.
>
> We use the TARGET_MANGLE_DECL_ASSEMBLER_NAME hook to change this name. We
> - only do this if the default is that long double is IBM extended double, and
> - the user asked for IEEE 128-bit. */
> + only do this transformation if the __float128 type is enabled. This
> + prevents us from doing the transformation on older 32-bit ports that might
> + have enabled using IEEE 128-bit floating point as the default long double
> + type. */
But that is just as broken then?
> + default:
> + break;
Please don't invert the natural order, leave the default at the bottom.
Just like you should not write "0 == x".
> + case BUILT_IN_NEXTTOWARD:
> + newname = "__nexttoward_to_ieee128";
> + break;
> +
> + case BUILT_IN_NEXTTOWARDF:
> + newname = "__nexttowardf_to_ieee128";
> + break;
Why the "_to_" in those? How irregular.
> + case BUILT_IN_SCALBL:
> + newname = "__scalbnieee128";
> + break;
Should that be __scalbieee128?
> + /* Update the __builtin_*printf && __builtin_*scanf functions. */
> + if (!newname)
> + {
> + const size_t printf_len = sizeof ("printf") - 1;
The "const" here has no function; the compiler *knows* this is a
constant number.
Please use strlen, and no - 1.
> + if (len >= printf_len
> + && strcmp (name + len - printf_len, "printf") == 0)
Thew first test is unnecessary.
> + {
> + char *name2 = (char *) alloca (len + 1 + printf_extra);
> + strcpy (name2, "__");
> + memcpy (name2 + 2, name, len);
> + strcpy (name2 + 2 + len, "ieee128");
> + newname = (const char *) name2;
> + }
Maybe just use asprintf and simplify all of this massively? It's not
like a malloc here or there will be measurably slower (if it was, you
need to do all of this differently anyway, with some caching etc.)
> + /* See if the function passes a IEEE 128-bit floating point type
> + or complex type. */
> + FOREACH_FUNCTION_ARGS (type, arg, args_iter)
> {
> - uses_ieee128_p = true;
> - break;
> + machine_mode arg_mode = TYPE_MODE (arg);
> + if (arg_mode == TFmode || arg_mode == TCmode)
> + {
> + uses_ieee128_p = true;
> + break;
> + }
I don't see why TFmode would mean it is IEEE? TFmode can be IBM128 as
well?
Segher
next prev parent reply other threads:[~2020-10-16 20:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 20:20 [PATCH 0/9] PowerPC: Patches to enable changing the long double default to IEEE 128-bit on little endian PowerPC 64-bit Linux systems Michael Meissner
2020-09-24 20:31 ` [PATCH 1/9] PowerPC: Map long double built-in functions if IEEE 128-bit long double Michael Meissner
2020-10-01 23:05 ` Joseph Myers
2020-10-08 5:20 ` Michael Meissner
2020-09-24 20:33 ` [PATCH 2/9] PowerPC: Update __float128 and __ibm128 error messages Michael Meissner
2020-09-24 20:34 ` [PATCH 3/9] PowerPC: Update IEEE <-> IBM 128-bit floating point conversions Michael Meissner
2020-09-24 20:35 ` [PATCH 4/9] PowerPC: Add IEEE 128-bit <-> Decimal conversions Michael Meissner
2020-09-24 20:36 ` [PATCH 5/9] PowerPC: Update tests to run if long double is IEEE 128-bit Michael Meissner
2020-09-24 20:40 ` [PATCH 6/9] PowerPC: If long double is IEEE 128-bit, map q built-ins to *l instead of *f128 Michael Meissner
2020-09-24 20:42 ` [PATCH 7/9] PowerPC: Update IEEE 128-bit built-in functions to work if long double is IEEE 128-bit Michael Meissner
2020-09-24 20:45 ` [PATCH 8/9] PowerPC: Change tests to use __float128 instead of __ieee128 Michael Meissner
2020-09-24 20:47 ` [PATCH 9/9] PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit Michael Meissner
2020-10-09 4:35 ` [PATCH 1/9, revised] PowerPC: Map long double built-in functions if IEEE 128-bit long double Michael Meissner
2020-10-16 20:30 ` Segher Boessenkool [this message]
2020-10-19 19:30 ` Michael Meissner
2020-10-19 21:24 ` Michael Meissner
2020-10-12 23:16 ` Ping: [PATCH 0/9] PowerPC: Patches to enable changing the long double default to IEEE 128-bit on little endian PowerPC 64-bit Linux systems Michael Meissner
2020-10-16 14:37 ` Ping #2: " Michael Meissner
2020-10-16 19:14 ` Segher Boessenkool
2020-10-19 19:12 ` Michael Meissner
2020-10-19 21:50 ` Segher Boessenkool
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=20201016203056.GM2672@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=law@redhat.com \
--cc=meissner@linux.ibm.com \
--cc=wschmidt@linux.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).