Skip to content

Commit 20e0dd2

Browse files
authored
Merge branch 'main' into wip-fmv-feature-deps
2 parents 695d2f8 + bc7e5c2 commit 20e0dd2

File tree

174 files changed

+5465
-2344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+5465
-2344
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,6 @@ def LifetimeBound : DeclOrTypeAttr {
18861886
let Spellings = [Clang<"lifetimebound", 0>];
18871887
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
18881888
let Documentation = [LifetimeBoundDocs];
1889-
let LangOpts = [CPlusPlus];
18901889
let SimpleHandler = 1;
18911890
}
18921891

clang/include/clang/Basic/AttrDocs.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3858,8 +3858,7 @@ def LifetimeBoundDocs : Documentation {
38583858
The ``lifetimebound`` attribute on a function parameter or implicit object
38593859
parameter indicates that objects that are referred to by that parameter may
38603860
also be referred to by the return value of the annotated function (or, for a
3861-
parameter of a constructor, by the value of the constructed object). It is only
3862-
supported in C++.
3861+
parameter of a constructor, by the value of the constructed object).
38633862

38643863
By default, a reference is considered to refer to its referenced object, a
38653864
pointer is considered to refer to its pointee, a ``std::initializer_list<T>``

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12747,6 +12747,19 @@ def err_acc_gang_reduction_numgangs_conflict
1274712747
def err_reduction_op_mismatch
1274812748
: Error<"OpenACC 'reduction' variable must have the same operator in all "
1274912749
"nested constructs (%0 vs %1)">;
12750+
def err_acc_loop_variable_type
12751+
: Error<"loop variable of loop associated with an OpenACC 'loop' construct "
12752+
"must be of integer, pointer, or random-access-iterator type (is "
12753+
"%0)">;
12754+
def err_acc_loop_variable
12755+
: Error<"OpenACC 'loop' construct must have initialization clause in "
12756+
"canonical form ('var = init' or 'T var = init')">;
12757+
def err_acc_loop_terminating_condition
12758+
: Error<"OpenACC 'loop' construct must have a terminating condition">;
12759+
def err_acc_loop_not_monotonic
12760+
: Error<"OpenACC 'loop' variable must monotonically increase or decrease "
12761+
"('++', '--', or compound assignment)">;
12762+
1275012763
// AMDGCN builtins diagnostics
1275112764
def err_amdgcn_global_load_lds_size_invalid_value : Error<"invalid size value">;
1275212765
def note_amdgcn_global_load_lds_size_valid_value : Note<"size must be 1, 2, or 4">;

