[clang] [CLANG][AArch64]Add Neon vectors for fpm8_t (PR #99865)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 05:04:01 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-clang

Author: None (CarolineConcatto)

<details>
<summary>Changes</summary>

  This patch adds these new vector sizes for neon:
    fpm8x16_t and fpm8x8_t

    According to the ARM ACLE PR#<!-- -->323[1].

    [1] ARM-software/acle#<!-- -->323


---

Patch is 49.87 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/99865.diff


50 Files Affected:

- (modified) clang/include/clang/AST/ASTContext.h (+1) 
- (modified) clang/include/clang/AST/BuiltinTypes.def (+4) 
- (modified) clang/include/clang/AST/Type.h (+5) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+2) 
- (modified) clang/include/clang/Basic/Specifiers.h (+1) 
- (modified) clang/include/clang/Basic/TargetBuiltins.h (+2-1) 
- (modified) clang/include/clang/Basic/TargetInfo.h (+4) 
- (modified) clang/include/clang/Basic/TokenKinds.def (+1) 
- (added) clang/include/clang/Basic/arm_fpm8.td (+14) 
- (modified) clang/include/clang/Basic/arm_neon_incl.td (+2) 
- (modified) clang/include/clang/Sema/DeclSpec.h (+1) 
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (+3-1) 
- (modified) clang/lib/AST/ASTContext.cpp (+7) 
- (modified) clang/lib/AST/ItaniumMangle.cpp (+6) 
- (modified) clang/lib/AST/PrintfFormatString.cpp (+1) 
- (modified) clang/lib/AST/Type.cpp (+2) 
- (modified) clang/lib/AST/TypeLoc.cpp (+1) 
- (modified) clang/lib/Basic/TargetInfo.cpp (+1) 
- (modified) clang/lib/Basic/Targets/AArch64.cpp (+9) 
- (modified) clang/lib/Basic/Targets/AArch64.h (+3) 
- (modified) clang/lib/Basic/Targets/ARM.cpp (+2) 
- (modified) clang/lib/Basic/Targets/ARM.h (+2) 
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-1) 
- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+1) 
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1) 
- (modified) clang/lib/CodeGen/CodeGenTypeCache.h (+3) 
- (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+3-1) 
- (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+1) 
- (modified) clang/lib/Headers/CMakeLists.txt (+3) 
- (modified) clang/lib/Index/USRGeneration.cpp (+1) 
- (modified) clang/lib/Lex/Lexer.cpp (+1) 
- (modified) clang/lib/Parse/ParseDecl.cpp (+7) 
- (modified) clang/lib/Parse/ParseExpr.cpp (+1) 
- (modified) clang/lib/Parse/ParseExprCXX.cpp (+3) 
- (modified) clang/lib/Parse/ParseTentative.cpp (+2) 
- (modified) clang/lib/Sema/DeclSpec.cpp (+3) 
- (modified) clang/lib/Sema/SemaARM.cpp (+3) 
- (modified) clang/lib/Sema/SemaCast.cpp (+7) 
- (modified) clang/lib/Sema/SemaExpr.cpp (+11) 
- (modified) clang/lib/Sema/SemaTemplateVariadic.cpp (+1) 
- (modified) clang/lib/Sema/SemaType.cpp (+7-1) 
- (modified) clang/lib/Serialization/ASTCommon.cpp (+3) 
- (modified) clang/lib/Serialization/ASTReader.cpp (+3) 
- (added) clang/test/AST/arm-fpm8.cpp (+94) 
- (added) clang/test/CodeGen/arm-fpm8.c (+83) 
- (added) clang/test/Sema/arm-fpm8.c (+11) 
- (added) clang/test/Sema/arm-fpm8.cpp (+53) 
- (modified) clang/utils/TableGen/NeonEmitter.cpp (+56-2) 
- (modified) clang/utils/TableGen/TableGen.cpp (+5) 
- (modified) clang/utils/TableGen/TableGenBackends.h (+1) 


``````````diff
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 53ece996769a8..532ec05ab90a6 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1115,6 +1115,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
   CanQualType SatShortFractTy, SatFractTy, SatLongFractTy;
   CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy,
       SatUnsignedLongFractTy;
