public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Earnshaw <richard.earnshaw@arm.com>,
	 Kyrylo Tkachov <kyrylo.tkachov@arm.com>,
	 gcc-patches@gcc.gnu.org
Subject: Re: AArch64 bfloat16 mangling
Date: Thu, 09 Mar 2023 17:14:11 +0000	[thread overview]
Message-ID: <mpt8rg526fw.fsf@arm.com> (raw)
In-Reply-To: <Y9o+dJnVhavp+Edg@tucnak> (Jakub Jelinek's message of "Wed, 1 Feb 2023 11:27:00 +0100")

Sorry for the slow response.

Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> On Mon, Jan 30, 2023 at 11:07:23PM +0000, Richard Sandiford wrote:
>> Jakub Jelinek <jakub@redhat.com> writes:
>> > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605965.html
>> >   - ABI - aarch64: Add bfloat16_t support for aarch64 (enabling it in GCC 14
>> >     will be harder)
>> 
>> Sorry for the delay on this.  There's still an ongoing debate about
>> whether to keep the current AArch64 mangling or switch to the new one.
>
> If it helps, I'll try to repeat the options I see:
> 1) don't do anything right now; problem is if it is done later (GCC 14+),
>    libstdc++ would need to conditionalize the std::bfloat16_t RTTI symbols,
>    have them in one symbol version for x86 and in another for aarch64
> 2) similarly to x86 __bf16 would be the underlying type for std::bfloat16_t
>    where the latter needs to act as usable extended floating point type with
>    all arithmetics, mangling is DF16b which is how std::bfloat16_t should
>    mangle according to the Itanitum ABI pull request; decltype (0.0bf16) is
>    __bf16; disadvantage is that existing code using __bf16 in argument
>    passing and templates changes mangling
> 3) keep __bf16 as is with its u6__bf16 mangling and use for std::bfloat16_t
>    a distinct type (the latter would be the bfloat16_type_node);
>    decltype (0.0bf16) would be that new type which would mangle DF16b and
>    would allow arithmetics/casts etc.  How exactly would the new type be
>    named is up to you (__bfloat16_t, __bfloat16, __std_bfloat16_t,
>    whatever else); in theory it could be created without a user accessible
>    name as well; libstdc++ only uses decltype (0.0bf16) to get at it
> 4) like 3), including keeping the mangling of __bf16 as u6__bf16, but
>    make also __bf16 a usable arithmetic type, not just a storage only type;
>    for C++ FE it would be simply another non-standard type like say
>    __float128 is on x86
> 5) like 2), but make the mangling of __bf16 depend on flag_abi_version;
>    flag_abi_version >= 18 (aka GCC 13+ ABI) mangles it as DF16b,
>    flag_abi_version < 18 mangles it as u6__bf16; the default for
>    -fabi-compat-version= is I think GCC 8 ABI compatibility, so GCC normally
>    emits mangling aliases, so say void foo (std::bfloat16_t) {} would
>    mangle as _Z3fooDF16b and for a few years there would be
>    an alias _Z3foou6__bf16 to it
>
> Of course, it is possible I've missed some options.
>
> 	Jakub

We decided to keep the current mangling of __bf16 and use it for
std::bfloat16_t too.  __bf16 will become a non-standard arithmetic type.
This will be an explicit diversion from the Itanium ABI.

I think that's equivalent to your (2) without the part about following
the Itanium ABI.

Thanks,
Richard

  reply	other threads:[~2023-03-09 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  9:50 Patch ping Jakub Jelinek
2023-01-30 23:07 ` Richard Sandiford
2023-02-01 10:27   ` AArch64 bfloat16 mangling Jakub Jelinek
2023-03-09 17:14     ` Richard Sandiford [this message]
2023-03-10  8:37       ` Jakub Jelinek
2023-03-10  8:43         ` Richard Sandiford
2023-03-10 11:30           ` Jakub Jelinek
2023-03-10 11:50             ` Richard Sandiford
2023-03-10 15:35               ` Jakub Jelinek
2023-03-10 16:25                 ` Richard Sandiford

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=mpt8rg526fw.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kyrylo.tkachov@arm.com \
    --cc=richard.earnshaw@arm.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).