clang/include/clang/Basic/arm_sve.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ let SVETargetGuard = "sve2,lut,bf16", SMETargetGuard = "sme2,lut,bf16" in {
19621962
////////////////////////////////////////////////////////////////////////////////
19631963
// SVE2 - Optional
19641964

1965-
let SVETargetGuard = "sve2-aes", SMETargetGuard = InvalidMode in {
1965+
let SVETargetGuard = "sve2,sve-aes", SMETargetGuard = InvalidMode in {
19661966
def SVAESD : SInst<"svaesd[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aesd", [IsOverloadNone]>;
19671967
def SVAESIMC : SInst<"svaesimc[_{d}]", "dd", "Uc", MergeNone, "aarch64_sve_aesimc", [IsOverloadNone]>;
19681968
def SVAESE : SInst<"svaese[_{d}]", "ddd", "Uc", MergeNone, "aarch64_sve_aese", [IsOverloadNone]>;

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,43 @@ class SemaOpenACC : public SemaBase {
118118
/// 'loop' clause enforcement, where this is 'blocked' by a compute construct.
119119
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
120120

121+
// Type to check the info about the 'for stmt'.
122+
struct ForStmtBeginChecker {
123+
SemaOpenACC &SemaRef;
124+
SourceLocation ForLoc;
125+
bool IsRangeFor = false;
126+
std::optional<const CXXForRangeStmt *> RangeFor = nullptr;
127+
const Stmt *Init = nullptr;
128+
bool InitChanged = false;
129+
std::optional<const Stmt *> Cond = nullptr;
130+
std::optional<const Stmt *> Inc = nullptr;
131+
// Prevent us from checking 2x, which can happen with collapse & tile.
132+
bool AlreadyChecked = false;
133+
134+
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
135+
std::optional<const CXXForRangeStmt *> S)
136+
: SemaRef(SemaRef), ForLoc(ForLoc), IsRangeFor(true), RangeFor(S) {}
137+
138+
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
139+
const Stmt *I, bool InitChanged,
140+
std::optional<const Stmt *> C,
141+
std::optional<const Stmt *> Inc)
142+
: SemaRef(SemaRef), ForLoc(ForLoc), IsRangeFor(false), Init(I),
143+
InitChanged(InitChanged), Cond(C), Inc(Inc) {}
144+
// Do the checking for the For/Range-For. Currently this implements the 'not
145+
// seq' restrictions only, and should be called either if we know we are a
146+
// top-level 'for' (the one associated via associated-stmt), or extended via
147+
// 'collapse'.
148+
void check();
149+
150+
const ValueDecl *checkInit();
151+
void checkCond();
152+
void checkInc(const ValueDecl *Init);
153+
};
154+
155+
/// Helper function for checking the 'for' and 'range for' stmts.
156+
void ForStmtBeginHelper(SourceLocation ForLoc, ForStmtBeginChecker &C);
157+
121158
public:
122159
ComputeConstructInfo &getActiveComputeConstructInfo() {
123160
return ActiveComputeConstructInfo;
@@ -137,6 +174,11 @@ class SemaOpenACC : public SemaBase {
137174
/// permits us to implement the restriction of no further 'gang', 'vector', or
138175
/// 'worker' clauses.
139176
SourceLocation LoopVectorClauseLoc;
177+
/// If there is a current 'active' loop construct that does NOT have a 'seq'
178+
/// clause on it, this has that source location. This permits us to implement
179+
/// the 'loop' restrictions on the loop variable. This can be extended via
180+
/// 'collapse', so we need to keep this around for a while.
181+
SourceLocation LoopWithoutSeqLoc;
140182

141183
// Redeclaration of the version in OpenACCClause.h.
142184
using DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation>;
@@ -568,8 +610,19 @@ class SemaOpenACC : public SemaBase {
568610
void ActOnWhileStmt(SourceLocation WhileLoc);
569611
// Called when we encounter a 'do' statement, before looking at its 'body'.
570612
void ActOnDoStmt(SourceLocation DoLoc);
613+
// Called when we encounter a 'for' statement, before looking at its 'body',
614+
// for the 'range-for'. 'ActOnForStmtEnd' is used after the body.
615+
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor,
616+
const Stmt *RangeFor);
617+
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *RangeFor);
571618
// Called when we encounter a 'for' statement, before looking at its 'body'.
572-
void ActOnForStmtBegin(SourceLocation ForLoc);
619+
// 'ActOnForStmtEnd' is used after the body.
620+
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First,
621+
const Stmt *Second, const Stmt *Third);
622+
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *OldFirst,
623+
const Stmt *First, const Stmt *OldSecond,
624+
const Stmt *Second, const Stmt *OldThird,
625+
const Stmt *Third);
573626
// Called when we encounter a 'for' statement, after we've consumed/checked
574627
// the body. This is necessary for a number of checks on the contents of the
575628
// 'for' statement.
@@ -598,7 +651,9 @@ class SemaOpenACC : public SemaBase {
598651
/// Called when we encounter an associated statement for our construct, this
599652
/// should check legality of the statement as it appertains to this Construct.
600653
StmtResult ActOnAssociatedStmt(SourceLocation DirectiveLoc,
601-
OpenACCDirectiveKind K, StmtResult AssocStmt);
654+
OpenACCDirectiveKind K,
655+
ArrayRef<const OpenACCClause *> Clauses,
656+
StmtResult AssocStmt);
602657

603658
/// Called after the directive has been completely parsed, including the
604659
/// declaration group or associated statement.
@@ -712,12 +767,13 @@ class SemaOpenACC : public SemaBase {
712767
SourceLocation OldLoopGangClauseOnKernelLoc;
713768
SourceLocation OldLoopWorkerClauseLoc;
714769
SourceLocation OldLoopVectorClauseLoc;
770+
SourceLocation OldLoopWithoutSeqLoc;
715771
llvm::SmallVector<OpenACCLoopConstruct *> ParentlessLoopConstructs;
716772
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
717773
LoopInConstructRAII LoopRAII;
718774

719775
public:
720-
AssociatedStmtRAII(SemaOpenACC &, OpenACCDirectiveKind,
776+
AssociatedStmtRAII(SemaOpenACC &, OpenACCDirectiveKind, SourceLocation,
721777
ArrayRef<const OpenACCClause *>,
722778
ArrayRef<OpenACCClause *>);
723779
void SetCollapseInfoBeforeAssociatedStmt(

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
473473
if (HasSVE2p1)
474474
Builder.defineMacro("__ARM_FEATURE_SVE2p1", "1");
475475

476-
if (HasSVE2 && HasSVE2AES)
476+
if (HasSVE2 && HasSVEAES)
477477
Builder.defineMacro("__ARM_FEATURE_SVE2_AES", "1");
478478

479479
if (HasSVE2 && HasSVE2BitPerm)
@@ -769,7 +769,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
769769
.Case("f32mm", FPU & SveMode && HasMatmulFP32)
770770
.Case("f64mm", FPU & SveMode && HasMatmulFP64)
771771
.Case("sve2", FPU & SveMode && HasSVE2)
772-
.Case("sve2-pmull128", FPU & SveMode && HasSVE2AES)
772+
.Case("sve2-pmull128", FPU & SveMode && HasSVEAES && HasSVE2)
773773
.Case("sve2-bitperm", FPU & SveMode && HasSVE2BitPerm)
774774
.Case("sve2-sha3", FPU & SveMode && HasSVE2SHA3)
775775
.Case("sve2-sm4", FPU & SveMode && HasSVE2SM4)
@@ -861,12 +861,10 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
861861
HasSVE2 = true;
862862
HasSVE2p1 = true;
863863
}
864-
if (Feature == "+sve2-aes") {
864+
if (Feature == "+sve-aes") {
865865
FPU |= NeonMode;
866-
FPU |= SveMode;
867-
HasFullFP16 = true;
868-
HasSVE2 = true;
869-
HasSVE2AES = true;
866+
HasAES = true;
867+
HasSVEAES = true;
870868
}
871869
if (Feature == "+sve2-sha3") {
872870
FPU |= NeonMode;

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
7878
bool HasBFloat16 = false;
7979
bool HasSVE2 = false;
8080
bool HasSVE2p1 = false;
81-
bool HasSVE2AES = false;
81+
bool HasSVEAES = false;
8282
bool HasSVE2SHA3 = false;
8383
bool HasSVE2SM4 = false;
8484
bool HasSVEB16B16 = false;

clang/lib/Headers/emmintrin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4626,8 +4626,9 @@ _mm_movepi64_pi64(__m128i __a) {
46264626
/// A 64-bit value.
46274627
/// \returns A 128-bit integer vector. The lower 64 bits contain the value from
46284628
/// the operand. The upper 64 bits are assigned zeros.
4629-
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_movpi64_epi64(__m64 __a) {
4630-
return __extension__(__m128i)(__v2di){(long long)__a, 0};
4629+
static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
4630+
_mm_movpi64_epi64(__m64 __a) {
4631+
return __builtin_shufflevector((__v1di)__a, _mm_setzero_si64(), 0, 1);
46314632
}
46324633

46334634
/// Moves the lower 64 bits of a 128-bit integer vector to a 128-bit

clang/lib/Headers/mmintrin.h

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ typedef char __v16qi __attribute__((__vector_size__(16)));
4949
__min_vector_width__(128)))
5050
#endif
5151

52+
#if defined(__cplusplus) && (__cplusplus >= 201103L)
53+
#define __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR __DEFAULT_FN_ATTRS_SSE2 constexpr
54+
#else
55+
#define __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR __DEFAULT_FN_ATTRS_SSE2
56+
#endif
57+
5258
#define __trunc64(x) \
5359
(__m64) __builtin_shufflevector((__v2di)(x), __extension__(__v2di){}, 0)
5460
#define __anyext128(x) \
@@ -1332,10 +1338,9 @@ _mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
13321338
/// This intrinsic corresponds to the <c> PXOR </c> instruction.
13331339
///
13341340
/// \returns An initialized 64-bit integer vector with all elements set to zero.
1335-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1336-
_mm_setzero_si64(void)
1337-
{
1338-
return __extension__ (__m64){ 0LL };
1341+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1342+
_mm_setzero_si64(void) {
1343+
return __extension__(__m64){0LL};
13391344
}
13401345

13411346
/// Constructs a 64-bit integer vector initialized with the specified
@@ -1353,10 +1358,9 @@ _mm_setzero_si64(void)
13531358
/// A 32-bit integer value used to initialize the lower 32 bits of the
13541359
/// result.
13551360
/// \returns An initialized 64-bit integer vector.
1356-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1357-
_mm_set_pi32(int __i1, int __i0)
1358-
{
1359-
return __extension__ (__m64)(__v2si){__i0, __i1};
1361+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1362+
_mm_set_pi32(int __i1, int __i0) {
1363+
return __extension__(__m64)(__v2si){__i0, __i1};
13601364
}
13611365

13621366
/// Constructs a 64-bit integer vector initialized with the specified
@@ -1376,10 +1380,9 @@ _mm_set_pi32(int __i1, int __i0)
13761380
/// \param __s0
13771381
/// A 16-bit integer value used to initialize bits [15:0] of the result.
13781382
/// \returns An initialized 64-bit integer vector.
1379-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1380-
_mm_set_pi16(short __s3, short __s2, short __s1, short __s0)
1381-
{
1382-
return __extension__ (__m64)(__v4hi){__s0, __s1, __s2, __s3};
1383+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1384+
_mm_set_pi16(short __s3, short __s2, short __s1, short __s0) {
1385+
return __extension__(__m64)(__v4hi){__s0, __s1, __s2, __s3};
13831386
}
13841387

13851388
/// Constructs a 64-bit integer vector initialized with the specified
@@ -1407,12 +1410,11 @@ _mm_set_pi16(short __s3, short __s2, short __s1, short __s0)
14071410
/// \param __b0
14081411
/// An 8-bit integer value used to initialize bits [7:0] of the result.
14091412
/// \returns An initialized 64-bit integer vector.
1410-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1413+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
14111414
_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
1412-
char __b1, char __b0)
1413-
{
1414-
return __extension__ (__m64)(__v8qi){__b0, __b1, __b2, __b3,
1415-
__b4, __b5, __b6, __b7};
1415+
char __b1, char __b0) {
1416+
return __extension__(__m64)(__v8qi){__b0, __b1, __b2, __b3,
1417+
__b4, __b5, __b6, __b7};
14161418
}
14171419

14181420
/// Constructs a 64-bit integer vector of [2 x i32], with each of the
@@ -1428,10 +1430,9 @@ _mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
14281430
/// A 32-bit integer value used to initialize each vector element of the
14291431
/// result.
14301432
/// \returns An initialized 64-bit integer vector of [2 x i32].
1431-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1432-
_mm_set1_pi32(int __i)
1433-
{
1434-
return _mm_set_pi32(__i, __i);
1433+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1434+
_mm_set1_pi32(int __i) {
1435+
return _mm_set_pi32(__i, __i);
14351436
}
14361437

14371438
/// Constructs a 64-bit integer vector of [4 x i16], with each of the
@@ -1447,10 +1448,9 @@ _mm_set1_pi32(int __i)
14471448
/// A 16-bit integer value used to initialize each vector element of the
14481449
/// result.
14491450
/// \returns An initialized 64-bit integer vector of [4 x i16].
1450-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1451-
_mm_set1_pi16(short __w)
1452-
{
1453-
return _mm_set_pi16(__w, __w, __w, __w);
1451+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1452+
_mm_set1_pi16(short __w) {
1453+
return _mm_set_pi16(__w, __w, __w, __w);
14541454
}
14551455

14561456
/// Constructs a 64-bit integer vector of [8 x i8], with each of the
@@ -1465,10 +1465,9 @@ _mm_set1_pi16(short __w)
14651465
/// An 8-bit integer value used to initialize each vector element of the
14661466
/// result.
14671467
/// \returns An initialized 64-bit integer vector of [8 x i8].
1468-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1469-
_mm_set1_pi8(char __b)
1470-
{
1471-
return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
1468+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1469+
_mm_set1_pi8(char __b) {
1470+
return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
14721471
}
14731472

14741473
/// Constructs a 64-bit integer vector, initialized in reverse order with
@@ -1486,10 +1485,9 @@ _mm_set1_pi8(char __b)
14861485
/// A 32-bit integer value used to initialize the upper 32 bits of the
14871486
/// result.
14881487
/// \returns An initialized 64-bit integer vector.
1489-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1490-
_mm_setr_pi32(int __i0, int __i1)
1491-
{
1492-
return _mm_set_pi32(__i1, __i0);
1488+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1489+
_mm_setr_pi32(int __i0, int __i1) {
1490+
return _mm_set_pi32(__i1, __i0);
14931491
}
14941492

14951493
/// Constructs a 64-bit integer vector, initialized in reverse order with
@@ -1509,10 +1507,9 @@ _mm_setr_pi32(int __i0, int __i1)
15091507
/// \param __w3
15101508
/// A 16-bit integer value used to initialize bits [63:48] of the result.
15111509
/// \returns An initialized 64-bit integer vector.
1512-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1513-
_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)
1514-
{
1515-
return _mm_set_pi16(__w3, __w2, __w1, __w0);
1510+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
1511+
_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3) {
1512+
return _mm_set_pi16(__w3, __w2, __w1, __w0);
15161513
}
15171514

15181515
/// Constructs a 64-bit integer vector, initialized in reverse order with
@@ -1540,11 +1537,10 @@ _mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)
15401537
/// \param __b7
15411538
/// An 8-bit integer value used to initialize bits [63:56] of the result.
15421539
/// \returns An initialized 64-bit integer vector.
1543-
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2
1540+
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
15441541
_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
1545-
char __b6, char __b7)
1546-
{
1547-
return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
1542+
char __b6, char __b7) {
1543+
return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
15481544
}
15491545

15501546
#undef __anyext128

clang/lib/Headers/stdalign.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#ifndef __STDALIGN_H
1111
#define __STDALIGN_H
1212

13-
#if defined(__MVS__) && __has_include_next(<stdalign.h>)
14-
#include_next <stdalign.h>
15-
#else
16-
1713
#if defined(__cplusplus) || \
1814
(defined(__STDC_VERSION__) && __STDC_VERSION__ < 202311L)
1915
#ifndef __cplusplus
@@ -25,5 +21,4 @@
2521
#define __alignof_is_defined 1
2622
#endif /* __STDC_VERSION__ */
2723

28-
#endif /* __MVS__ */
2924
#endif /* __STDALIGN_H */

0 commit comments

Comments
 (0)