stuij created this revision. Herald added subscribers: cfe-commits, danielkiss, kristof.beyls. Herald added a project: clang. stuij added a parent revision: D76077: [ARM] Add __bf16 as new Bfloat16 C Type. stuij added a child revision: D79708: [clangd][BFloat] add NEON emitter for bfloat.
The poly64 types are guarded with ifdefs for AArch64 only. This is wrong. This was also incorrectly documented in the ACLE spec, but this has been rectified in the latest release. See paragraph 13.1.2 "Vector data types": https://developer.arm.com/docs/101028/latest Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D79711 Files: clang/include/clang/Basic/TargetBuiltins.h clang/lib/AST/ItaniumMangle.cpp clang/lib/Sema/SemaType.cpp clang/utils/TableGen/NeonEmitter.cpp Index: clang/utils/TableGen/NeonEmitter.cpp =================================================================== --- clang/utils/TableGen/NeonEmitter.cpp +++ clang/utils/TableGen/NeonEmitter.cpp @@ -2235,6 +2235,7 @@ OS << "#else\n"; OS << "typedef int8_t poly8_t;\n"; OS << "typedef int16_t poly16_t;\n"; + OS << "typedef int64_t poly64_t;\n"; OS << "#endif\n"; // Emit Neon vector typedefs. @@ -2247,7 +2248,7 @@ for (auto &TS : TDTypeVec) { bool IsA64 = false; Type T(TS, "."); - if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64)) + if (T.isDouble()) IsA64 = true; if (InIfdef && !IsA64) { @@ -2280,7 +2281,7 @@ for (auto &TS : TDTypeVec) { bool IsA64 = false; Type T(TS, "."); - if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64)) + if (T.isDouble()) IsA64 = true; if (InIfdef && !IsA64) { Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -7552,15 +7552,16 @@ Triple.getArch() == llvm::Triple::aarch64_be; if (VecKind == VectorType::NeonPolyVector) { if (IsPolyUnsigned) { - // AArch64 polynomial vectors are unsigned and support poly64. + // AArch64 polynomial vectors are unsigned. return BTy->getKind() == BuiltinType::UChar || BTy->getKind() == BuiltinType::UShort || BTy->getKind() == BuiltinType::ULong || BTy->getKind() == BuiltinType::ULongLong; } else { - // AArch32 polynomial vector are signed. + // AArch32 polynomial vectors are signed. return BTy->getKind() == BuiltinType::SChar || - BTy->getKind() == BuiltinType::Short; + BTy->getKind() == BuiltinType::Short || + BTy->getKind() == BuiltinType::LongLong; } } Index: clang/lib/AST/ItaniumMangle.cpp =================================================================== --- clang/lib/AST/ItaniumMangle.cpp +++ clang/lib/AST/ItaniumMangle.cpp @@ -3165,6 +3165,7 @@ case BuiltinType::UShort: EltName = "poly16_t"; break; + case BuiltinType::LongLong: case BuiltinType::ULongLong: EltName = "poly64_t"; break; Index: clang/include/clang/Basic/TargetBuiltins.h =================================================================== --- clang/include/clang/Basic/TargetBuiltins.h +++ clang/include/clang/Basic/TargetBuiltins.h @@ -157,7 +157,7 @@ EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } bool isPoly() const { EltType ET = getEltType(); - return ET == Poly8 || ET == Poly16; + return ET == Poly8 || ET == Poly16 || ET == Poly64; } bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } bool isQuad() const { return (Flags & QuadFlag) != 0; }
Index: clang/utils/TableGen/NeonEmitter.cpp =================================================================== --- clang/utils/TableGen/NeonEmitter.cpp +++ clang/utils/TableGen/NeonEmitter.cpp @@ -2235,6 +2235,7 @@ OS << "#else\n"; OS << "typedef int8_t poly8_t;\n"; OS << "typedef int16_t poly16_t;\n"; + OS << "typedef int64_t poly64_t;\n"; OS << "#endif\n"; // Emit Neon vector typedefs. @@ -2247,7 +2248,7 @@ for (auto &TS : TDTypeVec) { bool IsA64 = false; Type T(TS, "."); - if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64)) + if (T.isDouble()) IsA64 = true; if (InIfdef && !IsA64) { @@ -2280,7 +2281,7 @@ for (auto &TS : TDTypeVec) { bool IsA64 = false; Type T(TS, "."); - if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64)) + if (T.isDouble()) IsA64 = true; if (InIfdef && !IsA64) { Index: clang/lib/Sema/SemaType.cpp =================================================================== --- clang/lib/Sema/SemaType.cpp +++ clang/lib/Sema/SemaType.cpp @@ -7552,15 +7552,16 @@ Triple.getArch() == llvm::Triple::aarch64_be; if (VecKind == VectorType::NeonPolyVector) { if (IsPolyUnsigned) { - // AArch64 polynomial vectors are unsigned and support poly64. + // AArch64 polynomial vectors are unsigned. return BTy->getKind() == BuiltinType::UChar || BTy->getKind() == BuiltinType::UShort || BTy->getKind() == BuiltinType::ULong || BTy->getKind() == BuiltinType::ULongLong; } else { - // AArch32 polynomial vector are signed. + // AArch32 polynomial vectors are signed. return BTy->getKind() == BuiltinType::SChar || - BTy->getKind() == BuiltinType::Short; + BTy->getKind() == BuiltinType::Short || + BTy->getKind() == BuiltinType::LongLong; } } Index: clang/lib/AST/ItaniumMangle.cpp =================================================================== --- clang/lib/AST/ItaniumMangle.cpp +++ clang/lib/AST/ItaniumMangle.cpp @@ -3165,6 +3165,7 @@ case BuiltinType::UShort: EltName = "poly16_t"; break; + case BuiltinType::LongLong: case BuiltinType::ULongLong: EltName = "poly64_t"; break; Index: clang/include/clang/Basic/TargetBuiltins.h =================================================================== --- clang/include/clang/Basic/TargetBuiltins.h +++ clang/include/clang/Basic/TargetBuiltins.h @@ -157,7 +157,7 @@ EltType getEltType() const { return (EltType)(Flags & EltTypeMask); } bool isPoly() const { EltType ET = getEltType(); - return ET == Poly8 || ET == Poly16; + return ET == Poly8 || ET == Poly16 || ET == Poly64; } bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; } bool isQuad() const { return (Flags & QuadFlag) != 0; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits