Skip to content

Commit 1058b08

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:922260722795 into origin/amd-gfx:cd0a74afd177
Local branch origin/amd-gfx cd0a74a Merged main:8fddef8483dc into origin/amd-gfx:2a168546b75e Remote branch main 9222607 gn build: Add check-builtins target.
2 parents cd0a74a + 9222607 commit 1058b08

File tree

184 files changed

+2872
-1552
lines changed

Some content is hidden

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

184 files changed

+2872
-1552
lines changed

.github/new-prs-labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,12 @@ backend:DirectX:
660660
- '**/*dxil*/**'
661661
- '**/*DXContainer*'
662662
- '**/*DXContainer*/**'
663+
- clang/lib/Sema/SemaDirectX.cpp
664+
- clang/include/clang/Sema/SemaDirectX.h
665+
- clang/include/clang/Basic/BuiltinsDirectX.td
666+
- clang/lib/CodeGen/TargetBuiltins/DirectX.cpp
667+
- clang/test/CodeGenDirectX/**
668+
- clang/test/SemaDirectX/**
663669

664670
backend:SPIR-V:
665671
- clang/lib/Driver/ToolChains/SPIRV.*

clang/cmake/caches/HLSL.cmake

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Including the native target is important because some of LLVM's tests fail if
22
# you don't.
3-
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
3+
set(LLVM_TARGETS_TO_BUILD "Native;SPIRV" CACHE STRING "")
44

5-
# Include the DirectX target for DXIL code generation, eventually we'll include
6-
# SPIR-V here too.
7-
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX;SPIRV" CACHE STRING "")
5+
# Include the DirectX target for DXIL code generation.
6+
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX" CACHE STRING "")
87

9-
# HLSL support is currently limted to clang, eventually it will expand to
10-
# clang-tools-extra too.
118
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
129

1310
set(CLANG_ENABLE_HLSL On CACHE BOOL "")

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ Bug Fixes to C++ Support
396396
- Improved fix for an issue with pack expansions of type constraints, where this
397397
now also works if the constraint has non-type or template template parameters.
398398
(#GH131798)
399+
- Fixes to partial ordering of non-type template parameter packs. (#GH132562)
399400
- Fix crash when evaluating the trailing requires clause of generic lambdas which are part of
400401
a pack expansion.
401402
- Fixes matching of nested template template parameters. (#GH130362)

clang/include/clang/AST/ExprCXX.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,10 +4209,10 @@ class PackExpansionExpr : public Expr {
42094209
Stmt *Pattern;
42104210

42114211
public:
4212-
PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc,
4212+
PackExpansionExpr(Expr *Pattern, SourceLocation EllipsisLoc,
42134213
UnsignedOrNone NumExpansions)
4214-
: Expr(PackExpansionExprClass, T, Pattern->getValueKind(),
4215-
Pattern->getObjectKind()),
4214+
: Expr(PackExpansionExprClass, Pattern->getType(),
4215+
Pattern->getValueKind(), Pattern->getObjectKind()),
42164216
EllipsisLoc(EllipsisLoc),
42174217
NumExpansions(NumExpansions ? *NumExpansions + 1 : 0),
42184218
Pattern(Pattern) {

clang/include/clang/Basic/Builtins.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4891,12 +4891,6 @@ def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> {
48914891
let Prototype = "void(...)";
48924892
}
48934893

4894-
def HLSLDot2Add : LangBuiltin<"HLSL_LANG"> {
4895-
let Spellings = ["__builtin_hlsl_dot2add"];
4896-
let Attributes = [NoThrow, Const];
4897-
let Prototype = "float(_ExtVector<2, _Float16>, _ExtVector<2, _Float16>, float)";
4898-
}
4899-
49004894
def HLSLDot4AddI8Packed : LangBuiltin<"HLSL_LANG"> {
49014895
let Spellings = ["__builtin_hlsl_dot4add_i8packed"];
49024896
let Attributes = [NoThrow, Const];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//===--- BuiltinsDirectX.td - DirectX Builtin function database -----------===//
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+
include "clang/Basic/BuiltinsBase.td"
10+
11+
def DxDot2Add : Builtin {
12+
let Spellings = ["__builtin_dx_dot2add"];
13+
let Attributes = [NoThrow, Const];
14+
let Prototype = "float(_ExtVector<2, _Float16>, _ExtVector<2, _Float16>, float)";
15+
}

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ clang_tablegen(BuiltinsBPF.inc -gen-clang-builtins
8282
SOURCE BuiltinsBPF.td
8383
TARGET ClangBuiltinsBPF)
8484

85+
clang_tablegen(BuiltinsDirectX.inc -gen-clang-builtins
86+
SOURCE BuiltinsDirectX.td
87+
TARGET ClangBuiltinsDirectX)
88+
8589
clang_tablegen(BuiltinsHexagon.inc -gen-clang-builtins
8690
SOURCE BuiltinsHexagon.td
8791
TARGET ClangBuiltinsHexagon)

clang/include/clang/Basic/TargetBuiltins.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ namespace clang {
141141
};
142142
}
143143

144+
/// DirectX builtins
145+
namespace DirectX {
146+
enum {
147+
LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
148+
#define GET_BUILTIN_ENUMERATORS
149+
#include "clang/Basic/BuiltinsDirectX.inc"
150+
#undef GET_BUILTIN_ENUMERATORS
151+
LastTSBuiltin
152+
};
153+
} // namespace DirectX
154+
144155
/// SPIRV builtins
145156
namespace SPIRV {
146157
enum {

clang/include/clang/Sema/Sema.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class SemaAVR;
160160
class SemaBPF;
161161
class SemaCodeCompletion;
162162
class SemaCUDA;
163+
class SemaDirectX;
163164
class SemaHLSL;
164165
class SemaHexagon;
165166
class SemaLoongArch;
@@ -1074,6 +1075,11 @@ class Sema final : public SemaBase {
10741075
return *CUDAPtr;
10751076
}
10761077

1078+
SemaDirectX &DirectX() {
1079+
assert(DirectXPtr);
1080+
return *DirectXPtr;
1081+
}
1082+
10771083
SemaHLSL &HLSL() {
10781084
assert(HLSLPtr);
10791085
return *HLSLPtr;
@@ -1212,6 +1218,7 @@ class Sema final : public SemaBase {
12121218
std::unique_ptr<SemaBPF> BPFPtr;
12131219
std::unique_ptr<SemaCodeCompletion> CodeCompletionPtr;
12141220
std::unique_ptr<SemaCUDA> CUDAPtr;
1221+
std::unique_ptr<SemaDirectX> DirectXPtr;
12151222
std::unique_ptr<SemaHLSL> HLSLPtr;
12161223
std::unique_ptr<SemaHexagon> HexagonPtr;
12171224
std::unique_ptr<SemaLoongArch> LoongArchPtr;
@@ -10127,13 +10134,14 @@ class Sema final : public SemaBase {
1012710134

1012810135
/// Contexts in which a converted constant expression is required.
1012910136
enum CCEKind {
10130-
CCEK_CaseValue, ///< Expression in a case label.
10131-
CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
10132-
CCEK_TemplateArg, ///< Value of a non-type template parameter.
10133-
CCEK_InjectedTTP, ///< Injected parameter of a template template parameter.
10134-
CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
10135-
CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
10136-
CCEK_Noexcept, ///< Condition in a noexcept(bool) specifier.
10137+
CCEK_CaseValue, ///< Expression in a case label.
10138+
CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
10139+
CCEK_TemplateArg, ///< Value of a non-type template parameter.
10140+
CCEK_TempArgStrict, ///< As above, but applies strict template checking
10141+
///< rules.
10142+
CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
10143+
CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
10144+
CCEK_Noexcept, ///< Condition in a noexcept(bool) specifier.
1013710145
CCEK_StaticAssertMessageSize, ///< Call to size() in a static assert
1013810146
///< message.
1013910147
CCEK_StaticAssertMessageData, ///< Call to data() in a static assert
@@ -11895,7 +11903,7 @@ class Sema final : public SemaBase {
1189511903
QualType InstantiatedParamType, Expr *Arg,
1189611904
TemplateArgument &SugaredConverted,
1189711905
TemplateArgument &CanonicalConverted,
11898-
bool MatchingTTP,
11906+
bool StrictCheck,
1189911907
CheckTemplateArgumentKind CTAK);
1190011908

1190111909
/// Check a template argument against its corresponding
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===----- SemaDirectX.h ----- Semantic Analysis for DirectX constructs----===//
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+
/// \file
9+
/// This file declares semantic analysis for DirectX constructs.
10+
///
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CLANG_SEMA_SEMADIRECTX_H
14+
#define LLVM_CLANG_SEMA_SEMADIRECTX_H
15+
16+
#include "clang/AST/ASTFwd.h"
17+
#include "clang/Sema/SemaBase.h"
18+
19+
namespace clang {
20+
class SemaDirectX : public SemaBase {
21+
public:
22+
SemaDirectX(Sema &S);
23+
24+
bool CheckDirectXBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
25+
};
26+
} // namespace clang
27+
28+
#endif // LLVM_CLANG_SEMA_SEMADIRECTX_H

0 commit comments

Comments
 (0)