Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit b9f9dea

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:675231eb09ca into amd-gfx:a6e32de5b204
Local branch amd-gfx a6e32de Merged main:7cd7b9533c77 into amd-gfx:78fd3d96689b Remote branch main 675231e [SVE ACLE] Allow default zero initialisation for svcount_t. (llvm#69321)
2 parents a6e32de + 675231e commit b9f9dea

File tree

13 files changed

+111
-9
lines changed

13 files changed

+111
-9
lines changed

clang/lib/Index/USRGeneration.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "clang/Index/USRGeneration.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/Attr.h"
12+
#include "clang/AST/DeclCXX.h"
1213
#include "clang/AST/DeclTemplate.h"
1314
#include "clang/AST/DeclVisitor.h"
1415
#include "clang/Basic/FileManager.h"
@@ -368,14 +369,14 @@ void USRGenerator::VisitTemplateTemplateParmDecl(
368369
}
369370

370371
void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) {
372+
if (IgnoreResults)
373+
return;
374+
VisitDeclContext(D->getDeclContext());
371375
if (D->isAnonymousNamespace()) {
372376
Out << "@aN";
373377
return;
374378
}
375-
376-
VisitDeclContext(D->getDeclContext());
377-
if (!IgnoreResults)
378-
Out << "@N@" << D->getName();
379+
Out << "@N@" << D->getName();
379380
}
380381

