
Pursuant to discussions at https://discourse.llvm.org/t/rfc-c-23-p1467r9-extended-floating-point-types-and-standard-names/70033/22, this commit enhances the handling of the __bf16 type in Clang. - Firstly, it upgrades __bf16 from a storage-only type to an arithmetic type. - Secondly, it changes the mangling of __bf16 to DF16b on all architectures except ARM. This change has been made in accordance with the finalization of the mangling for the std::bfloat16_t type, as discussed at https://github.com/itanium-cxx-abi/cxx-abi/pull/147. - Finally, this commit extends the existing excess precision support to the __bf16 type. This applies to hardware architectures that do not natively support bfloat16 arithmetic. Appropriate tests have been added to verify the effects of these changes and ensure no regressions in other areas of the compiler. Reviewed By: rjmccall, pengfei, zahiraam Differential Revision: https://reviews.llvm.org/D150913
15 lines
450 B
C
15 lines
450 B
C
// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding -triple x86_64-linux-pc %s
|
|
|
|
// expected-error@+1 3 {{unknown type name '__bfloat16'}}
|
|
__bfloat16 foo(__bfloat16 a, __bfloat16 b) {
|
|
return a + b;
|
|
}
|
|
|
|
#include <immintrin.h>
|
|
|
|
// expected-warning@+2 3 {{'__bfloat16' is deprecated: use __bf16 instead}}
|
|
// expected-note@* 3 {{'__bfloat16' has been explicitly marked deprecated here}}
|
|
__bfloat16 bar(__bfloat16 a, __bfloat16 b) {
|
|
return a + b;
|
|
}
|