Skip to content

Commit ecd682b

Browse files
committed
[ARM] Add __bf16 as new Bfloat16 C Type
Summary: This patch upstreams support for a new storage only bfloat16 C type. This type is used to implement primitive support for bfloat16 data, in line with the Bfloat16 extension of the Armv8.6-a architecture, as detailed here: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a The bfloat type, and its properties are specified in the Arm Architecture Reference Manual: https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile In detail this patch: - introduces an opaque, storage-only C-type __bf16, which introduces a new bfloat IR type. This is part of a patch series, starting with command-line and Bfloat16 assembly support. The subsequent patches will upstream intrinsics support for BFloat16, followed by Matrix Multiplication and the remaining Virtualization features of the armv8.6-a architecture. The following people contributed to this patch: - Luke Cheeseman - Momchil Velikov - Alexandros Lamprineas - Luke Geeson - Simon Tatham - Ties Stuij Reviewers: SjoerdMeijer, rjmccall, rsmith, liutianle, RKSimon, craig.topper, jfb, LukeGeeson, fpetrogalli Reviewed By: SjoerdMeijer Subscribers: labrinea, majnemer, asmith, dexonsmith, kristof.beyls, arphaman, danielkiss, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D76077
1 parent 04fb2b6 commit ecd682b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+445
-28
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ float matrices and add the result to a third 4x4 matrix.
516516
Half-Precision Floating Point
517517
=============================
518518

519-
Clang supports two half-precision (16-bit) floating point types: ``__fp16`` and
520-
``_Float16``. These types are supported in all language modes.
519+
Clang supports three half-precision (16-bit) floating point types: ``__fp16``,
520+
``_Float16`` and ``__bf16``. These types are supported in all language modes.
521521

522522
``__fp16`` is supported on every target, as it is purely a storage format; see below.
523523
``_Float16`` is currently only supported on the following targets, with further
@@ -529,6 +529,12 @@ targets pending ABI standardization:
529529

530530
``_Float16`` will be supported on more targets as they define ABIs for it.
531531

532+
``__bf16`` is purely a storage format; it is currently only supported on the following targets:
533+
* 32-bit ARM
534+
* 64-bit ARM (AArch64)
535+
536+
The ``__bf16`` type is only available when supported in hardware.
537+
532538
``__fp16`` is a storage and interchange format only. This means that values of
533539
``__fp16`` are immediately promoted to (at least) ``float`` when used in arithmetic
534540
operations, so that e.g. the result of adding two ``__fp16`` values has type ``float``.

