Skip to content

Commit

Permalink
Rename 8-bit fp from fmp8 to mfloat8
Browse files Browse the repository at this point in the history
 `mfloat8_t`     | equivalent to `__mfp8` |

According to ACLE[1] proposal
[1] ARM-software/acle#323
  • Loading branch information
CarolineConcatto committed Jul 31, 2024
1 parent fd4d8da commit e5bcd7f
Show file tree
Hide file tree
Showing 45 changed files with 222 additions and 259 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
CanQualType SatShortFractTy, SatFractTy, SatLongFractTy;
CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy,
SatUnsignedLongFractTy;
CanQualType Fpm8Ty;
CanQualType MFloat8Ty;
CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
CanQualType BFloat16Ty;
CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/BuiltinTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ FLOATING_TYPE(Ibm128, Ibm128Ty)


// '__fpm8'
UNSIGNED_TYPE(Fpm8, Fpm8Ty)
UNSIGNED_TYPE(MFloat8, MFloat8Ty)

//===- Language-specific types --------------------------------------------===//

Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
bool isDoubleType() const;
bool isBFloat16Type() const;
bool isFloat128Type() const;
bool isFpm8Type() const;
bool isMFloat8Type() const;
bool isIbm128Type() const;
bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
bool isArithmeticType() const; // C99 6.2.5p18 (integer + floating)
Expand Down Expand Up @@ -7945,8 +7945,8 @@ inline bool Type::isBFloat16Type() const {
return isSpecificBuiltinType(BuiltinType::BFloat16);
}

