[clang] [AArch64] Refactor implementation of FP8 types (NFC) (PR #118969)

Momchil Velikov via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 11 12:22:23 PST 2024


================
@@ -4374,15 +4379,18 @@ ASTContext::getBuiltinVectorTypeInfo(const BuiltinType *Ty) const {
                                ElBits, NF)                                     \
   case BuiltinType::Id:                                                        \
     return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
+#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls,     \
+                               ElBits, NF)                                     \
+  case BuiltinType::Id:                                                        \
+    return {MFloat8Ty, llvm::ElementCount::getScalable(NumEls), NF};
----------------
momchil-velikov wrote:

> Why are you returning MFloat8Ty it should be SingletonId, no?

This inside the definition of `SVE_VECTOR_TYPE_MFLOAT`. The vector element type is `__mfp8`.
Very similar to the case for `__bf16` just above.

> At least it should have an explanation to why this is different. Is it because of AArrch64.cpp to build the scalable vector.

This function is described as
```    
/// Returns the element type, element count and number of vectors
/// (in case of tuple) for a builtin vector type.
  BuiltinVectorTypeInfo
  getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const;
```

I don't think properly implementing it for any builtin vector type needs special explanation.
A special explanation would be needed if some type was an exception.


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


More information about the cfe-commits mailing list