768 changes: 376 additions & 392 deletions clang/lib/Sema/SemaTemplateInstantiate.cpp

Large diffs are not rendered by default.

46 changes: 37 additions & 9 deletions clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "TreeTransform.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
Expand Down Expand Up @@ -4685,6 +4686,36 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD,
ParmVarDecl *Param) {
assert(Param->hasUninstantiatedDefaultArg());

NamedDecl *Pattern = FD;
std::optional<ArrayRef<TemplateArgument>> Innermost;

// C++ [dcl.fct.default]p4
// For non-template functions, default arguments can be added in later
// declarations of a function that inhabit the same scope.
//
// C++ [dcl.fct.default]p6
// Except for member functions of templated classes, the default arguments
// in a member function definition that appears outside of the class
// definition are added to the set of default arguments provided by the
// member function declaration in the class definition; the program is
// ill-formed if a default constructor, copy or move constructor, or copy
// or move assignment operator is so declared. Default arguments for a
// member function of a templated class shall be specified on the initial
// declaration of the member function within the templated class.
//
// We need to collect the template arguments from the context of the function
// where the default argument was defined. For a specialization of a function
// template explicitly specialized for an implicit instantiation of a class
// template, that context is the (implicitly instantiated) declaration in the
// definition of the class template specialization.
if (FD->isCXXClassMember() &&
!isGenericLambdaCallOperatorOrStaticInvokerSpecialization(FD)) {
if (FunctionTemplateDecl *FTD = FD->getPrimaryTemplate()) {
Pattern = FTD->getFirstDecl();
Innermost = FD->getTemplateSpecializationArgs()->asArray();
}
}

// Instantiate the expression.
//
// FIXME: Pass in a correct Pattern argument, otherwise
Expand All @@ -4702,12 +4733,10 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD,
//
// template<typename T>
// A<T> Foo(int a = A<T>::FooImpl());
MultiLevelTemplateArgumentList TemplateArgs = getTemplateInstantiationArgs(
FD, FD->getLexicalDeclContext(),
/*Final=*/false, /*Innermost=*/std::nullopt,
/*RelativeToPrimary=*/true, /*Pattern=*/nullptr,
/*ForConstraintInstantiation=*/false, /*SkipForSpecialization=*/false,
/*ForDefaultArgumentSubstitution=*/true);
MultiLevelTemplateArgumentList TemplateArgs =
getTemplateInstantiationArgs(Pattern, Pattern->getLexicalDeclContext(),
/*Final=*/false, Innermost,
/*RelativeToPrimary=*/true);

if (SubstDefaultArgument(CallLoc, Param, TemplateArgs, /*ForCallExpr*/ true))
return true;
Expand Down Expand Up @@ -4748,7 +4777,7 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
MultiLevelTemplateArgumentList TemplateArgs =
getTemplateInstantiationArgs(Decl, Decl->getLexicalDeclContext(),
/*Final=*/false, /*Innermost=*/std::nullopt,
/*RelativeToPrimary*/ true);
/*RelativeToPrimary=*/true);

// FIXME: We can't use getTemplateInstantiationPattern(false) in general
// here, because for a non-defining friend declaration in a class template,
Expand Down Expand Up @@ -5186,8 +5215,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
SetDeclDefaulted(Function, PatternDecl->getLocation());
} else {
MultiLevelTemplateArgumentList TemplateArgs = getTemplateInstantiationArgs(
Function, Function->getLexicalDeclContext(), /*Final=*/false,
/*Innermost=*/std::nullopt, false, PatternDecl);
Function, Function->getLexicalDeclContext());

// Substitute into the qualifier; we can get a substitution failure here
// through evil use of alias templates.
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15661,12 +15661,14 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
return true;
}

if (ParenExpr *PE = dyn_cast_or_null<ParenExpr>(Result.get()))
PE->setIsProducedByFoldExpansion();

// If we had no init and an empty pack, and we're not retaining an expansion,
// then produce a fallback value or error.
if (Result.isUnset())
return getDerived().RebuildEmptyCXXFoldExpr(E->getEllipsisLoc(),
E->getOperator());

return Result;
}

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10003,7 +10003,8 @@ void ASTReader::finishPendingActions() {

auto RTD = cast<RedeclarableTemplateDecl>(D)->getCanonicalDecl();
for (auto *R = getMostRecentExistingDecl(RTD); R; R = R->getPreviousDecl())
cast<RedeclarableTemplateDecl>(R)->Common = RTD->Common;
cast<RedeclarableTemplateDecl>(R)->setCommonPtr(
RTD->getCommonPtrInternal());
}
PendingDefinitions.clear();

Expand Down
18 changes: 9 additions & 9 deletions clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,11 +2416,13 @@ ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
// Make sure we've allocated the Common pointer first. We do this before
// VisitTemplateDecl so that getCommonPtr() can be used during initialization.
RedeclarableTemplateDecl *CanonD = D->getCanonicalDecl();
if (!CanonD->Common) {
CanonD->Common = CanonD->newCommon(Reader.getContext());
if (!CanonD->getCommonPtrInternal()) {
CanonD->setCommonPtr(CanonD->newCommon(Reader.getContext()));
Reader.PendingDefinitions.insert(CanonD);
}
D->Common = CanonD->Common;
D->setCommonPtr(CanonD->getCommonPtrInternal());
if (Record.readInt())
D->setMemberSpecialization();

// If this is the first declaration of the template, fill in the information
// for the 'common' pointer.
Expand All @@ -2429,8 +2431,6 @@ ASTDeclReader::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
assert(RTD->getKind() == D->getKind() &&
"InstantiatedFromMemberTemplate kind mismatch");
D->setInstantiatedFromMemberTemplate(RTD);
if (Record.readInt())
D->setMemberSpecialization();
}
}

Expand Down Expand Up @@ -2562,12 +2562,12 @@ void ASTDeclReader::VisitClassTemplatePartialSpecializationDecl(
D->TemplateParams = Params;

RedeclarableResult Redecl = VisitClassTemplateSpecializationDeclImpl(D);
D->InstantiatedFromMember.setInt(Record.readInt());

// These are read/set from/to the first declaration.
if (ThisDeclID == Redecl.getFirstID()) {
D->InstantiatedFromMember.setPointer(
readDeclAs<ClassTemplatePartialSpecializationDecl>());
D->InstantiatedFromMember.setInt(Record.readInt());
readDeclAs<ClassTemplatePartialSpecializationDecl>());
}
}

Expand Down Expand Up @@ -2660,12 +2660,12 @@ void ASTDeclReader::VisitVarTemplatePartialSpecializationDecl(
D->TemplateParams = Params;

RedeclarableResult Redecl = VisitVarTemplateSpecializationDeclImpl(D);
D->InstantiatedFromMember.setInt(Record.readInt());

// These are read/set from/to the first declaration.
if (ThisDeclID == Redecl.getFirstID()) {
D->InstantiatedFromMember.setPointer(
readDeclAs<VarTemplatePartialSpecializationDecl>());
D->InstantiatedFromMember.setInt(Record.readInt());
}
}

Expand Down Expand Up @@ -2888,7 +2888,7 @@ void ASTDeclReader::mergeRedeclarableTemplate(RedeclarableTemplateDecl *D,
// If we merged the template with a prior declaration chain, merge the
// common pointer.
// FIXME: Actually merge here, don't just overwrite.
D->Common = D->getCanonicalDecl()->Common;
D->setCommonPtr(D->getCanonicalDecl()->getCommonPtrInternal());
}

