From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id E72B23858C5E for ; Thu, 9 Mar 2023 17:14:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E72B23858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0C3F9AD7; Thu, 9 Mar 2023 09:14:57 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D15803F5A1; Thu, 9 Mar 2023 09:14:12 -0800 (PST) From: Richard Sandiford To: Jakub Jelinek Mail-Followup-To: Jakub Jelinek ,Richard Earnshaw , Kyrylo Tkachov , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: Richard Earnshaw , Kyrylo Tkachov , gcc-patches@gcc.gnu.org Subject: Re: AArch64 bfloat16 mangling References: Date: Thu, 09 Mar 2023 17:14:11 +0000 In-Reply-To: (Jakub Jelinek's message of "Wed, 1 Feb 2023 11:27:00 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-27.6 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Sorry for the slow response. Jakub Jelinek writes: > Hi! > > On Mon, Jan 30, 2023 at 11:07:23PM +0000, Richard Sandiford wrote: >> Jakub Jelinek 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