Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
bool isHalfType() const; // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
bool isFloat16Type() const; // C11 extension ISO/IEC TS 18661
bool isFloat32Type() const;
bool isDoubleType() const;
bool isBFloat16Type() const;
bool isFloat128Type() const;
bool isIbm128Type() const;
Expand Down Expand Up @@ -7457,6 +7458,10 @@ inline bool Type::isFloat32Type() const {
return isSpecificBuiltinType(BuiltinType::Float);
}

inline bool Type::isDoubleType() const {
return isSpecificBuiltinType(BuiltinType::Double);
}

inline bool Type::isBFloat16Type() const {
return isSpecificBuiltinType(BuiltinType::BFloat16);
}
Expand Down
6 changes: 2 additions & 4 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5486,10 +5486,8 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {

bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
if (const auto *VecTy = dyn_cast<VectorType>(PassedType)) {
clang::QualType BaseType = VecTy->getElementType();
return !BaseType->isHalfType() && !BaseType->isFloat32Type();
}
if (const auto *VecTy = PassedType->getAs<VectorType>())
return VecTy->getElementType()->isDoubleType();
return false;
};
return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy,
Expand Down