inline bool Type::isFpm8Type() const {
return isSpecificBuiltinType(BuiltinType::Fpm8);
inline bool Type::isMFloat8Type() const {
return isSpecificBuiltinType(BuiltinType::MFloat8);
}

inline bool Type::isFloat128Type() const {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -7858,7 +7858,7 @@ def err_bad_lvalue_to_rvalue_cast : Error<
def err_bad_rvalue_to_rvalue_cast : Error<
"cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
"not compatible">;
def err_bad_fpm8_cast : Error<
def err_bad_mfloat8_cast : Error<
"cannot cast %0 to %1; types are not compatible">;
def err_bad_static_cast_pointer_nonpointer : Error<
"cannot cast from type %1 to pointer type %2">;
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/Specifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace clang {
TST_Accum, // ISO/IEC JTC1 SC22 WG14 N1169 Extension
TST_Fract,
TST_BFloat16,
TST_Fpm8,
TST_MFloat8,
TST_float,
TST_double,
TST_float128,
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/TargetBuiltins.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace clang {
Float32,
Float64,
BFloat16,
Fpm8
MFloat8
};

NeonTypeFlags(unsigned F) : Flags(F) {}
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/TargetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class TargetInfo : public TransferrableTargetInfo,
bool HasFullBFloat16; // True if the backend supports native bfloat16
// arithmetic. Used to determine excess precision
// support in the frontend.
bool HasFpm8;
bool HasMFloat8;
bool HasIbm128;
bool HasLongDouble;
bool HasFPReturn;
Expand Down Expand Up @@ -702,7 +702,7 @@ class TargetInfo : public TransferrableTargetInfo,
}

/// Determine whether the _fpm8 type is supported on this target.
virtual bool hasFpm8Type() const { return HasFpm8; }
virtual bool hasMFloat8Type() const { return HasMFloat8; }

/// Determine whether the BFloat type is fully supported on this target, i.e
/// arithemtic operations.
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/TokenKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR)
// ARM NEON extensions.
ALIAS("__fp16", half , KEYALL)
KEYWORD(__bf16 , KEYALL)
KEYWORD(__fpm8 , KEYALL)
KEYWORD(__mfp8 , KEYALL)

// OpenCL Extension.
KEYWORD(half , HALFSUPPORT)
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Sema/DeclSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class DeclSpec {
static const TST TST_bitint = clang::TST_bitint;
static const TST TST_half = clang::TST_half;
static const TST TST_BFloat16 = clang::TST_BFloat16;
static const TST TST_Fpm8 = clang::TST_Fpm8;
static const TST TST_MFloat8 = clang::TST_MFloat8;
static const TST TST_float = clang::TST_float;
static const TST TST_double = clang::TST_double;
static const TST TST_float16 = clang::TST_Float16;
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Serialization/ASTBitCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,8 @@ enum PredefinedTypeIDs {
/// \brief The '__ibm128' type
PREDEF_TYPE_IBM128_ID = 74,

PREDEF_TYPE_FPM8_ID = 75,
/// \bried The '__mfp8' type
PREDEF_TYPE_MFLOAT8_ID = 75,

/// OpenCL image types with auto numeration
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
// half type (OpenCL 6.1.1.1) / ARM NEON __fp16
InitBuiltinType(HalfTy, BuiltinType::Half);

InitBuiltinType(Fpm8Ty, BuiltinType::Fpm8);
InitBuiltinType(MFloat8Ty, BuiltinType::MFloat8);

InitBuiltinType(BFloat16Ty, BuiltinType::BFloat16);

Expand Down Expand Up @@ -1979,7 +1979,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
Width = Target->getBoolWidth();
Align = Target->getBoolAlign();
break;
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::Char_S:
case BuiltinType::Char_U:
case BuiltinType::UChar:
Expand Down Expand Up @@ -8106,7 +8106,7 @@ static char getObjCEncodingForPrimitiveType(const ASTContext *C,
switch (kind) {
case BuiltinType::Void: return 'v';
case BuiltinType::Bool: return 'B';
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::Char8:
case BuiltinType::Char_U:
case BuiltinType::UChar: return 'C';
Expand Down Expand Up @@ -11471,7 +11471,7 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
Type = Context.CharTy;
break;
case 'j':
Type = Context.Fpm8Ty;
Type = Context.MFloat8Ty;
break;
case 'b': // boolean
assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'b'!");
Expand Down
10 changes: 4 additions & 6 deletions clang/lib/AST/ItaniumMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
case BuiltinType::SChar:
Out << 'a';
break;
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::WChar_S:
case BuiltinType::WChar_U:
Out << 'w';
Expand Down Expand Up @@ -3800,9 +3800,7 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
case BuiltinType::Float: EltName = "float32_t"; break;
case BuiltinType::Half: EltName = "float16_t"; break;
case BuiltinType::BFloat16: EltName = "bfloat16_t"; break;
case BuiltinType::Fpm8:
EltName = "fmp8_t";
break;
case BuiltinType::MFloat8: EltName = "mfloat8_t"; break;
default:
llvm_unreachable("unexpected Neon vector element type");
}
Expand Down Expand Up @@ -3856,8 +3854,8 @@ static StringRef mangleAArch64VectorBase(const BuiltinType *EltType) {
return "Float64";
case BuiltinType::BFloat16:
return "Bfloat16";
case BuiltinType::Fpm8:
return "Fpm8_t";
case BuiltinType::MFloat8:
return "MFloat8_t";
default:
llvm_unreachable("Unexpected vector element base type");
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/PrintfFormatString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
case BuiltinType::Char32:
case BuiltinType::UInt128:
case BuiltinType::Int128:
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::Half:
case BuiltinType::BFloat16:
case BuiltinType::Float16:
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3372,8 +3372,8 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
return "unsigned __int128";
case Half:
return Policy.Half ? "half" : "__fp16";
case Fpm8:
return "__fpm8";
case MFloat8:
return "__mfp8";
case BFloat16:
return "__bf16";
case Float:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/TypeLoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
case BuiltinType::Long:
case BuiltinType::LongLong:
case BuiltinType::Int128:
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::Half:
case BuiltinType::Float:
case BuiltinType::Double:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
NoAsmVariants = false;
HasLegalHalfType = false;
HalfArgsAndReturns = false;
HasFpm8 = false;
HasMFloat8 = false;
HasFloat128 = false;
HasIbm128 = false;
HasFloat16 = false;
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Basic/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
.Case("sha3", HasSHA3)
.Cases("aes", "pmull", HasAES)
.Cases("fp16", "fullfp16", HasFullFP16)
.Case("fp8", HasFpm8)
.Case("fp8", HasMFloat8)
.Case("dit", HasDIT)
.Case("dpb", HasCCPP)
.Case("dpb2", HasCCDP)
Expand Down Expand Up @@ -942,7 +942,7 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
HasSM4 = true;
}
if (Feature == "+fp8") {
HasFpm8 = true;
HasMFloat8 = true;
}
if (Feature == "+strict-align")
HasUnalignedAccess = false;
Expand Down Expand Up @@ -1216,7 +1216,7 @@ bool AArch64TargetInfo::hasBFloat16Type() const {
return true;
}

bool AArch64TargetInfo::hasFpm8Type() const { return true; }
bool AArch64TargetInfo::hasMFloat8Type() const { return true; }

TargetInfo::CallingConvCheckResult
AArch64TargetInfo::checkCallingConvention(CallingConv CC) const {
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Basic/Targets/AArch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
bool HasLS64 = false;
bool HasRandGen = false;
bool HasMatMul = false;
bool HasFpm8 = false;
bool HasMFloat8 = false;
bool HasBFloat16 = false;
bool HasSVE2 = false;
bool HasSVE2AES = false;
Expand Down Expand Up @@ -170,7 +170,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {

bool hasBFloat16Type() const override;

bool hasFpm8Type() const override;
bool hasMFloat8Type() const override;

CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;

Expand Down
3 changes: 1 addition & 2 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6229,8 +6229,7 @@ static llvm::FixedVectorType *GetNeonType(CodeGenFunction *CGF,
switch (TypeFlags.getEltType()) {
case NeonTypeFlags::Int8:
case NeonTypeFlags::Poly8:
case NeonTypeFlags::Fpm8:
return llvm::FixedVectorType::get(CGF->Fpm8Ty, V1Ty ? 1 : (8 << IsQuad));
return llvm::FixedVectorType::get(CGF->Int8Ty, V1Ty ? 1 : (8 << IsQuad));
case NeonTypeFlags::Int16:
case NeonTypeFlags::Poly16:
return llvm::FixedVectorType::get(CGF->Int16Ty, V1Ty ? 1 : (4 << IsQuad));
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {

case BuiltinType::UChar:
case BuiltinType::Char_U:
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
Encoding = llvm::dwarf::DW_ATE_unsigned_char;
break;
case BuiltinType::Char_S:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ CodeGenModule::CodeGenModule(ASTContext &C,
Int16Ty = llvm::Type::getInt16Ty(LLVMContext);
Int32Ty = llvm::Type::getInt32Ty(LLVMContext);
Int64Ty = llvm::Type::getInt64Ty(LLVMContext);
Fpm8Ty = llvm::Type::getInt8Ty(LLVMContext);
MFloat8Ty = llvm::Type::getInt8Ty(LLVMContext);
HalfTy = llvm::Type::getHalfTy(LLVMContext);
BFloatTy = llvm::Type::getBFloatTy(LLVMContext);
FloatTy = llvm::Type::getFloatTy(LLVMContext);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenTypeCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct CodeGenTypeCache {
llvm::Type *HalfTy, *BFloatTy, *FloatTy, *DoubleTy;

/// fpm8 from FP8 is an alias for 8bits data
llvm::IntegerType *Fpm8Ty;
llvm::IntegerType *MFloat8Ty;

/// int
llvm::IntegerType *IntTy;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
Context.getFloatTypeSemantics(T),
/* UseNativeHalf = */ false);
break;
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
ResultType = llvm::Type::getInt8Ty(getLLVMContext());
break;
case BuiltinType::NullPtr:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/ItaniumCXXABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3387,7 +3387,7 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
case BuiltinType::SatUFract:
case BuiltinType::SatULongFract:
case BuiltinType::BFloat16:
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
return false;

case BuiltinType::Dependent:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Index/USRGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void USRGenerator::VisitType(QualType T) {
Out << 'v'; break;
case BuiltinType::Bool:
Out << 'b'; break;
case BuiltinType::Fpm8:
case BuiltinType::MFloat8:
case BuiltinType::UChar:
Out << 'c'; break;
case BuiltinType::Char8:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool Token::isSimpleTypeSpecifier(const LangOptions &LangOpts) const {
case tok::kw___bf16:
case tok::kw__Float16:
case tok::kw___float128:
case tok::kw___fpm8:
case tok::kw___mfp8:
case tok::kw___ibm128:
case tok::kw_wchar_t:
case tok::kw_bool:
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4477,9 +4477,9 @@ void Parser::ParseDeclarationSpecifiers(
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_int128, Loc, PrevSpec,
DiagID, Policy);
break;
case tok::kw___fpm8:
isInvalid =
DS.SetTypeSpecType(DeclSpec::TST_Fpm8, Loc, PrevSpec, DiagID, Policy);
case tok::kw___mfp8:
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_MFloat8, Loc, PrevSpec,
DiagID, Policy);
break;
case tok::kw_half:
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_half, Loc, PrevSpec,
Expand Down Expand Up @@ -5756,7 +5756,7 @@ bool Parser::isKnownToBeTypeSpecifier(const Token &Tok) const {
case tok::kw__ExtInt:
case tok::kw__BitInt:
case tok::kw___bf16:
case tok::kw___fpm8:
case tok::kw___mfp8:
case tok::kw_half:
case tok::kw_float:
case tok::kw_double:
Expand Down Expand Up @@ -5840,7 +5840,7 @@ bool Parser::isTypeSpecifierQualifier() {
case tok::kw_int:
case tok::kw__ExtInt:
case tok::kw__BitInt:
case tok::kw___fpm8:
case tok::kw___mfp8:
case tok::kw_half:
case tok::kw___bf16:
case tok::kw_float:
Expand Down Expand Up @@ -6063,7 +6063,7 @@ bool Parser::isDeclarationSpecifier(
case tok::kw_int:
case tok::kw__ExtInt:
case tok::kw__BitInt:
case tok::kw___fpm8:
case tok::kw___mfp8:
case tok::kw_half:
case tok::kw___bf16:
case tok::kw_float:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
case tok::kw__BitInt:
case tok::kw_signed:
case tok::kw_unsigned:
case tok::kw___fpm8:
case tok::kw___mfp8:
case tok::kw_half:
case tok::kw_float:
case tok::kw_double:
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Parse/ParseExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2405,8 +2405,8 @@ void Parser::ParseCXXSimpleTypeSpecifier(DeclSpec &DS) {
case tok::kw___int128:
DS.SetTypeSpecType(DeclSpec::TST_int128, Loc, PrevSpec, DiagID, Policy);
break;
case tok::kw___fpm8:
DS.SetTypeSpecType(DeclSpec::TST_Fpm8, Loc, PrevSpec, DiagID, Policy);
case tok::kw___mfp8:
DS.SetTypeSpecType(DeclSpec::TST_MFloat8, Loc, PrevSpec, DiagID, Policy);
break;
case tok::kw___bf16:
DS.SetTypeSpecType(DeclSpec::TST_BFloat16, Loc, PrevSpec, DiagID, Policy);
Expand Down
Loading

0 comments on commit e5bcd7f

Please sign in to comment.