clang/include/clang-c/Index.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3253,8 +3253,9 @@ enum CXTypeKind {
32533253
CXType_UShortAccum = 36,
32543254
CXType_UAccum = 37,
32553255
CXType_ULongAccum = 38,
3256+
CXType_BFloat16 = 39,
32563257
CXType_FirstBuiltin = CXType_Void,
3257-
CXType_LastBuiltin = CXType_ULongAccum,
3258+
CXType_LastBuiltin = CXType_BFloat16,
32583259

32593260
CXType_Complex = 100,
32603261
CXType_Pointer = 101,

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
964964
CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy,
965965
SatUnsignedLongFractTy;
966966
CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
967+
CanQualType BFloat16Ty;
967968
CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
968969
CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy;
969970
CanQualType Float128ComplexTy;

clang/include/clang/AST/BuiltinTypes.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ FLOATING_TYPE(LongDouble, LongDoubleTy)
212212
// '_Float16'
213213
FLOATING_TYPE(Float16, HalfTy)
214214

215+
// '__bf16'
216+
FLOATING_TYPE(BFloat16, BFloat16Ty)
217+
215218
// '__float128'
216219
FLOATING_TYPE(Float128, Float128Ty)
217220

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
20082008
bool isFloatingType() const; // C99 6.2.5p11 (real floating + complex)
20092009
bool isHalfType() const; // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
20102010
bool isFloat16Type() const; // C11 extension ISO/IEC TS 18661
2011+
bool isBFloat16Type() const;
20112012
bool isFloat128Type() const;
20122013
bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
20132014
bool isArithmeticType() const; // C99 6.2.5p18 (integer + floating)
@@ -6931,6 +6932,10 @@ inline bool Type::isFloat16Type() const {
69316932
return isSpecificBuiltinType(BuiltinType::Float16);
69326933
}
69336934

6935+
inline bool Type::isBFloat16Type() const {
6936+
return isSpecificBuiltinType(BuiltinType::BFloat16);
6937+
}
6938+
69346939
inline bool Type::isFloat128Type() const {
69356940
return isSpecificBuiltinType(BuiltinType::Float128);
69366941
}

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8121,6 +8121,8 @@ def warn_bad_function_cast : Warning<
81218121
InGroup<BadFunctionCast>, DefaultIgnore;
81228122
def err_cast_pointer_to_non_pointer_int : Error<
81238123
"pointer cannot be cast to type %0">;
8124+
def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8125+
def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
81248126
def err_typecheck_expect_scalar_operand : Error<
81258127
"operand of type %0 where arithmetic or pointer type is required">;
81268128
def err_typecheck_cond_incompatible_operands : Error<

clang/include/clang/Basic/Specifiers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ namespace clang {
7272
TST_Float16, // C11 extension ISO/IEC TS 18661-3
7373
TST_Accum, // ISO/IEC JTC1 SC22 WG14 N1169 Extension
7474
TST_Fract,
75+
TST_BFloat16,
7576
TST_float,
7677
TST_double,
7778
TST_float128,

clang/include/clang/Basic/TargetBuiltins.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ namespace clang {
142142
Poly128,
143143
Float16,
144144
Float32,
145-
Float64
145+
Float64,
146+
BFloat16
146147
};
147148

148149
NeonTypeFlags(unsigned F) : Flags(F) {}

clang/include/clang/Basic/TargetInfo.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct TransferrableTargetInfo {
5959
unsigned char BoolWidth, BoolAlign;
6060
unsigned char IntWidth, IntAlign;
6161
unsigned char HalfWidth, HalfAlign;
62+
unsigned char BFloat16Width, BFloat16Align;
6263
unsigned char FloatWidth, FloatAlign;
6364
unsigned char DoubleWidth, DoubleAlign;
6465
unsigned char LongDoubleWidth, LongDoubleAlign, Float128Align;
@@ -100,8 +101,8 @@ struct TransferrableTargetInfo {
100101
unsigned short MaxVectorAlign;
101102
unsigned short MaxTLSAlign;
102103

103-
const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat,
104-
*LongDoubleFormat, *Float128Format;
104+
const llvm::fltSemantics *HalfFormat, *BFloat16Format, *FloatFormat,
105+
*DoubleFormat, *LongDoubleFormat, *Float128Format;
105106

106107
///===---- Target Data Type Query Methods -------------------------------===//
107108
enum IntType {
@@ -188,6 +189,7 @@ class TargetInfo : public virtual TransferrableTargetInfo,
188189
// LLVM IR type.
189190
bool HasFloat128;
190191
bool HasFloat16;
192+
bool HasBFloat16;
191193

192194
unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
193195
unsigned short SimdDefaultAlign;
@@ -567,6 +569,9 @@ class TargetInfo : public virtual TransferrableTargetInfo,
567569
/// Determine whether the _Float16 type is supported on this target.
568570
virtual bool hasFloat16Type() const { return HasFloat16; }
569571

572+
/// Determine whether the _BFloat16 type is supported on this target.
573+
virtual bool hasBFloat16Type() const { return HasBFloat16; }
574+
570575
/// Return the alignment that is suitable for storing any
571576
/// object with a fundamental alignment requirement.
572577
unsigned getSuitableAlign() const { return SuitableAlign; }
@@ -615,6 +620,11 @@ class TargetInfo : public virtual TransferrableTargetInfo,
615620
unsigned getFloatAlign() const { return FloatAlign; }
616621
const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
617622

623+
/// getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
624+
unsigned getBFloat16Width() const { return BFloat16Width; }
625+
unsigned getBFloat16Align() const { return BFloat16Align; }
626+
const llvm::fltSemantics &getBFloat16Format() const { return *BFloat16Format; }
627+
618628
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
619629
unsigned getDoubleWidth() const { return DoubleWidth; }
620630
unsigned getDoubleAlign() const { return DoubleAlign; }
@@ -642,6 +652,11 @@ class TargetInfo : public virtual TransferrableTargetInfo,
642652
/// Return the mangled code of __float128.
643653
virtual const char *getFloat128Mangling() const { return "g"; }
644654

655+
/// Return the mangled code of bfloat.
656+
virtual const char *getBFloat16Mangling() const {
657+
llvm_unreachable("bfloat not implemented on this target");
658+
}
659+
645660
/// Return the value for the C99 FLT_EVAL_METHOD macro.
646661
virtual unsigned getFloatEvalMethod() const { return 0; }
647662

clang/include/clang/Basic/TokenKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR)
591591

592592
// ARM NEON extensions.
593593
ALIAS("__fp16", half , KEYALL)
594+
KEYWORD(__bf16 , KEYALL)
594595

595596
// OpenCL Extension.
596597
KEYWORD(half , HALFSUPPORT)

clang/include/clang/Sema/DeclSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ class DeclSpec {
281281
static const TST TST_int128 = clang::TST_int128;
282282
static const TST TST_extint = clang::TST_extint;
283283
static const TST TST_half = clang::TST_half;
284+
static const TST TST_BFloat16 = clang::TST_BFloat16;
284285
static const TST TST_float = clang::TST_float;
285286
static const TST TST_double = clang::TST_double;
286287
static const TST TST_float16 = clang::TST_Float16;

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,10 @@ namespace serialization {
10601060
/// A placeholder type for incomplete matrix index operations.
10611061
PREDEF_TYPE_INCOMPLETE_MATRIX_IDX = 72,
10621062

1063-
/// OpenCL image types with auto numeration
1063+
/// \brief The '__bf16' type
1064+
PREDEF_TYPE_BFLOAT16_ID = 73,
1065+
1066+
/// OpenCL image types with auto numeration
10641067
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
10651068
PREDEF_TYPE_##Id##_ID,
10661069
#include "clang/Basic/OpenCLImageTypes.def"

clang/lib/AST/ASTContext.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
using namespace clang;
101101

102102
enum FloatingRank {
103-
Float16Rank, HalfRank, FloatRank, DoubleRank, LongDoubleRank, Float128Rank
103+
BFloat16Rank, Float16Rank, HalfRank, FloatRank, DoubleRank, LongDoubleRank, Float128Rank
104104
};
105105

106106
/// \returns location that is relevant when searching for Doc comments related
@@ -1448,6 +1448,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
14481448
// half type (OpenCL 6.1.1.1) / ARM NEON __fp16
14491449
InitBuiltinType(HalfTy, BuiltinType::Half);
14501450

1451+
InitBuiltinType(BFloat16Ty, BuiltinType::BFloat16);
1452+
14511453
// Builtin type used to help define __builtin_va_list.
14521454
VaListTagDecl = nullptr;
14531455

@@ -1651,6 +1653,8 @@ const llvm::fltSemantics &ASTContext::getFloatTypeSemantics(QualType T) const {
16511653
switch (T->castAs<BuiltinType>()->getKind()) {
16521654
default:
16531655
llvm_unreachable("Not a floating point type!");
1656+
case BuiltinType::BFloat16:
1657+
return Target->getBFloat16Format();
16541658
case BuiltinType::Float16:
16551659
case BuiltinType::Half:
16561660
return Target->getHalfFormat();
@@ -2045,6 +2049,10 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
20452049
Width = Target->getLongFractWidth();
20462050
Align = Target->getLongFractAlign();
20472051
break;
2052+
case BuiltinType::BFloat16:
2053+
Width = Target->getBFloat16Width();
2054+
Align = Target->getBFloat16Align();
2055+
break;
20482056
case BuiltinType::Float16:
20492057
case BuiltinType::Half:
20502058
if (Target->hasFloat16Type() || !getLangOpts().OpenMP ||
@@ -5984,6 +5992,7 @@ static FloatingRank getFloatingRank(QualType T) {
59845992
case BuiltinType::Double: return DoubleRank;
59855993
case BuiltinType::LongDouble: return LongDoubleRank;
59865994
case BuiltinType::Float128: return Float128Rank;
5995+
case BuiltinType::BFloat16: return BFloat16Rank;
59875996
}
59885997
}
59895998

@@ -5996,6 +6005,7 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,
59966005
FloatingRank EltRank = getFloatingRank(Size);
59976006
if (Domain->isComplexType()) {
59986007
switch (EltRank) {
6008+
case BFloat16Rank: llvm_unreachable("Complex bfloat16 is not supported");
59996009
case Float16Rank:
60006010
case HalfRank: llvm_unreachable("Complex half is not supported");
60016011
case FloatRank: return FloatComplexTy;
@@ -6008,6 +6018,7 @@ QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,
60086018
assert(Domain->isRealFloatingType() && "Unknown domain!");
60096019
switch (EltRank) {
60106020
case Float16Rank: return HalfTy;
6021+
case BFloat16Rank: return BFloat16Ty;
60116022
case HalfRank: return HalfTy;
60126023
case FloatRank: return FloatTy;
60136024
case DoubleRank: return DoubleTy;
@@ -6985,6 +6996,7 @@ static char getObjCEncodingForPrimitiveType(const ASTContext *C,
69856996
case BuiltinType::LongDouble: return 'D';
69866997
case BuiltinType::NullPtr: return '*'; // like char*
69876998

6999+
case BuiltinType::BFloat16:
69887000
case BuiltinType::Float16:
69897001
case BuiltinType::Float128:
69907002
case BuiltinType::Half:
@@ -9892,6 +9904,11 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
98929904
// Read the base type.
98939905
switch (*Str++) {
98949906
default: llvm_unreachable("Unknown builtin type letter!");
9907+
case 'y':
9908+
assert(HowLong == 0 && !Signed && !Unsigned &&
9909+
"Bad modifiers used with 'y'!");
9910+
Type = Context.BFloat16Ty;
9911+
break;
98959912
case 'v':
98969913
assert(HowLong == 0 && !Signed && !Unsigned &&
98979914
"Bad modifiers used with 'v'!");

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2764,6 +2764,11 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
27642764
Out << TI->getFloat128Mangling();
27652765
break;
27662766
}
2767+
case BuiltinType::BFloat16: {
2768+
const TargetInfo *TI = &getASTContext().getTargetInfo();
2769+
Out << TI->getBFloat16Mangling();
2770+
break;
2771+
}
27672772
case BuiltinType::NullPtr:
27682773
Out << "Dn";
27692774
break;
@@ -3179,7 +3184,8 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
31793184
case BuiltinType::ULongLong: EltName = "uint64_t"; break;
31803185
case BuiltinType::Double: EltName = "float64_t"; break;
31813186
case BuiltinType::Float: EltName = "float32_t"; break;
3182-
case BuiltinType::Half: EltName = "float16_t";break;
3187+
case BuiltinType::Half: EltName = "float16_t"; break;
3188+
case BuiltinType::BFloat16: EltName = "bfloat16_t"; break;
31833189
default:
31843190
llvm_unreachable("unexpected Neon vector element type");
31853191
}
@@ -3231,6 +3237,8 @@ static StringRef mangleAArch64VectorBase(const BuiltinType *EltType) {
32313237
return "Float32";
32323238
case BuiltinType::Double:
32333239
return "Float64";
3240+
case BuiltinType::BFloat16:
3241+
return "BFloat16";
32343242
default:
32353243
llvm_unreachable("Unexpected vector element base type");
32363244
}

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,7 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T, Qualifiers,
21142114
case BuiltinType::SatUShortFract:
21152115
case BuiltinType::SatUFract:
21162116
case BuiltinType::SatULongFract:
2117+
case BuiltinType::BFloat16:
21172118
case BuiltinType::Float128: {
21182119
DiagnosticsEngine &Diags = Context.getDiags();
21192120
unsigned DiagID = Diags.getCustomDiagID(

clang/lib/AST/NSAPI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ NSAPI::getNSNumberFactoryMethodKind(QualType T) const {
486486
case BuiltinType::OMPArraySection:
487487
case BuiltinType::OMPArrayShaping:
488488
case BuiltinType::OMPIterator:
489+
case BuiltinType::BFloat16:
489490
break;
490491
}
491492

clang/lib/AST/PrintfFormatString.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
752752
case BuiltinType::UInt128:
753753
case BuiltinType::Int128:
754754
case BuiltinType::Half:
755+
case BuiltinType::BFloat16:
755756
case BuiltinType::Float16:
756757
case BuiltinType::Float128:
757758
case BuiltinType::ShortAccum:

clang/lib/AST/Type.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,8 @@ bool Type::isRealType() const {
21372137
bool Type::isArithmeticType() const {
21382138
if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
21392139
return BT->getKind() >= BuiltinType::Bool &&
2140-
BT->getKind() <= BuiltinType::Float128;
2140+
BT->getKind() <= BuiltinType::Float128 &&
2141+
BT->getKind() != BuiltinType::BFloat16;
21412142
if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
21422143
// GCC allows forward declaration of enum types (forbid by C99 6.7.2.3p2).
21432144
// If a body isn't seen by the time we get here, return false.
@@ -2922,6 +2923,8 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
29222923
return "unsigned __int128";
29232924
case Half:
29242925
return Policy.Half ? "half" : "__fp16";
2926+
case BFloat16:
2927+
return "__bf16";
29252928
case Float:
29262929
return "float";
29272930
case Double:

clang/lib/AST/TypeLoc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
375375
case BuiltinType::SatUShortFract:
376376
case BuiltinType::SatUFract:
377377
case BuiltinType::SatULongFract:
378+
case BuiltinType::BFloat16:
378379
llvm_unreachable("Builtin type needs extra local data!");
379380
// Fall through, if the impossible happens.
380381

clang/lib/Basic/TargetInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : TargetOpts(), Triple(T) {
3636
HasLegalHalfType = false;
3737
HasFloat128 = false;
3838
HasFloat16 = false;
39+
HasBFloat16 = false;
3940
PointerWidth = PointerAlign = 32;
4041
BoolWidth = BoolAlign = 8;
4142
IntWidth = IntAlign = 32;

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
7070
LongDoubleWidth = LongDoubleAlign = SuitableAlign = 128;
7171
LongDoubleFormat = &llvm::APFloat::IEEEquad();
7272

73+
BFloat16Width = BFloat16Align = 16;
74+
BFloat16Format = &llvm::APFloat::BFloat();
75+
7376
// Make __builtin_ms_va_list available.
7477
HasBuiltinMSVaList = true;
7578

@@ -360,6 +363,7 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
360363
HasMTE = false;
361364
HasTME = false;
362365
HasMatMul = false;
366+
HasBFloat16 = false;
363367
ArchKind = llvm::AArch64::ArchKind::ARMV8A;
364368

365369
for (const auto &Feature : Features) {
@@ -397,6 +401,8 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
397401
HasTME = true;
398402
if (Feature == "+i8mm")
399403
HasMatMul = true;
404+
if (Feature == "+bf16")
405+
HasBFloat16 = true;
400406
}
401407

402408
setDataLayout();

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
119119

120120
int getEHDataRegisterNumber(unsigned RegNo) const override;
121121

122+
const char *getBFloat16Mangling() const override { return "u6__bf16"; };
122123
bool hasInt128Type() const override;
123124

124125
bool hasExtIntType() const override { return true; }

0 commit comments

Comments
 (0)