+  CanQualType Fpm8Ty;
   CanQualType HalfTy; // [OpenCL 6.1.1.1], ARM NEON
   CanQualType BFloat16Ty;
   CanQualType Float16Ty; // C11 extension ISO/IEC TS 18661-3
diff --git a/clang/include/clang/AST/BuiltinTypes.def b/clang/include/clang/AST/BuiltinTypes.def
index 444be4311a743..0c1cccf4f73b8 100644
--- a/clang/include/clang/AST/BuiltinTypes.def
+++ b/clang/include/clang/AST/BuiltinTypes.def
@@ -221,6 +221,10 @@ FLOATING_TYPE(Float128, Float128Ty)
 // '__ibm128'
 FLOATING_TYPE(Ibm128, Ibm128Ty)
 
+
+// '__fpm8'
+UNSIGNED_TYPE(Fpm8, Fpm8Ty)
+
 //===- Language-specific types --------------------------------------------===//
 
 // This is the type of C++0x 'nullptr'.
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index fab233b62d8d1..9f835b8459847 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2492,6 +2492,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isDoubleType() const;
   bool isBFloat16Type() const;
   bool isFloat128Type() const;
+  bool isFpm8Type() const;
   bool isIbm128Type() const;
   bool isRealType() const;         // C99 6.2.5p17 (real floating + integer)
   bool isArithmeticType() const;   // C99 6.2.5p18 (integer + floating)
@@ -7944,6 +7945,10 @@ inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }
 
+inline bool Type::isFpm8Type() const {
+  return isSpecificBuiltinType(BuiltinType::Fpm8);
+}
+
 inline bool Type::isFloat128Type() const {
   return isSpecificBuiltinType(BuiltinType::Float128);
 }
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 8f85371df3b85..ab16c1fa1a162 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -7858,6 +7858,8 @@ 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<
+  "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">;
 def err_bad_static_cast_member_pointer_nonmp : Error<
diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h
index fb11e8212f8b6..b4db94d273949 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -68,6 +68,7 @@ namespace clang {
     TST_Accum,   // ISO/IEC JTC1 SC22 WG14 N1169 Extension
     TST_Fract,
     TST_BFloat16,
+    TST_Fpm8,
     TST_float,
     TST_double,
     TST_float128,
diff --git a/clang/include/clang/Basic/TargetBuiltins.h b/clang/include/clang/Basic/TargetBuiltins.h
index 4333830bf34f2..b456b75943af3 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -198,7 +198,8 @@ namespace clang {
       Float16,
       Float32,
       Float64,
-      BFloat16
+      BFloat16,
+      Fpm8
     };
 
     NeonTypeFlags(unsigned F) : Flags(F) {}
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 8a6511b9ced83..de5fd0fc09b0a 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -234,6 +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 HasIbm128;
   bool HasLongDouble;
   bool HasFPReturn;
@@ -700,6 +701,9 @@ class TargetInfo : public TransferrableTargetInfo,
     return HasBFloat16 || HasFullBFloat16;
   }
 
+  /// Determine whether the _fpm8 type is supported on this target.
+  virtual bool hasFpm8Type() const { return HasFpm8; }
+
   /// Determine whether the BFloat type is fully supported on this target, i.e
   /// arithemtic operations.
   virtual bool hasFullBFloat16Type() const { return HasFullBFloat16; }
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
index 9c4b17465e18a..c08cf760962f3 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -655,6 +655,7 @@ KEYWORD(__bool                      , KEYALTIVEC|KEYZVECTOR)
 // ARM NEON extensions.
 ALIAS("__fp16", half                , KEYALL)
 KEYWORD(__bf16                      , KEYALL)
+KEYWORD(__fpm8                      , KEYALL)
 
 // OpenCL Extension.
 KEYWORD(half                        , HALFSUPPORT)
