From: Michael Meissner <meissner@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Michael Meissner <meissner@linux.ibm.com>,
gcc-patches@gcc.gnu.org, "Kewen.Lin" <linkw@linux.ibm.com>,
David Edelsohn <dje.gcc@gmail.com>,
Peter Bergner <bergner@linux.ibm.com>,
Will Schmidt <will_schmidt@vnet.ibm.com>
Subject: Re: [PATCH 0/5] IEEE 128-bit built-in overload support.
Date: Wed, 10 Aug 2022 02:23:27 -0400 [thread overview]
Message-ID: <YvNO36tDtxwXbels@toto.the-meissners.org> (raw)
In-Reply-To: <20220805181905.GQ25951@gate.crashing.org>
On Fri, Aug 05, 2022 at 01:19:05PM -0500, Segher Boessenkool wrote:
> On Thu, Jul 28, 2022 at 12:43:49AM -0400, Michael Meissner wrote:
> > These patches lay the foundation for a set of follow-on patches that will
> > change the internal handling of 128-bit floating point types in GCC. In the
> > future patches, I hope to change the compiler to always use KFmode for the
> > explicit _Float128/__float128 types, to always use TFmode for the long double
> > type, no matter which 128-bit floating point type is used, and IFmode for the
> > explicit __ibm128 type.
>
> Making TFmode different from KFmode and IFmode is not an improvement.
> NAK.
>
>
> Segher
First of all, it already IS different from KFmode and IFmode, as we've talked
about. I'm trying to clean this mess up. Having explicit __float128's being
converted to TFmode if -mabi=ieeelongdouble is just as bad, and it means that
_Float128 and __float128 are not the same type.
What I'm trying to eliminate is the code in rs6000-builtin.cc that overrides
the builtin ops (i.e. it does the equivalent of an overloaded function):
/* TODO: The following commentary and code is inherited from the original
builtin processing code. The commentary is a bit confusing, with the
intent being that KFmode is always IEEE-128, IFmode is always IBM
double-double, and TFmode is the current long double. The code is
confusing in that it converts from KFmode to TFmode pattern names,
when the other direction is more intuitive. Try to address this. */
/* We have two different modes (KFmode, TFmode) that are the IEEE
128-bit floating point type, depending on whether long double is the
IBM extended double (KFmode) or long double is IEEE 128-bit (TFmode).
It is simpler if we only define one variant of the built-in function,
and switch the code when defining it, rather than defining two built-
ins and using the overload table in rs6000-c.cc to switch between the
two. If we don't have the proper assembler, don't do this switch
because CODE_FOR_*kf* and CODE_FOR_*tf* will be CODE_FOR_nothing. */
if (FLOAT128_IEEE_P (TFmode))
switch (icode)
{
case CODE_FOR_sqrtkf2_odd:
icode = CODE_FOR_sqrttf2_odd;
break;
case CODE_FOR_trunckfdf2_odd:
icode = CODE_FOR_trunctfdf2_odd;
break;
case CODE_FOR_addkf3_odd:
icode = CODE_FOR_addtf3_odd;
break;
case CODE_FOR_subkf3_odd:
icode = CODE_FOR_subtf3_odd;
break;
case CODE_FOR_mulkf3_odd:
icode = CODE_FOR_multf3_odd;
break;
case CODE_FOR_divkf3_odd:
icode = CODE_FOR_divtf3_odd;
break;
case CODE_FOR_fmakf4_odd:
icode = CODE_FOR_fmatf4_odd;
break;
case CODE_FOR_xsxexpqp_kf:
icode = CODE_FOR_xsxexpqp_tf;
break;
case CODE_FOR_xsxsigqp_kf:
icode = CODE_FOR_xsxsigqp_tf;
break;
case CODE_FOR_xststdcnegqp_kf:
icode = CODE_FOR_xststdcnegqp_tf;
break;
case CODE_FOR_xsiexpqp_kf:
icode = CODE_FOR_xsiexpqp_tf;
break;
case CODE_FOR_xsiexpqpf_kf:
icode = CODE_FOR_xsiexpqpf_tf;
break;
case CODE_FOR_xststdcqp_kf:
icode = CODE_FOR_xststdcqp_tf;
break;
case CODE_FOR_xscmpexpqp_eq_kf:
icode = CODE_FOR_xscmpexpqp_eq_tf;
break;
case CODE_FOR_xscmpexpqp_lt_kf:
icode = CODE_FOR_xscmpexpqp_lt_tf;
break;
case CODE_FOR_xscmpexpqp_gt_kf:
icode = CODE_FOR_xscmpexpqp_gt_tf;
break;
case CODE_FOR_xscmpexpqp_unordered_kf:
icode = CODE_FOR_xscmpexpqp_unordered_tf;
break;
default:
break;
}
// ... other code
if (bif_is_ibm128 (*bifaddr) && TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD)
{
if (fcode == RS6000_BIF_PACK_IF)
{
icode = CODE_FOR_packtf;
fcode = RS6000_BIF_PACK_TF;
uns_fcode = (size_t) fcode;
}
else if (fcode == RS6000_BIF_UNPACK_IF)
{
icode = CODE_FOR_unpacktf;
fcode = RS6000_BIF_UNPACK_TF;
uns_fcode = (size_t) fcode;
}
}
In particular, without overloaded built-ins, we likely have something similar
to the above to cover all of the built-ins for both modes. I tend to think
overloading is more natural in this case.
--
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com
next prev parent reply other threads:[~2022-08-10 6:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 4:43 Michael Meissner
2022-07-28 4:47 ` [PATCH 1/5] " Michael Meissner
2022-07-28 4:48 ` [PATCH 2/5] Support IEEE 128-bit overload round_to_odd built-in functions Michael Meissner
2022-07-28 4:50 ` [PATCH 3/5] Support IEEE 128-bit overload comparison " Michael Meissner
2022-07-28 4:52 ` [PATCH 4/5] Support IEEE 128-bit overload extract and insert " Michael Meissner
2022-07-28 4:54 ` [PATCH 5/5] Support IEEE 128-bit overload test data " Michael Meissner
2022-08-03 17:58 ` Ping: [PATCH 0/5] IEEE 128-bit built-in overload support Michael Meissner
2022-08-05 18:19 ` Segher Boessenkool
2022-08-10 6:23 ` Michael Meissner [this message]
2022-08-10 17:03 ` Segher Boessenkool
2022-08-11 20:01 ` Michael Meissner
2022-08-11 20:44 ` Joseph Myers
2022-08-16 18:07 ` Jakub Jelinek
2022-08-16 18:55 ` 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=YvNO36tDtxwXbels@toto.the-meissners.org \
--to=meissner@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@linux.ibm.com \
--cc=segher@kernel.crashing.org \
--cc=will_schmidt@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).