381382
void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {

clang/test/CodeGenCXX/aarch64-sve-vector-init.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
// CHECK-NEXT: [[B8:%.*]] = alloca <vscale x 16 x i1>, align 2
5656
// CHECK-NEXT: [[B8X2:%.*]] = alloca <vscale x 32 x i1>, align 2
5757
// CHECK-NEXT: [[B8X4:%.*]] = alloca <vscale x 64 x i1>, align 2
58+
// CHECK-NEXT: [[CNT:%.*]] = alloca target("aarch64.svcount"), align 2
5859
// CHECK-NEXT: store <vscale x 16 x i8> zeroinitializer, ptr [[S8]], align 16
5960
// CHECK-NEXT: store <vscale x 8 x i16> zeroinitializer, ptr [[S16]], align 16
6061
// CHECK-NEXT: store <vscale x 4 x i32> zeroinitializer, ptr [[S32]], align 16
@@ -106,6 +107,7 @@
106107
// CHECK-NEXT: store <vscale x 16 x i1> zeroinitializer, ptr [[B8]], align 2
107108
// CHECK-NEXT: store <vscale x 32 x i1> zeroinitializer, ptr [[B8X2]], align 2
108109
// CHECK-NEXT: store <vscale x 64 x i1> zeroinitializer, ptr [[B8X4]], align 2
110+
// CHECK-NEXT: store target("aarch64.svcount") zeroinitializer, ptr [[CNT]], align 2
109111
// CHECK-NEXT: ret void
110112
//
111113
void test_locals(void) {
@@ -164,6 +166,8 @@ void test_locals(void) {
164166
__SVBool_t b8{};
165167
__clang_svboolx2_t b8x2{};
166168
__clang_svboolx4_t b8x4{};
169+
170+
__SVCount_t cnt{};
167171
}
168172

169173
// CHECK-LABEL: define dso_local void @_Z12test_copy_s8u10__SVInt8_t
@@ -879,3 +883,17 @@ void test_copy_b8x2(__clang_svboolx2_t a) {
879883
void test_copy_b8x4(__clang_svboolx4_t a) {
880884
__clang_svboolx4_t b{a};
881885
}
886+
887+
// CHECK-LABEL: define dso_local void @_Z13test_copy_cntu11__SVCount_t
888+
// CHECK-SAME: (target("aarch64.svcount") [[A:%.*]]) #[[ATTR0]] {
889+
// CHECK-NEXT: entry:
890+
// CHECK-NEXT: [[A_ADDR:%.*]] = alloca target("aarch64.svcount"), align 2
891+
// CHECK-NEXT: [[B:%.*]] = alloca target("aarch64.svcount"), align 2
892+
// CHECK-NEXT: store target("aarch64.svcount") [[A]], ptr [[A_ADDR]], align 2
893+
// CHECK-NEXT: [[TMP0:%.*]] = load target("aarch64.svcount"), ptr [[A_ADDR]], align 2
894+
// CHECK-NEXT: store target("aarch64.svcount") [[TMP0]], ptr [[B]], align 2
895+
// CHECK-NEXT: ret void
896+
//
897+
void test_copy_cnt(__SVCount_t a) {
898+
__SVCount_t b{a};
899+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: c-index-test core -print-source-symbols -- -std=c++20 %s | FileCheck %s
2+
3+
namespace ns {
4+
namespace {
5+
struct Foo {};
6+
// CHECK: [[@LINE-1]]:8 | struct/C | Foo | c:decl-context.cpp@N@ns@aN@S@Foo
7+
}
8+
}
9+
namespace ns2 {
10+
namespace {
11+
struct Foo {};
12+
// CHECK: [[@LINE-1]]:8 | struct/C | Foo | c:decl-context.cpp@N@ns2@aN@S@Foo
13+
}
14+
}

clang/unittests/Driver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(LLVM_LINK_COMPONENTS
99
add_clang_unittest(ClangDriverTests
1010
DistroTest.cpp
1111
DXCModeTest.cpp
12+
GCCVersionTest.cpp
1213
ToolChainTest.cpp
1314
ModuleCacheTest.cpp
1415
MultilibBuilderTest.cpp
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//===- unittests/Driver/GCCVersionTest.cpp --- GCCVersion parser tests ----===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// Unit tests for Generic_GCC::GCCVersion
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#include "../../lib/Driver/ToolChains/Gnu.h"
14+
#include "gtest/gtest.h"
15+
16+
using namespace clang;
17+
using namespace clang::driver;
18+
19+
namespace {
20+
21+
struct VersionParseTest {
22+
std::string Text;
23+
24+
int Major, Minor, Patch;
25+
std::string MajorStr, MinorStr, PatchSuffix;
26+
};
27+
28+
const VersionParseTest TestCases[] = {
29+
{"5", 5, -1, -1, "5", "", ""},
30+
{"4.4", 4, 4, -1, "4", "4", ""},
31+
{"4.4-patched", 4, 4, -1, "4", "4", "-patched"},
32+
{"4.4.0", 4, 4, 0, "4", "4", ""},
33+
{"4.4.x", 4, 4, -1, "4", "4", ""},
34+
{"4.4.2-rc4", 4, 4, 2, "4", "4", "-rc4"},
35+
{"4.4.x-patched", 4, 4, -1, "4", "4", ""},
36+
{"not-a-version", -1, -1, -1, "", "", ""},
37+
};
38+
39+
TEST(GCCVersionTest, Parse) {
40+
for (const auto &TC : TestCases) {
41+
auto V = toolchains::Generic_GCC::GCCVersion::Parse(TC.Text);
42+
EXPECT_EQ(V.Text, TC.Text);
43+
EXPECT_EQ(V.Major, TC.Major);
44+
EXPECT_EQ(V.Minor, TC.Minor);
45+
EXPECT_EQ(V.Patch, TC.Patch);
46+
EXPECT_EQ(V.MajorStr, TC.MajorStr);
47+
EXPECT_EQ(V.MinorStr, TC.MinorStr);
48+
EXPECT_EQ(V.PatchSuffix, TC.PatchSuffix);
49+
}
50+
}
51+
52+
} // end anonymous namespace

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,9 @@ set(aarch64_SOURCES
555555
aarch64/fp_mode.c
556556
)
557557

558-
if(COMPILER_RT_HAS_ASM_SME)
558+
if(COMPILER_RT_HAS_ASM_SME AND (COMPILER_RT_HAS_AUXV OR COMPILER_RT_BAREMETAL_BUILD))
559559
list(APPEND aarch64_SOURCES aarch64/sme-abi.S aarch64/sme-abi-init.c)
560+
message(STATUS "AArch64 SME ABI routines enabled")
560561
else()
561562
message(STATUS "AArch64 SME ABI routines disabled")
562563
endif()

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 477846
19+
#define LLVM_MAIN_REVISION 477852
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/include/llvm/Object/XCOFFObjectFile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ class XCOFFSymbolRef : public SymbolRef {
783783
const XCOFFSymbolEntry32 *getSymbol32() const {
784784
return reinterpret_cast<const XCOFFSymbolEntry32 *>(getRawDataRefImpl().p);
785785
}
786+
786787
const XCOFFSymbolEntry64 *getSymbol64() const {
787788
return reinterpret_cast<const XCOFFSymbolEntry64 *>(getRawDataRefImpl().p);
788789
}

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,12 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
17381738
if (const auto *NC = dyn_cast<NoCFIValue>(C))
17391739
return getValue(NC->getGlobalValue());
17401740

1741+
if (VT == MVT::aarch64svcount) {
1742+
assert(C->isNullValue() && "Can only zero this target type!");
1743+
return DAG.getNode(ISD::BITCAST, getCurSDLoc(), VT,
1744+
DAG.getConstant(0, getCurSDLoc(), MVT::nxv16i1));
1745+
}
1746+
17411747
VectorType *VecTy = cast<VectorType>(V->getType());
17421748

17431749
// Now that we know the number and type of the elements, get that number of

llvm/lib/IR/Type.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,8 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
841841

842842
// Opaque types in the AArch64 name space.
843843
if (Name == "aarch64.svcount")
844-
return TargetTypeInfo(ScalableVectorType::get(Type::getInt1Ty(C), 16));
844+
return TargetTypeInfo(ScalableVectorType::get(Type::getInt1Ty(C), 16),
845+
TargetExtType::HasZeroInit);
845846

846847
return TargetTypeInfo(Type::getVoidTy(C));
847848
}

0 commit comments

Comments
 (0)