diff --git a/clang/include/clang/Basic/arm_fpm8.td b/clang/include/clang/Basic/arm_fpm8.td
new file mode 100644
index 0000000000000..871dc5f755297
--- /dev/null
+++ b/clang/include/clang/Basic/arm_fpm8.td
@@ -0,0 +1,14 @@
+//===--- arm_fpm8.td - ARM FPM8 compiler interface ------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the TableGen definitions from which the ARM BF16 header
+//  file will be generated.
+//
+//===----------------------------------------------------------------------===//
+
+include "arm_neon_incl.td"
diff --git a/clang/include/clang/Basic/arm_neon_incl.td b/clang/include/clang/Basic/arm_neon_incl.td
index b8155c187d1bc..0d9073e489c81 100644
--- a/clang/include/clang/Basic/arm_neon_incl.td
+++ b/clang/include/clang/Basic/arm_neon_incl.td
@@ -216,6 +216,7 @@ def OP_UNAVAILABLE : Operation {
 // h: half-float
 // d: double
 // b: bfloat16
+// m: fpm8
 //
 // Typespec modifiers
 // ------------------
@@ -240,6 +241,7 @@ def OP_UNAVAILABLE : Operation {
 // B: change to BFloat16
 // P: change to polynomial category.
 // p: change polynomial to equivalent integer category. Otherwise nop.
+// M: change to Fpm8.
 //
 // >: double element width (vector size unchanged).
 // <: half element width (vector size unchanged).
diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h
index 23bc780e04979..097cb8eb642ac 100644
--- a/clang/include/clang/Sema/DeclSpec.h
+++ b/clang/include/clang/Sema/DeclSpec.h
@@ -287,6 +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_float = clang::TST_float;
   static const TST TST_double = clang::TST_double;
   static const TST TST_float16 = clang::TST_Float16;
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h
index a4728b1c06b3f..b2853c5e787d6 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -1078,6 +1078,8 @@ enum PredefinedTypeIDs {
   /// \brief The '__ibm128' type
   PREDEF_TYPE_IBM128_ID = 74,
 
+  PREDEF_TYPE_FPM8_ID = 75,
+
 /// OpenCL image types with auto numeration
 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)                   \
   PREDEF_TYPE_##Id##_ID,
@@ -1109,7 +1111,7 @@ enum PredefinedTypeIDs {
 ///
 /// Type IDs for non-predefined types will start at
 /// NUM_PREDEF_TYPE_IDs.
-const unsigned NUM_PREDEF_TYPE_IDS = 503;
+const unsigned NUM_PREDEF_TYPE_IDS = 504;
 
 // Ensure we do not overrun the predefined types we reserved
 // in the enum PredefinedTypeIDs above.
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 34aa399fda2f8..9480ff8d4bae2 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1408,6 +1408,8 @@ 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(BFloat16Ty, BuiltinType::BFloat16);
 
   // Builtin type used to help define __builtin_va_list.
@@ -1977,6 +1979,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
       Width = Target->getBoolWidth();
       Align = Target->getBoolAlign();
       break;
+    case BuiltinType::Fpm8:
     case BuiltinType::Char_S:
     case BuiltinType::Char_U:
     case BuiltinType::UChar:
@@ -8103,6 +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::Char8:
     case BuiltinType::Char_U:
     case BuiltinType::UChar:      return 'C';
@@ -11466,6 +11470,9 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
     else
       Type = Context.CharTy;
     break;
+  case 'j':
+    Type = Context.Fpm8Ty;
+    break;
   case 'b': // boolean
     assert(HowLong == 0 && !Signed && !Unsigned && "Bad modifiers for 'b'!");
     Type = Context.BoolTy;
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index ed9e6eeb36c75..76cb1e7556680 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -3181,6 +3181,7 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
   case BuiltinType::SChar:
     Out << 'a';
     break;
+  case BuiltinType::Fpm8:
   case BuiltinType::WChar_S:
   case BuiltinType::WChar_U:
     Out << 'w';
@@ -3799,6 +3800,9 @@ 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;
     default:
       llvm_unreachable("unexpected Neon vector element type");
     }
@@ -3852,6 +3856,8 @@ static StringRef mangleAArch64VectorBase(const BuiltinType *EltType) {
     return "Float64";
   case BuiltinType::BFloat16:
     return "Bfloat16";
+  case BuiltinType::Fpm8:
+    return "Fpm8_t";
   default:
     llvm_unreachable("Unexpected vector element base type");
   }
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index dd3b38fabb550..2d4967f82f4d3 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -817,6 +817,7 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
   case BuiltinType::Char32:
   case BuiltinType::UInt128:
   case BuiltinType::Int128:
+  case BuiltinType::Fpm8:
   case BuiltinType::Half:
   case BuiltinType::BFloat16:
   case BuiltinType::Float16:
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 33acae2cbafac..f629ae6d7b016 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3372,6 +3372,8 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const {
     return "unsigned __int128";
   case Half:
     return Policy.Half ? "half" : "__fp16";
+  case Fpm8:
+    return "__fpm8";
   case BFloat16:
     return "__bf16";
   case Float:
diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp
index 9dd90d9bf4e54..8df92d3921c44 100644
--- a/clang/lib/AST/TypeLoc.cpp
+++ b/clang/lib/AST/TypeLoc.cpp
@@ -361,6 +361,7 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const {
   case BuiltinType::Long:
   case BuiltinType::LongLong:
   case BuiltinType::Int128:
+  case BuiltinType::Fpm8:
   case BuiltinType::Half:
   case BuiltinType::Float:
   case BuiltinType::Double:
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index 29f5cd14e46e1..c18a80384d518 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -60,6 +60,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) {
   NoAsmVariants = false;
   HasLegalHalfType = false;
   HalfArgsAndReturns = false;
+  HasFpm8 = false;
   HasFloat128 = false;
   HasIbm128 = false;
   HasFloat16 = false;
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index 13515699caea4..dd58fd965b718 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -543,6 +543,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
     Builder.defineMacro("__ARM_FEATURE_BF16_SCALAR_ARITHMETIC", "1");
   }
 
+  if (HasFpm8) {
+    Builder.defineMacro("__ARM_FEATURE_FP8", "1");
+  }
   if ((FPU & SveMode) && HasBFloat16) {
     Builder.defineMacro("__ARM_FEATURE_SVE_BF16", "1");
   }
@@ -726,6 +729,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
       .Case("sha3", HasSHA3)
       .Cases("aes", "pmull", HasAES)
       .Cases("fp16", "fullfp16", HasFullFP16)
+      .Case("fp8", HasFpm8)
       .Case("dit", HasDIT)
       .Case("dpb", HasCCPP)
       .Case("dpb2", HasCCDP)
@@ -937,6 +941,9 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
       FPU |= NeonMode;
       HasSM4 = true;
     }
+    if (Feature == "+fp8") {
+      HasFpm8 = true;
+    }
     if (Feature == "+strict-align")
       HasUnalignedAccess = false;
 
@@ -1209,6 +1216,8 @@ bool AArch64TargetInfo::hasBFloat16Type() const {
   return true;
 }
 
+bool AArch64TargetInfo::hasFpm8Type() const { return true; }
+
 TargetInfo::CallingConvCheckResult
 AArch64TargetInfo::checkCallingConvention(CallingConv CC) const {
   switch (CC) {
diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h
index 22d7c420d5510..6a0f595c9996a 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -47,6 +47,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
   bool HasLS64 = false;
   bool HasRandGen = false;
   bool HasMatMul = false;
+  bool HasFpm8 = false;
   bool HasBFloat16 = false;
   bool HasSVE2 = false;
   bool HasSVE2AES = false;
@@ -169,6 +170,8 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
 
   bool hasBFloat16Type() const override;
 
+  bool hasFpm8Type() const override;
+
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
 
   bool isCLZForZeroUndef() const override;
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 7423626d7c3cb..a75038ba7c2e1 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -661,6 +661,8 @@ bool ARMTargetInfo::hasBFloat16Type() const {
   return HasBFloat16 || (FPU && !SoftFloat);
 }
 
+bool ARMTargetInfo::hasFpm8Type() const { return true; }
+
 bool ARMTargetInfo::isValidCPUName(StringRef Name) const {
   return Name == "generic" ||
          llvm::ARM::parseCPUArch(Name) != llvm::ARM::ArchKind::INVALID;
diff --git a/clang/lib/Basic/Targets/ARM.h b/clang/lib/Basic/Targets/ARM.h
index df9855a52e61c..c826fb8c97085 100644
--- a/clang/lib/Basic/Targets/ARM.h
+++ b/clang/lib/Basic/Targets/ARM.h
@@ -176,6 +176,8 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetInfo : public TargetInfo {
 
   bool hasBFloat16Type() const override;
 
+  bool hasFpm8Type() const override;
+
   bool isValidCPUName(StringRef Name) const override;
   void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
 
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 511e1fd4016d7..484fcfd6b16ff 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -6229,7 +6229,8 @@ static llvm::FixedVectorType *GetNeonType(CodeGenFunction *CGF,
   switch (TypeFlags.getEltType()) {
   case NeonTypeFlags::Int8:
   case NeonTypeFlags::Poly8:
-    return llvm::FixedVectorType::get(CGF->Int8Ty, V1Ty ? 1 : (8 << IsQuad));
+  case NeonTypeFlags::Fpm8:
+    return llvm::FixedVectorType::get(CGF->Fpm8Ty, V1Ty ? 1 : (8 << IsQuad));
   case NeonTypeFlags::Int16:
   case NeonTypeFlags::Poly16:
     return llvm::FixedVectorType::get(CGF->Int16Ty, V1Ty ? 1 : (4 << IsQuad));
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 572ba84d22ef5..6d448d31950b7 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -868,6 +868,7 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
 
   case BuiltinType::UChar:
   case BuiltinType::Char_U:
+  case BuiltinType::Fpm8:
     Encoding = llvm::dwarf::DW_ATE_unsigned_char;
     break;
   case BuiltinType::Char_S:
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index dd4a665ebc78b..6ace7ea48da68 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -351,6 +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);
   HalfTy = llvm::Type::getHalfTy(LLVMContext);
   BFloatTy = llvm::Type::getBFloatTy(LLVMContext);
   FloatTy = llvm::Type::getFloatTy(LLVMContext);
diff --git a/clang/lib/CodeGen/CodeGenTypeCache.h b/clang/lib/CodeGen/CodeGenTypeCache.h
index e273ebe3b060f..a24d1234cc99e 100644
--- a/clang/lib/CodeGen/CodeGenTypeCache.h
+++ b/clang/lib/CodeGen/CodeGenTypeCache.h
@@ -38,6 +38,9 @@ struct CodeGenTypeCache {
   /// half, bfloat, float, double
   llvm::Type *HalfTy, *BFloatTy, *FloatTy, *DoubleTy;
 
+  /// fpm8 from FP8 is an alias for 8bits data
+  llvm::IntegerType *Fpm8Ty;
+
   /// int
   llvm::IntegerType *IntTy;
 
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 0a926e4ac27fe..626525f66e3e7 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -419,7 +419,9 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
                                     Context.getFloatTypeSemantics(T),
                                     /* UseNativeHalf = */ false);
       break;
-
+    case BuiltinType::Fpm8:
+      ResultType = llvm::Type::getInt8Ty(getLLVMContext());
+      break;
     case BuiltinType::NullPtr:
       // Model std::nullptr_t as i8*
       ResultType = llvm::PointerType::getUnqual(getLLVMContext());
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 5a3e83de625c9..e3c6cb53f9d15 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3387,6 +3387,7 @@ static bool TypeInfoIsInStandardLibrary(const BuiltinType *Ty) {
     case BuiltinType::SatUFract:
     case BuiltinType::SatULongFract:
     case BuiltinType::BFloat16:
+    case BuiltinType::Fpm8:
       return false;
 
     case BuiltinType::Dependent:
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index d3090e488306f..ae957399a2a7c 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -391,6 +391,8 @@ if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
   clang_generate_header(-gen-arm-sme-header arm_sme.td arm_sme.h)
   # Generate arm_bf16.h
   clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
+  # Generate arm_fpm8.h
+  clang_generate_header(-gen-arm-fpm8 arm_fpm8.td arm_fpm8.h)
   # Generate arm_mve.h
   clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
   # Generate arm_cde.h
@@ -414,6 +416,7 @@ if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
     "${CMAKE_CURRENT_BINARY_DIR}/arm_sme.h"
     "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h"
     "${CMAKE_CURRENT_BINARY_DIR}/arm_vector_types.h"
+    "${CMAKE_CURRENT_BINARY_DIR}/arm_fpm8.h"
     )
 endif()
 if(RISCV IN_LIST LLVM_TARGETS_TO_BUILD)
diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/99865


More information about the cfe-commits mailing list