/// "Cast" to type T, asserting if we don't have an implicit conversion.
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Serialization/ASTReaderStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ void ASTStmtReader::VisitCharacterLiteral(CharacterLiteral *E) {

void ASTStmtReader::VisitParenExpr(ParenExpr *E) {
VisitExpr(E);
E->setIsProducedByFoldExpansion(Record.readInt());
E->setLParen(readSourceLocation());
E->setRParen(readSourceLocation());
E->setSubExpr(Record.readSubExpr());
Expand Down
17 changes: 7 additions & 10 deletions clang/lib/Serialization/ASTWriterDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,14 +1713,13 @@ void ASTDeclWriter::VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D) {
void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
VisitRedeclarable(D);

Record.push_back(D->isMemberSpecialization());

// Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
// getCommonPtr() can be used while this is still initializing.
if (D->isFirstDecl()) {
if (D->isFirstDecl())
// This declaration owns the 'common' pointer, so serialize that data now.
Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
if (D->getInstantiatedFromMemberTemplate())
Record.push_back(D->isMemberSpecialization());
}

VisitTemplateDecl(D);
Record.push_back(D->getIdentifierNamespace());
Expand Down Expand Up @@ -1806,11 +1805,10 @@ void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(

VisitClassTemplateSpecializationDecl(D);

Record.push_back(D->isMemberSpecialization());
// These are read/set from/to the first declaration.
if (D->getPreviousDecl() == nullptr) {
if (D->isFirstDecl())
Record.AddDeclRef(D->getInstantiatedFromMember());
Record.push_back(D->isMemberSpecialization());
}

Code = serialization::DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION;
}
Expand Down Expand Up @@ -1874,12 +1872,11 @@ void ASTDeclWriter::VisitVarTemplatePartialSpecializationDecl(
Record.AddTemplateParameterList(D->getTemplateParameters());

VisitVarTemplateSpecializationDecl(D);
Record.push_back(D->isMemberSpecialization());

// These are read/set from/to the first declaration.
if (D->getPreviousDecl() == nullptr) {
if (D->isFirstDecl())
Record.AddDeclRef(D->getInstantiatedFromMember());
Record.push_back(D->isMemberSpecialization());
}

Code = serialization::DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION;
}
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Serialization/ASTWriterStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ void ASTStmtWriter::VisitCharacterLiteral(CharacterLiteral *E) {

void ASTStmtWriter::VisitParenExpr(ParenExpr *E) {
VisitExpr(E);
Record.push_back(E->isProducedByFoldExpansion());
Record.AddSourceLocation(E->getLParen());
Record.AddSourceLocation(E->getRParen());
Record.AddStmt(E->getSubExpr());
Expand Down
9 changes: 3 additions & 6 deletions clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,9 @@ HeaderIncludes::HeaderIncludes(StringRef FileName, StringRef Code,
// - If CategoryEndOffset[Priority] isn't set, use the next higher value
// that is set, up to CategoryEndOffset[Highest].
auto Highest = Priorities.begin();
if (CategoryEndOffsets.find(*Highest) == CategoryEndOffsets.end()) {
if (FirstIncludeOffset >= 0)
CategoryEndOffsets[*Highest] = FirstIncludeOffset;
else
CategoryEndOffsets[*Highest] = MinInsertOffset;
}
auto [It, Inserted] = CategoryEndOffsets.try_emplace(*Highest);
if (Inserted)
It->second = FirstIncludeOffset >= 0 ? FirstIncludeOffset : MinInsertOffset;
// By this point, CategoryEndOffset[Highest] is always set appropriately:
// - to an appropriate location before/after existing #includes, or
// - to right after the header guard, or
Expand Down
34 changes: 34 additions & 0 deletions clang/test/AST/solaris-tm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// Check that std::tm and a few others are mangled as tm on Solaris only.
/// Issue #33114.
///
// RUN: %clang_cc1 -emit-llvm %s -o - -triple amd64-pc-solaris2.11 | FileCheck --check-prefix=CHECK-SOLARIS %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck --check-prefix=CHECK-LINUX %s
//
// REQUIRES: x86-registered-target

namespace std {
extern "C" {
struct tm {
int tm_sec;
};
struct ldiv_t {
long quot;
};
}
}

// CHECK-SOLARIS: @_Z6tmfunc2tm
// CHECK-SOLARIS: @_Z9tmccpfunc2tmPKcS1_
// CHECK-SOLARIS: @_Z7tm2func2tmS_
// CHECK-LINUX: @_Z6tmfuncSt2tm
// CHECK-LINUX: @_Z9tmccpfuncSt2tmPKcS1_
// CHECK-LINUX: @_Z7tm2funcSt2tmS_

void tmfunc (std::tm tm) {}
void tmccpfunc (std::tm tm, const char *ccp, const char *ccp2) {}
void tm2func (std::tm tm, std::tm tm2) {}

// CHECK-SOLARIS: @_Z7ldtfunc6ldiv_t
// CHECK-LINUX: @_Z7ldtfuncSt6ldiv_t

void ldtfunc (std::ldiv_t ldt) {}
175 changes: 175 additions & 0 deletions clang/test/CXX/temp/temp.constr/temp.constr.decl/p4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
// RUN: %clang_cc1 -std=c++20 -verify %s
// expected-no-diagnostics

template<typename T>
concept D = true;

template<typename T>
struct A {
template<typename U, bool V>
void f() requires V;

template<>
void f<short, true>();

template<D U>
void g();

template<typename U, bool V> requires V
struct B;

template<typename U, bool V> requires V
struct B<U*, V>;

template<>
struct B<short, true>;

template<D U>
struct C;

template<D U>
struct C<U*>;

template<typename U, bool V> requires V
static int x;

template<typename U, bool V> requires V
static int x<U*, V>;

template<>
int x<short, true>;

template<D U>
static int y;

template<D U>
static int y<U*>;
};

template<typename T>
template<typename U, bool V>
void A<T>::f() requires V { }

template<typename T>
template<D U>
void A<T>::g() { }

template<typename T>
template<typename U, bool V> requires V
struct A<T>::B { };

template<typename T>
template<typename U, bool V> requires V
struct A<T>::B<U*, V> { };

template<typename T>
template<typename U, bool V> requires V
struct A<T>::B<U&, V> { };

template<typename T>
template<D U>
struct A<T>::C { };

template<typename T>
template<D U>
struct A<T>::C<U*> { };

template<typename T>
template<typename U, bool V> requires V
int A<T>::x = 0;

template<typename T>
template<typename U, bool V> requires V
int A<T>::x<U*, V> = 0;

template<typename T>
template<typename U, bool V> requires V
int A<T>::x<U&, V> = 0;

template<typename T>
template<D U>
int A<T>::y = 0;

template<typename T>
template<D U>
int A<T>::y<U*> = 0;

template<>
template<typename U, bool V>
void A<short>::f() requires V;

template<>
template<>
void A<short>::f<int, true>();

template<>
template<>
void A<void>::f<int, true>();

template<>
template<D U>
void A<short>::g();

template<>
template<typename U, bool V> requires V
struct A<int>::B;

template<>
template<>
struct A<int>::B<int, true>;

template<>
template<>
struct A<void>::B<int, true>;

template<>
template<typename U, bool V> requires V
struct A<int>::B<U*, V>;

template<>
template<typename U, bool V> requires V
struct A<int>::B<U&, V>;

template<>
template<D U>
struct A<int>::C;

template<>
template<D U>
struct A<int>::C<U*>;

template<>
template<D U>
struct A<int>::C<U&>;

template<>
template<typename U, bool V> requires V
int A<long>::x;

template<>
template<>
int A<long>::x<int, true>;

template<>
template<>
int A<void>::x<int, true>;

template<>
template<typename U, bool V> requires V
int A<long>::x<U*, V>;

template<>
template<typename U, bool V> requires V
int A<long>::x<U&, V>;

template<>
template<D U>
int A<long>::y;

template<>
template<D U>
int A<long>::y<U*>;

template<>
template<D U>
int A<long>::y<U&>;
178 changes: 178 additions & 0 deletions clang/test/CXX/temp/temp.spec/temp.expl.spec/p7.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s

namespace Undefined {
template<typename T>
struct A {
template<typename U>
static constexpr int f(); // expected-note {{declared here}}

template<typename U>
static const int x; // expected-note {{declared here}}

template<typename U>
static const int x<U*>; // expected-note {{declared here}}

template<typename U>
struct B; // expected-note {{template is declared here}}

template<typename U>
struct B<U*>; // expected-note {{template is declared here}}
};

template<>
template<typename U>
constexpr int A<short>::f() {
return A<long>::f<U>();
}

template<>
template<typename U>
constexpr int A<short>::x = A<long>::x<U>;

template<>
template<typename U>
constexpr int A<short>::x<U*> = A<long>::x<U*>;

template<>
template<typename U>
struct A<short>::B<U*> {
static constexpr int y = A<long>::B<U*>::y;
};

template<>
template<typename U>
struct A<short>::B {
static constexpr int y = A<long>::B<U>::y;
};

template<>
template<typename U>
constexpr int A<long>::f() {
return 1;
}

template<>
template<typename U>
constexpr int A<long>::x = 1;

template<>
template<typename U>
constexpr int A<long>::x<U*> = 2;

template<>
template<typename U>
struct A<long>::B {
static constexpr int y = 1;
};

template<>
template<typename U>
struct A<long>::B<U*> {
static constexpr int y = 2;
};

static_assert(A<int>::f<int>() == 0); // expected-error {{static assertion expression is not an integral constant expression}}
// expected-note@-1 {{undefined function 'f<int>' cannot be used in a constant expression}}
static_assert(A<int>::x<int> == 0); // expected-error {{static assertion expression is not an integral constant expression}}
// expected-note@-1 {{initializer of 'x<int>' is unknown}}
static_assert(A<int>::x<int*> == 0); // expected-error {{static assertion expression is not an integral constant expression}}
// expected-note@-1 {{initializer of 'x<int *>' is unknown}}
static_assert(A<int>::B<int>::y == 0); // expected-error {{implicit instantiation of undefined template 'Undefined::A<int>::B<int>'}}
static_assert(A<int>::B<int*>::y == 0); // expected-error {{implicit instantiation of undefined template 'Undefined::A<int>::B<int *>'}}

static_assert(A<short>::f<int>() == 1);
static_assert(A<short>::x<int> == 1);
static_assert(A<short>::x<int*> == 2);
static_assert(A<short>::B<int>::y == 1);
static_assert(A<short>::B<int*>::y == 2);
} // namespace Undefined

namespace Defined {
template<typename T>
struct A {
template<typename U>
static constexpr int f() {
return 0;
};

template<typename U>
static const int x = 0;

template<typename U>
static const int x<U*> = 0;

template<typename U>
struct B {
static constexpr int y = 0;
};

template<typename U>
struct B<U*> {
static constexpr int y = 0;
};
};

template<>
template<typename U>
constexpr int A<short>::f() {
return A<long>::f<U>();
}

template<>
template<typename U>
constexpr int A<short>::x = A<long>::x<U>;

template<>
template<typename U>
constexpr int A<short>::x<U*> = A<long>::x<U*>;

template<>
template<typename U>
struct A<short>::B<U*> {
static constexpr int y = A<long>::B<U*>::y;
};

template<>
template<typename U>
struct A<short>::B {
static constexpr int y = A<long>::B<U>::y;
};

template<>
template<typename U>
constexpr int A<long>::f() {
return 1;
}

template<>
template<typename U>
constexpr int A<long>::x = 1;

template<>
template<typename U>
constexpr int A<long>::x<U*> = 2;

template<>
template<typename U>
struct A<long>::B {
static constexpr int y = 1;
};

template<>
template<typename U>
struct A<long>::B<U*> {
static constexpr int y = 2;
};

static_assert(A<int>::f<int>() == 0);
static_assert(A<int>::x<int> == 0);
static_assert(A<int>::x<int*> == 0);
static_assert(A<int>::B<int>::y == 0);
static_assert(A<int>::B<int*>::y == 0);

static_assert(A<short>::f<int>() == 1);
static_assert(A<short>::x<int> == 1);
static_assert(A<short>::x<int*> == 2);
static_assert(A<short>::B<int>::y == 1);
static_assert(A<short>::B<int*>::y == 2);
} // namespace Defined
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
// REQUIRES: riscv-registered-target
// RUN: %clang_cc1 -triple riscv64 -target-feature +v -target-feature +zfh \
// RUN: -target-feature +zvfhmin -disable-O0-optnone \
// RUN: -emit-llvm %s -o - | opt -S -passes=mem2reg | \
// RUN: FileCheck --check-prefix=CHECK-RV64 %s

#include <riscv_vector.h>

// CHECK-RV64-LABEL: define dso_local <vscale x 4 x i64> @test_vget_v_u64m4x2_u64m4
// CHECK-RV64-SAME: (target("riscv.vector.tuple", <vscale x 32 x i8>, 2) [[SRC:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 4 x i64> @llvm.riscv.tuple.extract.nxv4i64.triscv.vector.tuple_nxv32i8_2t(target("riscv.vector.tuple", <vscale x 32 x i8>, 2) [[SRC]], i32 1)
// CHECK-RV64-NEXT: ret <vscale x 4 x i64> [[TMP0]]
//
vuint64m4_t test_vget_v_u64m4x2_u64m4(vuint64m4x2_t src) {
return __riscv_vget_v_u64m4x2_u64m4(src, 1);
}

// CHECK-RV64-LABEL: define dso_local target("riscv.vector.tuple", <vscale x 32 x i8>, 2) @test_vset_v_u64m4_u64m4x2
// CHECK-RV64-SAME: (target("riscv.vector.tuple", <vscale x 32 x i8>, 2) [[DEST:%.*]], <vscale x 4 x i64> [[VAL:%.*]]) #[[ATTR0]] {
// CHECK-RV64-NEXT: entry:
// CHECK-RV64-NEXT: [[TMP0:%.*]] = call target("riscv.vector.tuple", <vscale x 32 x i8>, 2) @llvm.riscv.tuple.insert.triscv.vector.tuple_nxv32i8_2t.nxv4i64(target("riscv.vector.tuple", <vscale x 32 x i8>, 2) [[DEST]], <vscale x 4 x i64> [[VAL]], i32 1)
// CHECK-RV64-NEXT: ret target("riscv.vector.tuple", <vscale x 32 x i8>, 2) [[TMP0]]
//
vuint64m4x2_t test_vset_v_u64m4_u64m4x2(vuint64m4x2_t dest, vuint64m4_t val) {
return __riscv_vset_v_u64m4_u64m4x2(dest, 1, val);
}
16 changes: 16 additions & 0 deletions clang/test/CodeGen/X86/avx-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,3 +2097,19 @@ float test_mm256_cvtss_f32(__m256 __a)
// CHECK: extractelement <8 x float> %{{.*}}, i32 0
return _mm256_cvtss_f32(__a);
}

// Test constexpr handling.
#if defined(__cplusplus) && (__cplusplus >= 201103L)

void test_constexpr() {
constexpr __m256d v_mm256_setzero_pd = _mm256_setzero_pd();
static_assert(v_mm256_setzero_pd[0] == +0.0 && v_mm256_setzero_pd[1] == +0.0 && v_mm256_setzero_pd[2] == +0.0 && v_mm256_setzero_pd[3] == +0.0);

constexpr __m256 v_mm256_setzero_ps = _mm256_setzero_ps();
static_assert(v_mm256_setzero_ps[0] == +0.0f && v_mm256_setzero_ps[1] == +0.0f && v_mm256_setzero_ps[2] == +0.0f && v_mm256_setzero_ps[3] == +0.0f && v_mm256_setzero_ps[4] == +0.0f && v_mm256_setzero_ps[5] == +0.0f && v_mm256_setzero_ps[6] == +0.0f && v_mm256_setzero_ps[7] == +0.0f);

constexpr __m256i v_mm256_setzero_si256 = _mm256_setzero_si256();
static_assert(v_mm256_setzero_si256[0] == 0x0000000000000000ULL && v_mm256_setzero_si256[1] == 0x0000000000000000ULL && v_mm256_setzero_si256[2] == 0x0000000000000000ULL && v_mm256_setzero_si256[3] == 0x0000000000000000ULL);
}

#endif
2,954 changes: 1,489 additions & 1,465 deletions clang/test/CodeGen/X86/avx512f-builtins.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions clang/test/CodeGen/X86/mmx-builtins.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=i386-apple-darwin -target-feature +ssse3 -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --implicit-check-not=x86mmx


#include <immintrin.h>
Expand Down
13 changes: 13 additions & 0 deletions clang/test/CodeGen/X86/sse2-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1778,3 +1778,16 @@ __m128i test_mm_xor_si128(__m128i A, __m128i B) {
// CHECK: xor <2 x i64> %{{.*}}, %{{.*}}
return _mm_xor_si128(A, B);
}

// Test constexpr handling.
#if defined(__cplusplus) && (__cplusplus >= 201103L)

void test_constexpr() {
constexpr __m128d v_mm_setzero_pd = _mm_setzero_pd();
static_assert(v_mm_setzero_pd[0] == +0.0 && v_mm_setzero_pd[1] == +0.0);

constexpr __m128i v_mm_setzero_si128 = _mm_setzero_si128();
static_assert(v_mm_setzero_si128[0] == 0x0000000000000000ULL && v_mm_setzero_si128[1] == 0x0000000000000000ULL);
}

#endif
19 changes: 19 additions & 0 deletions clang/test/CodeGen/X86/sse3-builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,22 @@ __m128 test_mm_moveldup_ps(__m128 A) {
// CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
return _mm_moveldup_ps(A);
}

// Test constexpr handling.
#if defined(__cplusplus) && (__cplusplus >= 201103L)

void test_constexpr() {
constexpr __m128d kd1 {+7.0,-7.0};
constexpr __m128 kf1 {+1.0f,-1.0f,+2.0f,+4.0f};

constexpr __m128d v_mm_movedup_pd = _mm_movedup_pd(kd1);
static_assert(v_mm_movedup_pd[0] == +7.0 && v_mm_movedup_pd[1] == +7.0);

constexpr __m128 v_mm_movehdup_ps = _mm_movehdup_ps(kf1);
static_assert(v_mm_movehdup_ps[0] == -1.0f && v_mm_movehdup_ps[1] == -1.0f && v_mm_movehdup_ps[2] == +4.0f && v_mm_movehdup_ps[3] == +4.0f);

constexpr __m128 v_mm_moveldup_ps = _mm_moveldup_ps(kf1);
static_assert(v_mm_moveldup_ps[0] == +1.0f && v_mm_moveldup_ps[1] == +1.0f && v_mm_moveldup_ps[2] == +2.0f && v_mm_moveldup_ps[3] == +2.0f);
}

#endif
14 changes: 1 addition & 13 deletions clang/test/CodeGen/aarch64-mixed-target-attributes.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals --include-generated-funcs
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals --include-generated-funcs --global-value-regex ".*"
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -v9.5a -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fmv -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NOFMV

Expand Down Expand Up @@ -255,18 +255,6 @@ __attribute__((target_version("jscvt"))) int default_def_with_version_decls(void
// CHECK-NOFMV-NEXT: ret i32 0
//
//.
// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.5a" }
// CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon,-v9.5a" }
// CHECK: attributes #[[ATTR2]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon,-v9.5a" }
// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,-v9.5a" }
// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm,-v9.5a" }
// CHECK: attributes #[[ATTR5:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon,-v9.5a" }
// CHECK: attributes #[[ATTR6:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.5a" }
// CHECK: attributes #[[ATTR7:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse,-v9.5a" }
// CHECK: attributes #[[ATTR8:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon,-v9.5a" }
//.
// CHECK-NOFMV: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

// REQUIRES: aarch64-registered-target

// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s

#include <arm_sme.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

// REQUIRES: aarch64-registered-target

// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s

#include <arm_sme.h>

Expand Down
252 changes: 141 additions & 111 deletions clang/test/CodeGen/attr-target-clones-aarch64.c

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions clang/test/CodeGen/attr-target-version-riscv-invalid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: not %clang_cc1 -triple riscv64 -target-feature +i -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=CHECK-UNSUPPORT-OS

// CHECK-UNSUPPORT-OS: error: function multiversioning is currently only supported on Linux
__attribute__((target_version("default"))) int foo(void) {
return 2;
}

__attribute__((target_version("arch=+c"))) int foo(void) {
return 2;
}


int bar() { return foo(); }
443 changes: 443 additions & 0 deletions clang/test/CodeGen/attr-target-version-riscv.c

Large diffs are not rendered by default.

45 changes: 1 addition & 44 deletions clang/test/CodeGen/attr-target-version.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals --include-generated-funcs
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals --include-generated-funcs --global-value-regex ".*"
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature -fmv -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NOFMV

Expand Down Expand Up @@ -1112,49 +1112,6 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de
// CHECK-NOFMV-NEXT: ret i32 1
//
//.
// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+flagm,+fp-armv8,+fp16fml,+fullfp16,+neon,+rand" }
// CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+altnzcv,+bf16,+flagm,+sme,+sme-i16i64" }
// CHECK: attributes #[[ATTR2]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+lse,+neon,+sha2" }
// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+ls64,+neon" }
// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fp16fml,+fullfp16,+neon" }
// CHECK: attributes #[[ATTR5]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
// CHECK: attributes #[[ATTR6]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+ls64" }
// CHECK: attributes #[[ATTR7]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bti" }
// CHECK: attributes #[[ATTR8]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme2" }
// CHECK: attributes #[[ATTR9]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+ls64,+neon" }
// CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ccpp" }
// CHECK: attributes #[[ATTR12]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
// CHECK: attributes #[[ATTR13]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ssbs" }
// CHECK: attributes #[[ATTR14:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
// CHECK: attributes #[[ATTR16]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
// CHECK: attributes #[[ATTR17]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR18]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
// CHECK: attributes #[[ATTR19]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
// CHECK: attributes #[[ATTR20:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon" }
// CHECK: attributes #[[ATTR21]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+jsconv,+neon" }
// CHECK: attributes #[[ATTR22:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ls64" }
// CHECK: attributes #[[ATTR23]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+sb" }
// CHECK: attributes #[[ATTR24]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+aes,+f64mm,+fp-armv8,+fullfp16,+neon,+sha2,+sve" }
// CHECK: attributes #[[ATTR25]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+complxnum,+fp-armv8,+fullfp16,+neon,+rdm,+sme" }
// CHECK: attributes #[[ATTR26]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+f32mm,+fp-armv8,+fullfp16,+i8mm,+neon,+sha2,+sha3,+sve" }
// CHECK: attributes #[[ATTR27]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+dit,+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR28]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ccpp,+rcpc" }
// CHECK: attributes #[[ATTR29]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ccdp,+ccpp,+fp-armv8,+jsconv,+neon" }
// CHECK: attributes #[[ATTR30]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint,+rcpc" }
// CHECK: attributes #[[ATTR31]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR32]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve,+sve2,+sve2-aes,+sve2-sha3" }
// CHECK: attributes #[[ATTR33]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve,+sve2,+sve2-aes,+sve2-bitperm" }
// CHECK: attributes #[[ATTR34]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+mte,+neon,+sve,+sve2,+sve2-sm4" }
// CHECK: attributes #[[ATTR35]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops,+mte,+rcpc,+rcpc3" }
// CHECK: attributes #[[ATTR36]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+sm4" }
// CHECK: attributes #[[ATTR37]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+lse,+neon,+rdm" }
// CHECK: attributes #[[ATTR38:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
//.
// CHECK-NOFMV: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" }
// CHECK-NOFMV: attributes #[[ATTR1:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-fmv" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
Expand Down
7 changes: 1 addition & 6 deletions clang/test/CodeGenCXX/attr-target-clones-aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --global-value-regex ".*" --version 5
// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s

int __attribute__((target_clones("ls64+fp16", "default"))) foo_ovl(int) { return 1; }
Expand Down Expand Up @@ -240,11 +240,6 @@ void run_foo_tml() {
// CHECK-NEXT: ret ptr @_ZN7MyClassIisE7foo_tmlEv.default
//
//.
// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+ls64,+neon" }
// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #[[ATTR2]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fptoint" }
// CHECK: attributes #[[ATTR3]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64,+ssbs" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
432 changes: 432 additions & 0 deletions clang/test/CodeGenCXX/attr-target-version-riscv.cpp

Large diffs are not rendered by default.

15 changes: 1 addition & 14 deletions clang/test/CodeGenCXX/attr-target-version.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --global-value-regex ".*" --version 5
// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s

int __attribute__((target_version("sme-f64f64+bf16"))) foo(int) { return 1; }
Expand Down Expand Up @@ -323,19 +323,6 @@ int bar() {
// CHECK-NEXT: ret ptr @_ZN7MyClass40unused_with_implicit_forward_default_defEv.default
//
//.
// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+sme,+sme-f64f64" }
// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #[[ATTR2]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+fp-armv8,+neon,+sm4" }
// CHECK: attributes #[[ATTR3]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc" }
// CHECK: attributes #[[ATTR4]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+dotprod,+fp-armv8,+neon" }
// CHECK: attributes #[[ATTR5]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
// CHECK: attributes #[[ATTR6]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon" }
// CHECK: attributes #[[ATTR7]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR8]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon" }
// CHECK: attributes #[[ATTR9]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+lse" }
// CHECK: attributes #[[ATTR10]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+neon,+rdm" }
// CHECK: attributes #[[ATTR11:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
7 changes: 1 addition & 6 deletions clang/test/CodeGenCXX/fmv-namespace.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --global-value-regex ".*" --version 5
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s

namespace Name {
Expand Down Expand Up @@ -100,11 +100,6 @@ __attribute((target_version("mops"))) int bar() { return 1; }
// CHECK-NEXT: ret ptr @_ZN3Foo3barEv.default
//
//.
// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
// CHECK: attributes #[[ATTR2:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" }
// CHECK: attributes #[[ATTR3]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+mops" }
//.
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
//.
4 changes: 1 addition & 3 deletions clang/test/Modules/cxx-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ namespace hidden_specializations {
cls<char*> uk4; // expected-error 1+{{partial specialization of 'cls<T *>' must be imported}} expected-error 1+{{definition of}}
cls<void>::nested_cls unk1; // expected-error 1+{{explicit specialization of 'nested_cls' must be imported}} expected-error 1+{{definition of}}
cls<void>::nested_cls_t<int> unk2; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}} expected-error 1+{{definition of}}
// expected-error@cxx-templates-unimported.h:29 {{explicit specialization of 'nested_cls_t' must be imported}}
// expected-note@-2 {{in evaluation of exception specification}}
cls<void>::nested_cls_t<char> unk3; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}}
cls<void>::nested_cls_t<char> unk3; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}} expected-error 1+{{definition of}}

// For enums, uses that would trigger instantiations of definitions are not
// allowed.
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Modules/embed-files-compressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// RUN: %clang_cc1 -fmodules -I%t -fmodules-cache-path=%t -fmodule-name=a -emit-module %t/modulemap -fmodules-embed-all-files -o %t/a.pcm
//
// The above embeds ~4.5MB of highly-predictable /s and \ns into the pcm file.
// Check that the resulting file is under 60KB:
// Check that the resulting file is under 80KB:
//
// RUN: wc -c %t/a.pcm | FileCheck --check-prefix=CHECK-SIZE %s
// CHECK-SIZE: {{(^|[^0-9])[1-5][0-9][0-9][0-9][0-9]($|[^0-9])}}
// CHECK-SIZE: {{(^|[^0-9])[1-7][0-9][0-9][0-9][0-9]($|[^0-9])}}
44 changes: 44 additions & 0 deletions clang/test/Modules/gh110401.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux -emit-module-interface %t/a.cppm -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux -emit-module-interface -fprebuilt-module-path=%t %t/b.cppm -o %t/B.pcm

// Just check that this doesn't crash.

//--- a.cppm
module;

template <typename _Visitor>
void __do_visit(_Visitor &&__visitor) {
using _V0 = int;
[](_V0 __v) -> _V0 { return __v; } (1);
}

export module A;

void g() {
struct Visitor { };
__do_visit(Visitor());
}

//--- b.cppm
module;

template <typename _Visitor>
void __do_visit(_Visitor &&__visitor) {
using _V0 = int;

// Check that we instantiate this lambda's call operator in 'f' below
// instead of the one in 'a.cppm' here; otherwise, we won't find a
// corresponding instantiation of the using declaration above.
[](_V0 __v) -> _V0 { return __v; } (1);
}

export module B;
import A;

void f() {
__do_visit(1);
}
16 changes: 8 additions & 8 deletions clang/test/Sema/aarch64-sme2-intrinsics/acle_sme2_add_sub_za16.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

void test_features(uint32_t slice, svfloat16x2_t zn2, svfloat16x4_t zn4,
svbfloat16x2_t bzn2, svbfloat16x4_t bzn4) __arm_streaming __arm_inout("za") {
// expected-error@+1 {{'svadd_za16_f16_vg1x2' needs target feature sme-f16f16|sme-f8f16}}
// expected-error@+1 {{'svadd_za16_f16_vg1x2' needs target feature sme,(sme-f16f16|sme-f8f16)}}
svadd_za16_f16_vg1x2(slice, zn2);
// expected-error@+1 {{'svadd_za16_f16_vg1x4' needs target feature sme-f16f16|sme-f8f16}}
// expected-error@+1 {{'svadd_za16_f16_vg1x4' needs target feature sme,(sme-f16f16|sme-f8f16)}}
svadd_za16_f16_vg1x4(slice, zn4);
// expected-error@+1 {{'svsub_za16_f16_vg1x2' needs target feature sme-f16f16|sme-f8f16}}
// expected-error@+1 {{'svsub_za16_f16_vg1x2' needs target feature sme,(sme-f16f16|sme-f8f16)}}
svsub_za16_f16_vg1x2(slice, zn2);
// expected-error@+1 {{'svsub_za16_f16_vg1x4' needs target feature sme-f16f16|sme-f8f16}}
// expected-error@+1 {{'svsub_za16_f16_vg1x4' needs target feature sme,(sme-f16f16|sme-f8f16)}}
svsub_za16_f16_vg1x4(slice, zn4);

// expected-error@+1 {{'svadd_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svadd_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svadd_za16_bf16_vg1x2(slice, bzn2);
// expected-error@+1 {{'svadd_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svadd_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svadd_za16_bf16_vg1x4(slice, bzn4);
// expected-error@+1 {{'svsub_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svsub_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svsub_za16_bf16_vg1x2(slice, bzn2);
// expected-error@+1 {{'svsub_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svsub_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svsub_za16_bf16_vg1x4(slice, bzn4);
}

Expand Down
38 changes: 19 additions & 19 deletions clang/test/Sema/aarch64-sme2-intrinsics/acle_sme2_b16b16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,45 @@

void test_b16b16( svbfloat16_t bf16, svbfloat16x2_t bf16x2, svbfloat16x4_t bf16x4) __arm_streaming
{
// expected-error@+1 {{'svclamp_single_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svclamp_single_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svclamp_single_bf16_x2(bf16x2, bf16, bf16);
// expected-error@+1 {{'svclamp_single_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svclamp_single_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svclamp_single_bf16_x4(bf16x4, bf16, bf16);

// expected-error@+1 {{'svmax_single_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmax_single_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmax_single_bf16_x2(bf16x2, bf16);
// expected-error@+1 {{'svmax_single_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmax_single_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmax_single_bf16_x4(bf16x4, bf16);
// expected-error@+1 {{'svmax_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmax_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmax_bf16_x2(bf16x2, bf16x2);
// expected-error@+1 {{'svmax_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmax_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmax_bf16_x4(bf16x4, bf16x4);

// expected-error@+1 {{'svmaxnm_single_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmaxnm_single_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmaxnm_single_bf16_x2(bf16x2, bf16);
// expected-error@+1 {{'svmaxnm_single_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmaxnm_single_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmaxnm_single_bf16_x4(bf16x4, bf16);
// expected-error@+1 {{'svmaxnm_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmaxnm_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmaxnm_bf16_x2(bf16x2, bf16x2);
// expected-error@+1 {{'svmaxnm_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmaxnm_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmaxnm_bf16_x4(bf16x4, bf16x4);

// expected-error@+1 {{'svmin_single_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmin_single_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmin_single_bf16_x2(bf16x2, bf16);
// expected-error@+1 {{'svmin_single_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmin_single_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmin_single_bf16_x4(bf16x4, bf16);
// expected-error@+1 {{'svmin_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmin_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svmin_bf16_x2(bf16x2, bf16x2);
// expected-error@+1 {{'svmin_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svmin_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svmin_bf16_x4(bf16x4, bf16x4);

// expected-error@+1 {{'svminnm_single_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svminnm_single_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svminnm_single_bf16_x2(bf16x2, bf16);
// expected-error@+1 {{'svminnm_single_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svminnm_single_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svminnm_single_bf16_x4(bf16x4, bf16);

// expected-error@+1 {{'svminnm_bf16_x2' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svminnm_bf16_x2' needs target feature sme,sme2,sve-b16b16}}
svminnm_bf16_x2(bf16x2, bf16x2);
// expected-error@+1 {{'svminnm_bf16_x4' needs target feature sme2,sve-b16b16}}
// expected-error@+1 {{'svminnm_bf16_x4' needs target feature sme,sme2,sve-b16b16}}
svminnm_bf16_x4(bf16x4, bf16x4);
}
}
48 changes: 24 additions & 24 deletions clang/test/Sema/aarch64-sme2-intrinsics/acle_sme2_fmlas16.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,54 @@ void test_features_f16f16(uint32_t slice,
svbfloat16x4_t bzn4, svbfloat16x4_t bzm4)

__arm_streaming __arm_inout("za") {
// expected-error@+1 {{'svmla_single_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_single_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmla_single_za16_f16_vg1x2(slice, zn2, zm);
// expected-error@+1 {{'svmla_single_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_single_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmla_single_za16_f16_vg1x4(slice, zn4, zm);
// expected-error@+1 {{'svmls_single_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_single_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmls_single_za16_f16_vg1x2(slice, zn2, zm);
// expected-error@+1 {{'svmls_single_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_single_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmls_single_za16_f16_vg1x4(slice, zn4, zm);
// expected-error@+1 {{'svmla_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmla_za16_f16_vg1x2(slice, zn2, zm2);
// expected-error@+1 {{'svmla_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmla_za16_f16_vg1x4(slice, zn4, zm4);
// expected-error@+1 {{'svmls_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmls_za16_f16_vg1x2(slice, zn2, zm2);
// expected-error@+1 {{'svmls_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmls_za16_f16_vg1x4(slice, zn4, zm4);
// expected-error@+1 {{'svmla_lane_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_lane_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmla_lane_za16_f16_vg1x2(slice, zn2, zm, 7);
// expected-error@+1 {{'svmla_lane_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmla_lane_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmla_lane_za16_f16_vg1x4(slice, zn4, zm, 7);
// expected-error@+1 {{'svmls_lane_za16_f16_vg1x2' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_lane_za16_f16_vg1x2' needs target feature sme,sme-f16f16}}
svmls_lane_za16_f16_vg1x2(slice, zn2, zm, 7);
// expected-error@+1 {{'svmls_lane_za16_f16_vg1x4' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmls_lane_za16_f16_vg1x4' needs target feature sme,sme-f16f16}}
svmls_lane_za16_f16_vg1x4(slice, zn4, zm, 7);

// expected-error@+1 {{'svmla_single_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_single_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmla_single_za16_bf16_vg1x2(slice, bzn2, bzm);
// expected-error@+1 {{'svmla_single_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_single_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmla_single_za16_bf16_vg1x4(slice, bzn4, bzm);
// expected-error@+1 {{'svmls_single_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_single_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmls_single_za16_bf16_vg1x2(slice, bzn2, bzm);
// expected-error@+1 {{'svmls_single_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_single_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmls_single_za16_bf16_vg1x4(slice, bzn4, bzm);
// expected-error@+1 {{'svmla_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmla_za16_bf16_vg1x2(slice, bzn2, bzm2);
// expected-error@+1 {{'svmla_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmla_za16_bf16_vg1x4(slice, bzn4, bzm4);
// expected-error@+1 {{'svmls_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmls_za16_bf16_vg1x2(slice, bzn2, bzm2);
// expected-error@+1 {{'svmls_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmls_za16_bf16_vg1x4(slice, bzn4, bzm4);
// expected-error@+1 {{'svmla_lane_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_lane_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmla_lane_za16_bf16_vg1x2(slice, bzn2, bzm, 7);
// expected-error@+1 {{'svmla_lane_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmla_lane_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmla_lane_za16_bf16_vg1x4(slice, bzn4, bzm, 7);
// expected-error@+1 {{'svmls_lane_za16_bf16_vg1x2' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_lane_za16_bf16_vg1x2' needs target feature sme,sme-b16b16}}
svmls_lane_za16_bf16_vg1x2(slice, bzn2, bzm, 7);
// expected-error@+1 {{'svmls_lane_za16_bf16_vg1x4' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmls_lane_za16_bf16_vg1x4' needs target feature sme,sme-b16b16}}
svmls_lane_za16_bf16_vg1x4(slice, bzn4, bzm, 7);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ void test_features(svbool_t pn, svbool_t pm,
svfloat16_t zn, svfloat16_t zm,
svbfloat16_t znb, svbfloat16_t zmb)
__arm_streaming __arm_inout("za") {
// expected-error@+1 {{'svmopa_za16_bf16_m' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmopa_za16_bf16_m' needs target feature sme,sme-b16b16}}
svmopa_za16_bf16_m(0, pn, pm, znb, zmb);
// expected-error@+1 {{'svmops_za16_bf16_m' needs target feature sme-b16b16}}
// expected-error@+1 {{'svmops_za16_bf16_m' needs target feature sme,sme-b16b16}}
svmops_za16_bf16_m(0, pn, pm, znb, zmb);
// expected-error@+1 {{'svmopa_za16_f16_m' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmopa_za16_f16_m' needs target feature sme,sme-f16f16}}
svmopa_za16_f16_m(0, pn, pm, zn, zm);
// expected-error@+1 {{'svmops_za16_f16_m' needs target feature sme-f16f16}}
// expected-error@+1 {{'svmops_za16_f16_m' needs target feature sme,sme-f16f16}}
svmops_za16_f16_m(0, pn, pm, zn, zm);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ svfloat32_t good6(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming_c
return svclamp(a, b, c);
}

// Test that the +sve-b16b16 is not considered an SVE flag (it applies to both)
__attribute__((target("+sme2,+sve2,+sve-b16b16")))
svbfloat16_t good7(svbfloat16_t a, svbfloat16_t b, svbfloat16_t c) __arm_streaming {
return svclamp_bf16(a, b, c);
}

// Without '+sme2', the builtin is only valid in non-streaming mode.
__attribute__((target("+sve2p1,+sme")))
svfloat32_t bad1(svfloat32_t a, svfloat32_t b, svfloat32_t c) __arm_streaming {
Expand Down
6,580 changes: 3,290 additions & 3,290 deletions clang/test/Sema/aarch64-sve2-intrinsics/acle_sve2.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,116 +14,116 @@

void test(uint8_t u8, uint16_t u16, uint32_t u32, uint64_t u64)
{
// expected-error@+2 {{'svaesd_u8' needs target feature sve2-aes}}
// overload-error@+1 {{'svaesd' needs target feature sve2-aes}}
// expected-error@+2 {{'svaesd_u8' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svaesd' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svaesd,_u8,,)(svundef_u8(), svundef_u8());
// expected-error@+2 {{'svaese_u8' needs target feature sve2-aes}}
// overload-error@+1 {{'svaese' needs target feature sve2-aes}}
// expected-error@+2 {{'svaese_u8' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svaese' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svaese,_u8,,)(svundef_u8(), svundef_u8());
// expected-error@+2 {{'svaesimc_u8' needs target feature sve2-aes}}
// overload-error@+1 {{'svaesimc' needs target feature sve2-aes}}
// expected-error@+2 {{'svaesimc_u8' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svaesimc' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svaesimc,_u8,,)(svundef_u8());
// expected-error@+2 {{'svaesmc_u8' needs target feature sve2-aes}}
// overload-error@+1 {{'svaesmc' needs target feature sve2-aes}}
// expected-error@+2 {{'svaesmc_u8' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svaesmc' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svaesmc,_u8,,)(svundef_u8());
// expected-error@+2 {{'svbdep_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_u8,,)(svundef_u8(), svundef_u8());
// expected-error@+2 {{'svbdep_n_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_n_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_n_u8,,)(svundef_u8(), u8);
// expected-error@+2 {{'svbext_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_u8,,)(svundef_u8(), svundef_u8());
// expected-error@+2 {{'svbext_n_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_n_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_n_u8,,)(svundef_u8(), u8);
// expected-error@+2 {{'svbgrp_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_u8,,)(svundef_u8(), svundef_u8());
// expected-error@+2 {{'svbgrp_n_u8' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_n_u8' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_n_u8,,)(svundef_u8(), u8);

// expected-error@+2 {{'svbdep_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_u16,,)(svundef_u16(), svundef_u16());
// expected-error@+2 {{'svbdep_n_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_n_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_n_u16,,)(svundef_u16(), u16);
// expected-error@+2 {{'svbext_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_u16,,)(svundef_u16(), svundef_u16());
// expected-error@+2 {{'svbext_n_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_n_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_n_u16,,)(svundef_u16(), u16);
// expected-error@+2 {{'svbgrp_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_u16,,)(svundef_u16(), svundef_u16());
// expected-error@+2 {{'svbgrp_n_u16' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_n_u16' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_n_u16,,)(svundef_u16(), u16);

// expected-error@+2 {{'svbdep_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_u32,,)(svundef_u32(), svundef_u32());
// expected-error@+2 {{'svbdep_n_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_n_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_n_u32,,)(svundef_u32(), u32);
// expected-error@+2 {{'svbext_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_u32,,)(svundef_u32(), svundef_u32());
// expected-error@+2 {{'svbext_n_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_n_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_n_u32,,)(svundef_u32(), u32);
// expected-error@+2 {{'svbgrp_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_u32,,)(svundef_u32(), svundef_u32());
// expected-error@+2 {{'svbgrp_n_u32' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_n_u32' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_n_u32,,)(svundef_u32(), u32);
// expected-error@+2 {{'svsm4e_u32' needs target feature sve2-sm4}}
// overload-error@+1 {{'svsm4e' needs target feature sve2-sm4}}
// expected-error@+2 {{'svsm4e_u32' needs target feature sve,sve2-sm4}}
// overload-error@+1 {{'svsm4e' needs target feature sve,sve2-sm4}}
SVE_ACLE_FUNC(svsm4e,_u32,,)(svundef_u32(), svundef_u32());
// expected-error@+2 {{'svsm4ekey_u32' needs target feature sve2-sm4}}
// overload-error@+1 {{'svsm4ekey' needs target feature sve2-sm4}}
// expected-error@+2 {{'svsm4ekey_u32' needs target feature sve,sve2-sm4}}
// overload-error@+1 {{'svsm4ekey' needs target feature sve,sve2-sm4}}
SVE_ACLE_FUNC(svsm4ekey,_u32,,)(svundef_u32(), svundef_u32());

// expected-error@+2 {{'svbdep_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_u64,,)(svundef_u64(), svundef_u64());
// expected-error@+2 {{'svbdep_n_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbdep_n_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbdep' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbdep,_n_u64,,)(svundef_u64(), u64);
// expected-error@+2 {{'svbext_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_u64,,)(svundef_u64(), svundef_u64());
// expected-error@+2 {{'svbext_n_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbext_n_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbext' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbext,_n_u64,,)(svundef_u64(), u64);
// expected-error@+2 {{'svbgrp_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_u64,,)(svundef_u64(), svundef_u64());
// expected-error@+2 {{'svbgrp_n_u64' needs target feature sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve2-bitperm}}
// expected-error@+2 {{'svbgrp_n_u64' needs target feature sve,sve2-bitperm}}
// overload-error@+1 {{'svbgrp' needs target feature sve,sve2-bitperm}}
SVE_ACLE_FUNC(svbgrp,_n_u64,,)(svundef_u64(), u64);
// expected-error@+2 {{'svpmullb_pair_u64' needs target feature sve2-aes}}
// overload-error@+1 {{'svpmullb_pair' needs target feature sve2-aes}}
// expected-error@+2 {{'svpmullb_pair_u64' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svpmullb_pair' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svpmullb_pair,_u64,,)(svundef_u64(), svundef_u64());
// expected-error@+2 {{'svpmullb_pair_n_u64' needs target feature sve2-aes}}
// overload-error@+1 {{'svpmullb_pair' needs target feature sve2-aes}}
// expected-error@+2 {{'svpmullb_pair_n_u64' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svpmullb_pair' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svpmullb_pair,_n_u64,,)(svundef_u64(), u64);
// expected-error@+2 {{'svpmullt_pair_u64' needs target feature sve2-aes}}
// overload-error@+1 {{'svpmullt_pair' needs target feature sve2-aes}}
// expected-error@+2 {{'svpmullt_pair_u64' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svpmullt_pair' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svpmullt_pair,_u64,,)(svundef_u64(), svundef_u64());
// expected-error@+2 {{'svpmullt_pair_n_u64' needs target feature sve2-aes}}
// overload-error@+1 {{'svpmullt_pair' needs target feature sve2-aes}}
// expected-error@+2 {{'svpmullt_pair_n_u64' needs target feature sve,sve2-aes}}
// overload-error@+1 {{'svpmullt_pair' needs target feature sve,sve2-aes}}
SVE_ACLE_FUNC(svpmullt_pair,_n_u64,,)(svundef_u64(), u64);
// expected-error@+2 {{'svrax1_u64' needs target feature sve2-sha3}}
// overload-error@+1 {{'svrax1' needs target feature sve2-sha3}}
// expected-error@+2 {{'svrax1_u64' needs target feature sve,sve2-sha3}}
// overload-error@+1 {{'svrax1' needs target feature sve,sve2-sha3}}
SVE_ACLE_FUNC(svrax1,_u64,,)(svundef_u64(), svundef_u64());

// expected-error@+2 {{'svrax1_s64' needs target feature sve2-sha3}}
// overload-error@+1 {{'svrax1' needs target feature sve2-sha3}}
// expected-error@+2 {{'svrax1_s64' needs target feature sve,sve2-sha3}}
// overload-error@+1 {{'svrax1' needs target feature sve,sve2-sha3}}
SVE_ACLE_FUNC(svrax1,_s64,,)(svundef_s64(), svundef_s64());
}
16 changes: 8 additions & 8 deletions clang/test/Sema/aarch64-sve2-intrinsics/acle_sve2_bfloat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

void test_bfloat(const bfloat16_t *const_bf16_ptr, svbfloat16_t bf16, svbfloat16x2_t bf16x2)
{
// expected-error@+2 {{'svwhilerw_bf16' needs target feature (sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svwhilerw' needs target feature (sve2,bf16)|(sme,bf16)}}
// expected-error@+2 {{'svwhilerw_bf16' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svwhilerw' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
SVE_ACLE_FUNC(svwhilerw,_bf16,,)(const_bf16_ptr, const_bf16_ptr);
// expected-error@+2 {{'svtbx_bf16' needs target feature (sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svtbx' needs target feature (sve2,bf16)|(sme,bf16)}}
// expected-error@+2 {{'svtbx_bf16' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svtbx' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
SVE_ACLE_FUNC(svtbx,_bf16,,)(bf16, bf16, svundef_u16());
// expected-error@+2 {{'svtbl2_bf16' needs target feature (sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svtbl2' needs target feature (sve2,bf16)|(sme,bf16)}}
// expected-error@+2 {{'svtbl2_bf16' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svtbl2' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
SVE_ACLE_FUNC(svtbl2,_bf16,,)(bf16x2, svundef_u16());
// expected-error@+2 {{'svwhilewr_bf16' needs target feature (sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svwhilewr' needs target feature (sve2,bf16)|(sme,bf16)}}
// expected-error@+2 {{'svwhilewr_bf16' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
// overload-error@+1 {{'svwhilewr' needs target feature (sve,sve2,bf16)|(sme,bf16)}}
SVE_ACLE_FUNC(svwhilewr,_bf16,,)(const_bf16_ptr, const_bf16_ptr);
}
24 changes: 12 additions & 12 deletions clang/test/Sema/aarch64-sve2p1-intrinsics/acle_sve2p1_b16b16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ void test_with_sve_b16b16(svbool_t pg, svbfloat16_t op1, svbfloat16_t op2, svbfl

void test_no_sve_b16b16(svbool_t pg, svbfloat16_t op1, svbfloat16_t op2, svbfloat16_t op3) MODE_ATTR
{
// expected-error@+1 {{'svclamp_bf16' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svclamp_bf16' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svclamp_bf16(op1, op2, op3);
// expected-error@+1 {{'svadd_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svadd_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svadd_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svmax_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmax_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmax_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svmaxnm_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmaxnm_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmaxnm_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svmin_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmin_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmin_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svminnm_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svminnm_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svminnm_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svmla_lane_bf16' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmla_lane_bf16' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmla_lane_bf16(op1, op2, op3, 1);
// expected-error@+1 {{'svmla_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmla_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmla_bf16_m(pg, op1, op2, op3);
// expected-error@+1 {{'svmls_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmls_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmls_bf16_m(pg, op1, op2, op3);
// expected-error@+1 {{'svmul_lane_bf16' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmul_lane_bf16' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmul_lane_bf16(op1, op2, 1);
// expected-error@+1 {{'svmul_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svmul_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svmul_bf16_m(pg, op1, op2);
// expected-error@+1 {{'svsub_bf16_m' needs target feature (sve2,sve-b16b16)|(sme2,sve-b16b16)}}
// expected-error@+1 {{'svsub_bf16_m' needs target feature (sve,sve2,sve-b16b16)|(sme,sme2,sve-b16b16)}}
svsub_bf16_m(pg, op1, op2);
}
11 changes: 11 additions & 0 deletions clang/test/Sema/attr-nonblocking-constraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ void nb10(
static_cast<void (*)()>(fp1)(); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' expression}}
}

// Expression involving indirection
int nb10a() [[clang::nonblocking]];
int nb10b() [[clang::nonblocking]];
int blocking();

int nb10c(bool x) [[clang::nonblocking]]
{
int y = (x ? nb10a : blocking)(); // expected-warning {{attribute 'nonblocking' should not be added via type conversion}}
return (x ? nb10a : nb10b)(); // No diagnostic.
}

// Interactions with nonblocking(false)
void nb11_no_inference_1() [[clang::nonblocking(false)]] // expected-note {{function does not permit inference of 'nonblocking'}}
{
Expand Down
20 changes: 20 additions & 0 deletions clang/test/Sema/caret-diags-register-variable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// RUN: not %clang_cc1 -triple i386-pc-linux-gnu -std=c++11 -fsyntax-only -fno-diagnostics-show-line-numbers -fcaret-diagnostics-max-lines=5 %s 2>&1 | FileCheck %s -strict-whitespace

struct foo {
int a;
};

//CHECK: {{.*}}: error: bad type for named register variable
//CHECK-NEXT: {{^}}register struct foo bar asm("esp");
//CHECK-NEXT: {{^}} ^~~~~~~~~~{{$}}
register struct foo bar asm("esp");

//CHECK: {{.*}}: error: register 'edi' unsuitable for global register variables on this target
//CHECK-NEXT: {{^}}register int r0 asm ("edi");
//CHECK-NEXT: {{^}} ^{{$}}
register int r0 asm ("edi");

//CHECK: {{.*}}: error: size of register 'esp' does not match variable size
//CHECK-NEXT: {{^}}register long long r1 asm ("esp");
//CHECK-NEXT: {{^}} ^{{$}}
register long long r1 asm ("esp");
113 changes: 113 additions & 0 deletions clang/test/SemaCXX/attr-target-version-riscv.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// RUN: %clang_cc1 -triple riscv64-linux-gnu -fsyntax-only -verify -fexceptions -fcxx-exceptions %s -std=c++14

// expected-warning@+2 {{unsupported 'arch=rv64gcv' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=rv64gcv"))) int fullArchString(void) { return 2; }
// expected-error@+2 {{redefinition of 'fullArchString'}}
// expected-warning@+1 {{unsupported 'arch=default' in the 'target_version' attribute string; 'target_version' attribute ignored}}
__attribute__((target_version("arch=default"))) int fullArchString(void) { return 2; }

// expected-warning@+2 {{unsupported 'mcpu=sifive-u74' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("mcpu=sifive-u74"))) int mcpu(void) { return 2; }
// expected-error@+1 {{redefinition of 'mcpu'}}
__attribute__((target_version("default"))) int mcpu(void) { return 2; }

// expected-warning@+2 {{unsupported 'mtune=sifive-u74' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("mtune=sifive-u74"))) int mtune(void) { return 2; }
// expected-error@+1 {{redefinition of 'mtune'}}
__attribute__((target_version("default"))) int mtune(void) { return 2; }

// expected-warning@+2 {{unsupported '' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version(""))) int emptyVersion(void) { return 2; }
// expected-error@+1 {{redefinition of 'emptyVersion'}}
__attribute__((target_version("default"))) int emptyVersion(void) { return 2; }

// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c"))) int dupVersion(void) { return 2; }
// expected-error@+1 {{redefinition of 'dupVersion'}}
__attribute__((target_version("arch=+c"))) int dupVersion(void) { return 2; }
__attribute__((target_version("default"))) int dupVersion(void) { return 2; }

// expected-warning@+2 {{unsupported 'arch=+zicsr' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+zicsr"))) int UnsupportBitMaskExt(void) { return 2; }
// expected-error@+1 {{redefinition of 'UnsupportBitMaskExt'}}
__attribute__((target_version("default"))) int UnsupportBitMaskExt(void) { return 2; }

// expected-warning@+2 {{unsupported 'NotADigit' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c;priority=NotADigit"))) int UnsupportPriority(void) { return 2; }
// expected-error@+1 {{redefinition of 'UnsupportPriority'}}
__attribute__((target_version("default"))) int UnsupportPriority(void) { return 2;}

// expected-warning@+1 {{unsupported 'default;priority=2' in the 'target_version' attribute string; 'target_version' attribute ignored}}
__attribute__((target_version("default;priority=2"))) int UnsupportDefaultPriority(void) { return 2; }

// expected-warning@+2 {{unsupported 'arch=+c,zbb' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c,zbb"))) int WithoutAddSign(void) { return 2;}
// expected-error@+1 {{redefinition of 'WithoutAddSign'}}
__attribute__((target_version("default"))) int WithoutAddSign(void) { return 2; }

// expected-warning@+2 {{unsupported 'arch=+c;default' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c;default"))) int DefaultInVersion(void) { return 2;}
// expected-error@+1 {{redefinition of 'DefaultInVersion'}}
__attribute__((target_version("default"))) int DefaultInVersion(void) { return 2; }

// expected-warning@+2 {{unsupported '' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c;"))) int EmptyVersionAfterSemiColon(void) { return 2;}
// expected-error@+1 {{redefinition of 'EmptyVersionAfterSemiColon'}}
__attribute__((target_version("default"))) int EmptyVersionAfterSemiColon(void) { return 2; }

// expected-warning@+2 {{unsupported 'arch=+c;arch=+f' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("arch=+c;arch=+f"))) int dupArch(void) { return 2; }
// expected-error@+1 {{redefinition of 'dupArch'}}
__attribute__((target_version("default"))) int dupArch(void) { return 2; }

// expected-warning@+2 {{unsupported 'default;default' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("default;default"))) int dupDefault(void) { return 2;}
// expected-error@+1 {{redefinition of 'dupDefault'}}
__attribute__((target_version("default"))) int dupDefault(void) { return 2; }

// expected-warning@+2 {{unsupported 'priority=1;priority=2' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("priority=1;priority=2"))) int dupPriority(void) { return 2; }
// expected-error@+1 {{redefinition of 'dupPriority'}}
__attribute__((target_version("default"))) int dupPriority(void) { return 2; }

// expected-warning@+2 {{unsupported '=1' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("=1"))) int invalidVerson1(void) { return 2; }
// expected-error@+1 {{redefinition of 'invalidVerson1'}}
__attribute__((target_version("default"))) int invalidVerson1(void) { return 2; }

// expected-warning@+2 {{unsupported '=+v' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("=+v"))) int invalidVerson2(void) { return 2; }
// expected-error@+1 {{redefinition of 'invalidVerson2'}}
__attribute__((target_version("default"))) int invalidVerson2(void) { return 2; }

// expected-warning@+2 {{unsupported 'v' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("v"))) int invalidVerson3(void) { return 2; }
// expected-error@+1 {{redefinition of 'invalidVerson3'}}
__attribute__((target_version("default"))) int invalidVerson3(void) { return 2; }

// expected-warning@+2 {{unsupported '' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version(";"))) int invalidVerson4(void) { return 2; }
// expected-error@+1 {{redefinition of 'invalidVerson4'}}
__attribute__((target_version("default"))) int invalidVerson4(void) { return 2; }

// expected-warning@+2 {{unsupported 'priority=1' in the 'target_version' attribute string; 'target_version' attribute ignored}}
// expected-note@+1 {{previous definition is here}}
__attribute__((target_version("priority=1"))) int prioriyWithoutArch(void) { return 2; }
// expected-error@+1 {{redefinition of 'prioriyWithoutArch'}}
__attribute__((target_version("default"))) int prioriyWithoutArch(void) { return 2; }
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/pragma-pack-packed-2.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple s390x-ibm-zos -fzos-extensions -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple s390x-ibm-zos -fzos-extensions -fxl-pragma-pack -fsyntax-only -verify %s
// RUN: %clang -target s390x-ibm-zos -S -emit-llvm -Xclang -verify -fno-xl-pragma-pack %s
// RUN: %clang -target s390x-ibm-zos -S -emit-llvm -Xclang -verify -fno-xl-pragma-pack -o %t.ll %s

#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
#pragma pack(twobyte)
Expand Down
47 changes: 46 additions & 1 deletion clang/test/SemaCXX/warn-assignment-condition.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -Wparentheses -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wparentheses -std=c++2a -verify %s

struct A {
int foo();
Expand Down Expand Up @@ -144,3 +144,48 @@ void test() {
f(S()); // expected-note {{in instantiation}}
}
}

namespace GH101863 {
void t1(auto... args) {
if (((args == 0) or ...)) { }
}

template <typename... Args>
void t2(Args... args) {
if (((args == 0) or ...)) { }
}

void t3(auto... args) {
if ((... && (args == 0))) { }
}

void t4(auto... a, auto... b) {
if (((a == 0) or ...) && ((b == 0) or ...)) { }
}

void t5(auto... args) {
if ((((args == 0) or ...))) { }
}

void t6(auto a, auto... b) {
static_assert(__is_same_as(decltype((a)), int&));
static_assert(__is_same_as(decltype(((b), ...)), int&));
};

void t7(auto... args) {
if ((((args == 0)) or ...)) { } // expected-warning {{equality comparison with extraneous parentheses}} \
// expected-note {{use '=' to turn this equality comparison into an assignment}} \
// expected-note {{remove extraneous parentheses around the comparison to silence this warning}}
}

void test() {
t1(0, 1);
t2<>();
t3(1, 2, 3);
t3(0, 1);
t4(0, 1);
t5(0, 1);
t6(0, 0);
t7(0); // expected-note {{in instantiation of function template specialization 'GH101863::t7<int>' requested here}}
}
}
34 changes: 31 additions & 3 deletions clang/test/SemaTemplate/ms-function-specialization-class-scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ namespace UsesThis {
auto h<int>() -> decltype(this); // expected-error {{'this' cannot be used in a static member function declaration}}
};

template struct A<int>; // expected-note 3{{in instantiation of}}
template struct A<int>; // expected-note {{in instantiation of}}
template<> template<> void A<int>::f<int>();
template<> template<> void A<int>::g<int>();
void test1() {
A<int>().f<int>(); // expected-note {{in instantiation of}}
A<int>().g<int>(); // expected-note {{in instantiation of}}
}

template <typename T>
struct Foo {
Expand Down Expand Up @@ -390,7 +396,12 @@ namespace UsesThis {
}
};

template struct D<int>; // expected-note 2{{in instantiation of}}
template struct D<int>;

void test2() {
D<int>().non_static_spec(0); // expected-note {{in instantiation of}}
D<int>().static_spec(0); // expected-note {{in instantiation of}}
}

template<typename T>
struct E : T {
Expand Down Expand Up @@ -574,6 +585,23 @@ namespace UsesThis {
}
};

template struct E<B>; // expected-note 2{{in instantiation of}}
template struct E<B>;

void test3() {
E<B>().non_static_spec(0); // expected-note {{in instantiation of}}
E<B>().static_spec(0); // expected-note {{in instantiation of}}
}
}

namespace GH111266 {
template<class T> struct S {
template<int> auto foo();
template<> auto foo<1>() {
return [](auto x) { return x; };
}
};
template struct S<void>;
void test() {
S<void>().foo<1>();
}
} // namespace GH111266
8 changes: 8 additions & 0 deletions clang/unittests/Format/ConfigParseTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@ TEST(ConfigParseTest, ParsesConfiguration) {
/*AcrossComments=*/false, /*AlignCompound=*/false, \
/*AlignFunctionDeclarations=*/true, \
/*AlignFunctionPointers=*/false, /*PadOperators=*/true})); \
CHECK_PARSE( \
#FIELD ": AcrossComments", FIELD, \
FormatStyle::AlignConsecutiveStyle( \
{/*Enabled=*/true, /*AcrossEmptyLines=*/false, \
/*AcrossComments=*/true, /*AlignCompound=*/false, \
/*AlignFunctionDeclarations=*/true, \
/*AlignFunctionPointers=*/false, /*PadOperators=*/true})); \
CHECK_PARSE( \
#FIELD ": AcrossEmptyLinesAndComments", FIELD, \
FormatStyle::AlignConsecutiveStyle( \
Expand All @@ -339,6 +346,7 @@ TEST(ConfigParseTest, ParsesConfiguration) {
CHECK_PARSE_NESTED_BOOL(FIELD, AcrossComments); \
CHECK_PARSE_NESTED_BOOL(FIELD, AlignCompound); \
CHECK_PARSE_NESTED_BOOL(FIELD, AlignFunctionDeclarations); \
CHECK_PARSE_NESTED_BOOL(FIELD, AlignFunctionPointers); \
CHECK_PARSE_NESTED_BOOL(FIELD, PadOperators); \
} while (false)

Expand Down
1 change: 1 addition & 0 deletions clang/unittests/Format/FormatTestProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ TEST_F(FormatTestProto, MessageFieldAttributes) {
" aaaaaaaaaaaaaaaa: true\n"
" }\n"
"];");
verifyFormat("repeated A a = 1 [(annotation).int32.repeated.test = true];");
}

TEST_F(FormatTestProto, DoesntWrapFileOptions) {
Expand Down
15 changes: 13 additions & 2 deletions clang/utils/TableGen/SveEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,20 @@ Intrinsic::Intrinsic(StringRef Name, StringRef Proto, uint64_t MergeTy,
SVEEmitter &Emitter, StringRef SVEGuard,
StringRef SMEGuard)
: Name(Name.str()), LLVMName(LLVMName), Proto(Proto.str()),
BaseTypeSpec(BT), Class(Class), SVEGuard(SVEGuard.str()),
SMEGuard(SMEGuard.str()), MergeSuffix(MergeSuffix.str()),
BaseTypeSpec(BT), Class(Class), MergeSuffix(MergeSuffix.str()),
BaseType(BT, 'd'), Flags(Flags), ImmChecks(Checks) {

auto FormatGuard = [](StringRef Guard, StringRef Base) -> std::string {
if (Guard.contains('|'))
return Base.str() + ",(" + Guard.str() + ")";
if (Guard.empty() || Guard == Base || Guard.starts_with(Base.str() + ","))
return Guard.str();
return Base.str() + "," + Guard.str();
};

this->SVEGuard = FormatGuard(SVEGuard, "sve");
this->SMEGuard = FormatGuard(SMEGuard, "sme");

// Types[0] is the return value.
for (unsigned I = 0; I < (getNumParams() + 1); ++I) {
char Mod;
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/include/sanitizer/ubsan_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef SANITIZER_UBSAN_INTERFACE_H
#define SANITIZER_UBSAN_INTERFACE_H

#include <sanitizer/common_interface_defs.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
5 changes: 4 additions & 1 deletion compiler-rt/lib/rtsan/rtsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ static auto OnViolationAction(DiagnosticsInfo info) {
handle.inc_use_count_unsafe();
}

if (flags().halt_on_error)
if (flags().halt_on_error) {
if (flags().print_stats_on_exit)
PrintStatisticsSummary();
Die();
}
};
}

Expand Down
3 changes: 1 addition & 2 deletions compiler-rt/lib/rtsan/rtsan_assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ template <typename OnViolationAction>
void ExpectNotRealtime(Context &context, OnViolationAction &&OnViolation) {
CHECK(__rtsan_is_initialized());
if (context.InRealtimeContext() && !context.IsBypassed()) {
context.BypassPush();
ScopedBypass sb{context};
OnViolation();
context.BypassPop();
}
}

Expand Down
17 changes: 17 additions & 0 deletions compiler-rt/lib/rtsan/rtsan_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,22 @@ class Context {
int bypass_depth_{0};
};

class ScopedBypass {
public:
[[nodiscard]] explicit ScopedBypass(Context &context) : context_(context) {
context_.BypassPush();
}

~ScopedBypass() { context_.BypassPop(); }

ScopedBypass(const ScopedBypass &) = delete;
ScopedBypass &operator=(const ScopedBypass &) = delete;
ScopedBypass(ScopedBypass &&) = delete;
ScopedBypass &operator=(ScopedBypass &&) = delete;

private:
Context &context_;
};

Context &GetContextForThisThread();
} // namespace __rtsan
4 changes: 2 additions & 2 deletions compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ TEST(TestRtsanInterceptors, SpinLockLockDiesWhenRealtime) {

TEST(TestRtsanInterceptors, PthreadCondSignalDiesWhenRealtime) {
pthread_cond_t cond{};
pthread_cond_init(&cond, NULL);
ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));

auto Func = [&cond]() { pthread_cond_signal(&cond); };
ExpectRealtimeDeath(Func, "pthread_cond_signal");
Expand All @@ -550,7 +550,7 @@ TEST(TestRtsanInterceptors, PthreadCondSignalDiesWhenRealtime) {

TEST(TestRtsanInterceptors, PthreadCondBroadcastDiesWhenRealtime) {
pthread_cond_t cond{};
pthread_cond_init(&cond, NULL);
ASSERT_EQ(0, pthread_cond_init(&cond, nullptr));

auto Func = [&cond]() { pthread_cond_broadcast(&cond); };
ExpectRealtimeDeath(Func, "pthread_cond_broadcast");
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/scudo/standalone/combined.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@ class Allocator {
// A corrupted chunk will not be reported as owned, which is WAI.
bool isOwned(const void *Ptr) {
initThreadMaybe();
// If the allocation is not owned, the tags could be wrong.
ScopedDisableMemoryTagChecks x(
useMemoryTagging<AllocatorConfig>(Primary.Options.load()));
#ifdef GWP_ASAN_HOOKS
if (GuardedAlloc.pointerIsMine(Ptr))
return true;
Expand Down
9 changes: 7 additions & 2 deletions compiler-rt/lib/scudo/standalone/memtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ inline NORETURN void enableSystemMemoryTaggingTestOnly() {

class ScopedDisableMemoryTagChecks {
uptr PrevTCO;
bool active;

public:
ScopedDisableMemoryTagChecks() {
ScopedDisableMemoryTagChecks(bool cond = true) : active(cond) {
if (!active)
return;
__asm__ __volatile__(
R"(
.arch_extension memtag
Expand All @@ -135,6 +138,8 @@ class ScopedDisableMemoryTagChecks {
}

~ScopedDisableMemoryTagChecks() {
if (!active)
return;
__asm__ __volatile__(
R"(
.arch_extension memtag
Expand Down Expand Up @@ -269,7 +274,7 @@ inline NORETURN void enableSystemMemoryTaggingTestOnly() {
}

struct ScopedDisableMemoryTagChecks {
ScopedDisableMemoryTagChecks() {}
ScopedDisableMemoryTagChecks(UNUSED bool cond = true) {}
};

inline NORETURN uptr selectRandomTag(uptr Ptr, uptr ExcludeMask) {
Expand Down
33 changes: 14 additions & 19 deletions compiler-rt/test/rtsan/blocking_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,23 @@
#include <stdio.h>
#include <stdlib.h>

// TODO: Remove when [[blocking]] is implemented.
extern "C" void __rtsan_notify_blocking_call(const char *function_name);

void custom_blocking_function() {
// TODO: When [[blocking]] is implemented, don't call this directly.
__rtsan_notify_blocking_call(__func__);
}

void safe_call() {
// TODO: When [[blocking]] is implemented, don't call this directly.
__rtsan_notify_blocking_call(__func__);
void custom_blocking_function() [[clang::blocking]] {
printf("In blocking function\n");
}

void process() [[clang::nonblocking]] { custom_blocking_function(); }
void realtime_function() [[clang::nonblocking]] { custom_blocking_function(); }
void nonrealtime_function() { custom_blocking_function(); }

int main() {
safe_call(); // This shouldn't die, because it isn't in nonblocking context.
process();
nonrealtime_function();
realtime_function();
return 0;
// CHECK-NOT: {{.*safe_call*}}
// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
// CHECK-NEXT: Call to blocking function `custom_blocking_function` in real-time context!
// CHECK-NEXT: {{.*custom_blocking_function*}}
// CHECK-NEXT: {{.*process*}}
}

// CHECK: ==ERROR: RealtimeSanitizer: blocking-call
// CHECK-NEXT: Call to blocking function `custom_blocking_function()` in real-time context!
// CHECK-NEXT: {{.*custom_blocking_function*}}
// CHECK-NEXT: {{.*realtime_function*}}

// should only occur once
// CHECK-NOT: ==ERROR: RealtimeSanitizer: blocking-call
7 changes: 6 additions & 1 deletion compiler-rt/test/rtsan/exit_stats.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %clangxx -fsanitize=realtime %s -o %t
// RUN: env RTSAN_OPTIONS="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
// RUN: %env_rtsan_opts="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
// RUN: %env_rtsan_opts="halt_on_error=true,print_stats_on_exit=true" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-HALT

// UNSUPPORTED: ios

Expand All @@ -22,3 +23,7 @@ int main() {
// CHECK: RealtimeSanitizer exit stats:
// CHECK-NEXT: Total error count: 10
// CHECK-NEXT: Unique error count: 1

// CHECK-HALT: RealtimeSanitizer exit stats:
// CHECK-HALT-NEXT: Total error count: 1
// CHECK-HALT-NEXT: Unique error count: 1
3 changes: 2 additions & 1 deletion flang/include/flang/Common/Fortran-features.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ ENUM_CLASS(UsageWarning, Portability, PointerToUndefinable,
IgnoredIntrinsicFunctionType, PreviousScalarUse,
RedeclaredInaccessibleComponent, ImplicitShared, IndexVarRedefinition,
IncompatibleImplicitInterfaces, BadTypeForTarget,
VectorSubscriptFinalization, UndefinedFunctionResult, UselessIomsg)
VectorSubscriptFinalization, UndefinedFunctionResult, UselessIomsg,
MismatchingDummyProcedure)

using LanguageFeatures = EnumSet<LanguageFeature, LanguageFeature_enumSize>;
using UsageWarnings = EnumSet<UsageWarning, UsageWarning_enumSize>;
Expand Down
7 changes: 4 additions & 3 deletions flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
if (debugLevel == mlir::LLVM::DIEmissionKind::LineTablesOnly) {
auto spAttr = mlir::LLVM::DISubprogramAttr::get(
context, id, compilationUnit, Scope, funcName, fullName, funcFileAttr,
line, line, subprogramFlags, subTypeAttr, /*retainedNodes=*/{});
line, line, subprogramFlags, subTypeAttr, /*retainedNodes=*/{},
/*annotations=*/{});
funcOp->setLoc(builder.getFusedLoc({l}, spAttr));
return;
}
Expand All @@ -368,7 +369,7 @@ void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
auto spAttr = mlir::LLVM::DISubprogramAttr::get(
context, recId, /*isRecSelf=*/true, id, compilationUnit, Scope, funcName,
fullName, funcFileAttr, line, line, subprogramFlags, subTypeAttr,
/*retainedNodes=*/{});
/*retainedNodes=*/{}, /*annotations=*/{});

// There is no direct information in the IR for any 'use' statement in the
// function. We have to extract that information from the DeclareOp. We do
Expand Down Expand Up @@ -401,7 +402,7 @@ void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
spAttr = mlir::LLVM::DISubprogramAttr::get(
context, recId, /*isRecSelf=*/false, id2, compilationUnit, Scope,
funcName, fullName, funcFileAttr, line, line, subprogramFlags,
subTypeAttr, entities);
subTypeAttr, entities, /*annotations=*/{});
funcOp->setLoc(builder.getFusedLoc({l}, spAttr));

funcOp.walk([&](fir::cg::XDeclareOp declOp) {
Expand Down
Loading