Skip to content

Commit 9e9ef87

Browse files
committed
merge main into amd-staging
2 parents 3391c1a + d9af03b commit 9e9ef87

File tree

85 files changed

+3392
-3443
lines changed

Some content is hidden

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

85 files changed

+3392
-3443
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in {
130130
}
131131
}
132132

133-
let Features = "sse", Header = "xmmintrin.h", Attributes = [NoThrow, Const] in {
134-
def _mm_prefetch : X86LibBuiltin<"void(void const *, int)">;
135-
}
136-
137133
// AVX
138134
let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in {
139135
foreach Op = ["addsub", "hadd", "hsub", "max", "min"] in {
@@ -142,12 +138,6 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in
142138
}
143139
}
144140

145-
// PRFCHW
146-
let Features = "prfchw", Header = "intrin.h", Attributes = [NoThrow, Const] in {
147-
def _m_prefetch : X86LibBuiltin<"void(void *)">;
148-
def _m_prefetchw : X86LibBuiltin<"void(void volatile const *)">;
149-
}
150-
151141

152142
// Mechanically ported builtins from the original `.def` file.
153143
//
@@ -156,6 +146,10 @@ let Features = "prfchw", Header = "intrin.h", Attributes = [NoThrow, Const] in {
156146
// current formulation is based on what was easiest to recognize from the
157147
// pre-TableGen version.
158148

149+
let Features = "mmx", Attributes = [NoThrow, Const] in {
150+
def _mm_prefetch : X86NoPrefixBuiltin<"void(char const *, int)">;
151+
}
152+
159153
let Features = "sse", Attributes = [NoThrow] in {
160154
def ldmxcsr : X86Builtin<"void(unsigned int)">;
161155
}

clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class GlobalImmutableSpaceRegion : public NonStaticGlobalSpaceRegion {
344344
};
345345

346346
/// The region containing globals which can be modified by calls to
347-
/// "internally" defined functions - (for now just) functions other then system
347+
/// "internally" defined functions - (for now just) functions other than system
348348
/// calls.
349349
class GlobalInternalSpaceRegion : public NonStaticGlobalSpaceRegion {
350350
friend class MemRegionManager;
@@ -1021,7 +1021,7 @@ class NonParamVarRegion : public VarRegion {
10211021
}
10221022
};
10231023

1024-
/// ParamVarRegion - Represents a region for paremters. Only parameters of the
1024+
/// ParamVarRegion - Represents a region for parameters. Only parameters of the
10251025
/// function in the current stack frame are represented as `ParamVarRegion`s.
10261026
/// Parameters of top-level analyzed functions as well as captured paremeters
10271027
/// by lambdas and blocks are repesented as `VarRegion`s.

clang/lib/Basic/Targets/NVPTX.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ NVPTXTargetInfo::NVPTXTargetInfo(const llvm::Triple &Triple,
6262
HasFloat16 = true;
6363

6464
if (TargetPointerWidth == 32)
65-
resetDataLayout("e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
66-
else if (Opts.NVPTXUseShortPointers)
6765
resetDataLayout(
68-
"e-p3:32:32-p4:32:32-p5:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
66+
"e-p:32:32-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
67+
else if (Opts.NVPTXUseShortPointers)
68+
resetDataLayout("e-p3:32:32-p4:32:32-p5:32:32-p6:32:32-i64:64-i128:128-v16:"
69+
"16-v32:32-n16:32:64");
6970
else
70-
resetDataLayout("e-i64:64-i128:128-v16:16-v32:32-n16:32:64");
71+
resetDataLayout("e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
7172

7273
// If possible, get a TargetInfo for our host triple, so we can match its
7374
// types.

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15371,17 +15371,6 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
1537115371
Function *F = CGM.getIntrinsic(Intrinsic::prefetch, Address->getType());
1537215372
return Builder.CreateCall(F, {Address, RW, Locality, Data});
1537315373
}
15374-
case X86::BI_m_prefetch:
15375-
case X86::BI_m_prefetchw: {
15376-
Value *Address = Ops[0];
15377-
// The 'w' suffix implies write.
15378-
Value *RW =
15379-
ConstantInt::get(Int32Ty, BuiltinID == X86::BI_m_prefetchw ? 1 : 0);
15380-
Value *Locality = ConstantInt::get(Int32Ty, 0x3);
15381-
Value *Data = ConstantInt::get(Int32Ty, 1);
15382-
Function *F = CGM.getIntrinsic(Intrinsic::prefetch, Address->getType());
15383-
return Builder.CreateCall(F, {Address, RW, Locality, Data});
15384-
}
1538515374
case X86::BI_mm_clflush: {
1538615375
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse2_clflush),
1538715376
Ops[0]);

clang/lib/Format/QualifierAlignmentFixer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ static void rotateTokens(const SourceManager &SourceMgr,
132132
// Then move through the other tokens.
133133
auto *Tok = Begin;
134134
while (Tok != End) {
135-
if (!NewText.empty() && !endsWithSpace(NewText))
135+
if (!NewText.empty() && !endsWithSpace(NewText) &&
136+
Tok->isNot(tok::coloncolon)) {
136137
NewText += " ";
138+
}
137139

138140
NewText += Tok->TokenText;
139141
Tok = Tok->Next;
@@ -412,6 +414,14 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft(
412414
// The case `const long long volatile int` -> `const volatile long long int`
413415
// The case `long volatile long int const` -> `const volatile long long int`
414416
if (TypeToken->isTypeName(LangOpts)) {
417+
for (const auto *Prev = TypeToken->Previous;
418+
Prev && Prev->is(tok::coloncolon); Prev = Prev->Previous) {
419+
TypeToken = Prev;
420+
Prev = Prev->Previous;
421+
if (!(Prev && Prev->is(tok::identifier)))
422+
break;
423+
TypeToken = Prev;
424+
}
415425
const FormatToken *LastSimpleTypeSpecifier = TypeToken;
416426
while (isConfiguredQualifierOrType(
417427
LastSimpleTypeSpecifier->getPreviousNonComment(),

clang/lib/Headers/prfchwintrin.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
#ifndef __PRFCHWINTRIN_H
1515
#define __PRFCHWINTRIN_H
1616

17-
#if defined(__cplusplus)
18-
extern "C" {
19-
#endif
20-
2117
/// Loads a memory sequence containing the specified memory address into
2218
/// all data cache levels.
2319
///
@@ -30,7 +26,11 @@ extern "C" {
3026
///
3127
/// \param __P
3228
/// A pointer specifying the memory address to be prefetched.
33-
void _m_prefetch(void *__P);
29+
static __inline__ void __attribute__((__always_inline__, __nodebug__))
30+
_m_prefetch(void *__P)
31+
{
32+
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
33+
}
3434

3535
/// Loads a memory sequence containing the specified memory address into
3636
/// the L1 data cache and sets the cache-coherency state to modified.
@@ -48,10 +48,13 @@ void _m_prefetch(void *__P);
4848
///
4949
/// \param __P
5050
/// A pointer specifying the memory address to be prefetched.
51-
void _m_prefetchw(volatile const void *__P);
52-
53-
#if defined(__cplusplus)
54-
} // extern "C"
55-
#endif
51+
static __inline__ void __attribute__((__always_inline__, __nodebug__))
52+
_m_prefetchw(volatile const void *__P)
53+
{
54+
#pragma clang diagnostic push
55+
#pragma clang diagnostic ignored "-Wcast-qual"
56+
__builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */);
57+
#pragma clang diagnostic pop
58+
}
5659

5760
#endif /* __PRFCHWINTRIN_H */

clang/lib/Headers/xmmintrin.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,10 @@ _mm_storer_ps(float *__p, __m128 __a)
21972197
#define _MM_HINT_T2 1
21982198
#define _MM_HINT_NTA 0
21992199

2200-
#if 0
2200+
#ifndef _MSC_VER
2201+
/* FIXME: We have to #define this because "sel" must be a constant integer, and
2202+
Sema doesn't do any form of constant propagation yet. */
2203+
22012204
/// Loads one cache line of data from the specified address to a location
22022205
/// closer to the processor.
22032206
///
@@ -2222,10 +2225,6 @@ _mm_storer_ps(float *__p, __m128 __a)
22222225
/// be generated. \n
22232226
/// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will
22242227
/// be generated.
2225-
///
2226-
/// _mm_prefetch is implemented as a "library builtin" directly in Clang,
2227-
/// similar to how it is done in MSVC. Clang will warn if the user doesn't
2228-
/// include xmmintrin.h or immintrin.h.
22292228
#define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \
22302229
((sel) >> 2) & 1, (sel) & 0x3))
22312230
#endif

clang/test/CodeGen/target-data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@
160160

161161
// RUN: %clang_cc1 -triple nvptx-unknown -o - -emit-llvm %s | \
162162
// RUN: FileCheck %s -check-prefix=NVPTX
163-
// NVPTX: target datalayout = "e-p:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
163+
// NVPTX: target datalayout = "e-p:32:32-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
164164

165165
// RUN: %clang_cc1 -triple nvptx64-unknown -o - -emit-llvm %s | \
166166
// RUN: FileCheck %s -check-prefix=NVPTX64
167-
// NVPTX64: target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
167+
// NVPTX64: target datalayout = "e-p6:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64"
168168

169169
// RUN: %clang_cc1 -triple r600-unknown -o - -emit-llvm %s | \
170170
// RUN: FileCheck %s -check-prefix=R600

clang/test/Preprocessor/arm-target-features.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,17 @@
10131013
// CHECK-MVE1_2: #define __ARM_FEATURE_MVE 1
10141014
// RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE3 %s
10151015
// CHECK-MVE3: #define __ARM_FEATURE_MVE 3
1016+
1017+
// Cortex-R52 and Cortex-R52Plus correctly enable the `fpv5-sp-d16` FPU when compiling for the SP only version of the CPU.
1018+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52+nosimd+nofp.dp -mfloat-abi=hard -x c -E -dM -o - %s | FileCheck -check-prefix=CHECK-R52 %s
1019+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52plus+nosimd+nofp.dp -mfloat-abi=hard -x c -E -dM -o - %s | FileCheck -check-prefix=CHECK-R52 %s
1020+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52+nofp.dp -mfloat-abi=hard -x c -E -dM -o - %s | FileCheck -check-prefix=CHECK-R52 %s
1021+
// RUN: %clang -target arm-none-eabi -mcpu=cortex-r52plus+nofp.dp -mfloat-abi=hard -x c -E -dM -o - %s | FileCheck -check-prefix=CHECK-R52 %s
1022+
// CHECK-R52: #define __ARM_FEATURE_FMA 1
1023+
// CHECK-R52: #define __ARM_FP 0x6
1024+
// CHECK-R52: #define __ARM_FPV5__ 1
1025+
// CHECK-R52: #define __ARM_VFPV2__ 1
1026+
// CHECK-R52-NEXT: #define __ARM_VFPV3__ 1
1027+
// CHECK-R52-NEXT: #define __ARM_VFPV4__ 1
1028+
// CHECK-R52-NOT: #define __ARM_NEON 1
1029+
// CHECK-R52-NOT: #define __ARM_NEON__

clang/unittests/Format/QualifierFixerTest.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,21 @@ TEST_F(QualifierFixerTest, WithCpp11Attribute) {
12911291
"[[maybe_unused]] constexpr static int A", Style);
12921292
}
12931293

1294+
TEST_F(QualifierFixerTest, WithQualifiedTypeName) {
1295+
auto Style = getLLVMStyle();
1296+
Style.QualifierAlignment = FormatStyle::QAS_Custom;
1297+
Style.QualifierOrder = {"constexpr", "type", "const"};
1298+
1299+
verifyFormat("constexpr ::int64_t x{1};", "::int64_t constexpr x{1};", Style);
1300+
verifyFormat("constexpr std::int64_t x{123};",
1301+
"std::int64_t constexpr x{123};", Style);
1302+
verifyFormat("constexpr ::std::int64_t x{123};",
1303+
"::std::int64_t constexpr x{123};", Style);
1304+
1305+
Style.TypeNames.push_back("bar");
1306+
verifyFormat("constexpr foo::bar x{12};", "foo::bar constexpr x{12};", Style);
1307+
}
1308+
12941309
TEST_F(QualifierFixerTest, DisableRegions) {
12951310
FormatStyle Style = getLLVMStyle();
12961311
Style.QualifierAlignment = FormatStyle::QAS_Custom;

0 commit comments

Comments
 (0)