Skip to content

Commit 040572f

Browse files
Merge branch 'llvm:main' into copy-inout-dev
2 parents 889d514 + b8e4232 commit 040572f

File tree

835 files changed

+28309
-4255
lines changed

Some content is hidden

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

835 files changed

+28309
-4255
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,15 @@ of different sizes and signs is forbidden in binary and ternary builtins.
860860
semantics, see `LangRef
861861
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
862862
for the comparison.
863+
T __builtin_elementwise_fshl(T x, T y, T z) perform a funnel shift left. Concatenate x and y (x is the most integer types
864+
significant bits of the wide value), the combined value is shifted
865+
left by z, and the most significant bits are extracted to produce
866+
a result that is the same size as the original arguments.
867+
868+
T __builtin_elementwise_fshr(T x, T y, T z) perform a funnel shift right. Concatenate x and y (x is the most integer types
869+
significant bits of the wide value), the combined value is shifted
870+
right by z, and the least significant bits are extracted to produce
871+
a result that is the same size as the original arguments.
863872
============================================== ====================================================================== =========================================
864873

865874

clang/docs/OpenMPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ implementation.
191191
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
192192
| device | teams construct on the host device | :good:`done` | r371553 |
193193
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
194-
| device | support non-contiguous array sections for target update | :good:`done` | |
194+
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
195195
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
196196
| device | pointer attachment | :good:`done` | |
197197
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ C23 Feature Support
113113

114114
Non-comprehensive list of changes in this release
115115
-------------------------------------------------
116+
- Added ``__builtin_elementwise_fshl`` and ``__builtin_elementwise_fshr``.
117+
116118
- Added ``__builtin_elementwise_minnumnum`` and ``__builtin_elementwise_maxnumnum``.
117119

118120
- Trapping UBSan (e.g. ``-fsanitize-trap=undefined``) now emits a string describing the reason for
@@ -320,6 +322,7 @@ OpenMP Support
320322
- Added parsing and semantic analysis support for the ``need_device_addr``
321323
modifier in the ``adjust_args`` clause.
322324
- Allow array length to be omitted in array section subscript expression.
325+
- Fixed non-contiguous strided update in the ``omp target update`` directive with the ``from`` clause.
323326

324327
Improvements
325328
^^^^^^^^^^^^

clang/include/clang/APINotes/Types.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ class CommonTypeInfo : public CommonEntityInfo {
141141
/// The NS error domain for this type.
142142
std::optional<std::string> NSErrorDomain;
143143

144+
/// The Swift protocol that this type should be automatically conformed to.
145+
std::optional<std::string> SwiftConformance;
146+
144147
public:
145148
CommonTypeInfo() {}
146149

@@ -165,6 +168,14 @@ class CommonTypeInfo : public CommonEntityInfo {
165168
: std::nullopt;
166169
}
167170

171+
std::optional<std::string> getSwiftConformance() const {
172+
return SwiftConformance;
173+
}
174+
175+
void setSwiftConformance(std::optional<std::string> conformance) {
176+
SwiftConformance = conformance;
177+
}
178+
168179
friend bool operator==(const CommonTypeInfo &, const CommonTypeInfo &);
169180

170181
CommonTypeInfo &operator|=(const CommonTypeInfo &RHS) {
@@ -175,6 +186,8 @@ class CommonTypeInfo : public CommonEntityInfo {
175186
setSwiftBridge(RHS.getSwiftBridge());
176187
if (!NSErrorDomain)
177188
setNSErrorDomain(RHS.getNSErrorDomain());
189+
if (SwiftConformance)
190+
setSwiftConformance(RHS.getSwiftConformance());
178191

179192
return *this;
180193
}
@@ -185,7 +198,8 @@ class CommonTypeInfo : public CommonEntityInfo {
185198
inline bool operator==(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
186199
return static_cast<const CommonEntityInfo &>(LHS) == RHS &&
187200
LHS.SwiftBridge == RHS.SwiftBridge &&
188-
LHS.NSErrorDomain == RHS.NSErrorDomain;
201+
LHS.NSErrorDomain == RHS.NSErrorDomain &&
202+
LHS.SwiftConformance == RHS.SwiftConformance;
189203
}
190204

191205
inline bool operator!=(const CommonTypeInfo &LHS, const CommonTypeInfo &RHS) {
@@ -739,9 +753,6 @@ class TagInfo : public CommonTypeInfo {
739753
std::optional<std::string> SwiftReleaseOp;
740754
std::optional<std::string> SwiftDefaultOwnership;
741755

742-
/// The Swift protocol that this type should be automatically conformed to.
743-
std::optional<std::string> SwiftConformance;
744-
745756
std::optional<EnumExtensibilityKind> EnumExtensibility;
746757

747758
TagInfo()
@@ -790,9 +801,6 @@ class TagInfo : public CommonTypeInfo {
790801
if (!SwiftDefaultOwnership)
791802
SwiftDefaultOwnership = RHS.SwiftDefaultOwnership;
792803

793-
if (!SwiftConformance)
794-
SwiftConformance = RHS.SwiftConformance;
795-
796804
if (!HasFlagEnum)
797805
setFlagEnum(RHS.isFlagEnum());
798806

@@ -819,7 +827,6 @@ inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) {
819827
LHS.SwiftRetainOp == RHS.SwiftRetainOp &&
820828
LHS.SwiftReleaseOp == RHS.SwiftReleaseOp &&
821829
LHS.SwiftDefaultOwnership == RHS.SwiftDefaultOwnership &&
822-
LHS.SwiftConformance == RHS.SwiftConformance &&
823830
LHS.isFlagEnum() == RHS.isFlagEnum() &&
824831
LHS.isSwiftCopyable() == RHS.isSwiftCopyable() &&
825832
LHS.isSwiftEscapable() == RHS.isSwiftEscapable() &&

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,18 @@ def ElementwiseSubSat : Builtin {
15141514
let Prototype = "void(...)";
15151515
}
15161516

1517+
def ElementwiseFshl : Builtin {
1518+
let Spellings = ["__builtin_elementwise_fshl"];
1519+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1520+
let Prototype = "void(...)";
1521+
}
1522+
1523+
def ElementwiseFshr : Builtin {
1524+
let Spellings = ["__builtin_elementwise_fshr"];
1525+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1526+
let Prototype = "void(...)";
1527+
}
1528+
15171529
def ReduceMax : Builtin {
15181530
let Spellings = ["__builtin_reduce_max"];
15191531
let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal, "vIi", "n", "gfx12-insts")
503503
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal_var, "vv*i", "n", "gfx12-insts")
504504
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_wait, "vIs", "n", "gfx12-insts")
505505
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_signal_isfirst, "bIi", "n", "gfx12-insts")
506+
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_init, "vv*i", "n", "gfx12-insts")
507+
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_join, "vv*", "n", "gfx12-insts")
508+
TARGET_BUILTIN(__builtin_amdgcn_s_barrier_leave, "vIs", "n", "gfx12-insts")
506509
TARGET_BUILTIN(__builtin_amdgcn_s_get_barrier_state, "Uii", "n", "gfx12-insts")
507510
TARGET_BUILTIN(__builtin_amdgcn_s_get_named_barrier_state, "Uiv*", "n", "gfx12-insts")
508511
TARGET_BUILTIN(__builtin_amdgcn_s_prefetch_data, "vvC*Ui", "nc", "gfx12-insts")

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -757,14 +757,6 @@ let Features = "f16c", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] i
757757
def vcvtps2ph256 : X86Builtin<"_Vector<8, short>(_Vector<8, float>, _Constant int)">;
758758
}
759759

760-
let Features = "f16c", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
761-
def vcvtph2ps : X86Builtin<"_Vector<4, float>(_Vector<8, short>)">;
762-
}
763-
764-
let Features = "f16c", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
765-
def vcvtph2ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, short>)">;
766-
}
767-
768760
let Features = "rdrnd", Attributes = [NoThrow] in {
769761
def rdrand16_step : X86Builtin<"unsigned int(unsigned short *)">;
770762
def rdrand32_step : X86Builtin<"unsigned int(unsigned int *)">;

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
212212
return create<cir::AllocaOp>(loc, addrType, type, name, alignment);
213213
}
214214

215+
/// Get constant address of a global variable as an MLIR attribute.
216+
cir::GlobalViewAttr getGlobalViewAttr(cir::PointerType type,
217+
cir::GlobalOp globalOp) {
218+
auto symbol = mlir::FlatSymbolRefAttr::get(globalOp.getSymNameAttr());
219+
return cir::GlobalViewAttr::get(type, symbol);
220+
}
221+
215222
mlir::Value createGetGlobal(mlir::Location loc, cir::GlobalOp global) {
216223
assert(!cir::MissingFeatures::addressSpace());
217224
return create<cir::GetGlobalOp>(loc, getPointerTo(global.getSymType()),

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,53 @@ def CIR_ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", [TypedAttrInterface]> {
370370
}];
371371
}
372372

373+
//===----------------------------------------------------------------------===//
374+
// GlobalViewAttr
375+
//===----------------------------------------------------------------------===//
376+
377+
def CIR_GlobalViewAttr : CIR_Attr<"GlobalView", "global_view", [
378+
TypedAttrInterface
379+
]> {
380+
let summary = "Provides constant access to a global address";
381+
let description = [{
382+
Get constant address of global `symbol`. It provides a way to access globals
383+
from other global and always produces a pointer.
384+
385+
The type of the input symbol can be different from `#cir.global_view`
386+
output type, since a given view of the global might require a static
387+
cast for initializing other globals.
388+
389+
The result type of this attribute may be an integer type. In such a case,
390+
the pointer to the referenced global is casted to an integer and this
391+
attribute represents the casted result.
392+
393+
Example:
394+
395+
```
396+
cir.global external @s = @".str2": !cir.ptr<i8>
397+
cir.global external @x = #cir.global_view<@s> : !cir.ptr<i8>
398+
cir.global external @s_addr = #cir.global_view<@s> : !s64i
399+
```
400+
}];
401+
402+
let parameters = (ins AttributeSelfTypeParameter<"">:$type,
403+
"mlir::FlatSymbolRefAttr":$symbol);
404+
405+
let builders = [
406+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type,
407+
"mlir::FlatSymbolRefAttr":$symbol), [{
408+
return $_get(type.getContext(), type, symbol);
409+
}]>
410+
];
411+
412+
// let genVerifyDecl = 1;
413+
let assemblyFormat = [{
414+
`<`
415+
$symbol
416+
`>`
417+
}];
418+
}
419+
373420
//===----------------------------------------------------------------------===//
374421
// ConstComplexAttr
375422
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ struct MissingFeatures {
192192
static bool constantFoldSwitchStatement() { return false; }
193193
static bool constructABIArgDirectExtend() { return false; }
194194
static bool coverageMapping() { return false; }
195+
static bool createInvariantGroup() { return false; }
195196
static bool createProfileWeightsForLoop() { return false; }
196197
static bool ctorMemcpyizer() { return false; }
197198
static bool cudaSupport() { return false; }
@@ -200,6 +201,8 @@ struct MissingFeatures {
200201
static bool deferredCXXGlobalInit() { return false; }
201202
static bool ehCleanupFlags() { return false; }
202203
static bool ehCleanupScope() { return false; }
204+
static bool ehCleanupScopeRequiresEHCleanup() { return false; }
205+
static bool ehCleanupBranchFixups() { return false; }
203206
static bool ehstackBranches() { return false; }
204207
static bool emitCheckedInBoundsGEP() { return false; }
205208
static bool emitCondLikelihoodViaExpectIntrinsic() { return false; }
@@ -210,9 +213,12 @@ struct MissingFeatures {
210213
static bool fastMathFlags() { return false; }
211214
static bool fpConstraints() { return false; }
212215
static bool generateDebugInfo() { return false; }
216+
static bool globalViewIndices() { return false; }
217+
static bool globalViewIntLowering() { return false; }
213218
static bool hip() { return false; }
214219
static bool implicitConstructorArgs() { return false; }
215220
static bool incrementProfileCounter() { return false; }
221+
static bool innermostEHScope() { return false; }
216222
static bool insertBuiltinUnpredictable() { return false; }
217223
static bool instrumentation() { return false; }
218224
static bool intrinsics() { return false; }
@@ -233,7 +239,6 @@ struct MissingFeatures {
233239
static bool objCGC() { return false; }
234240
static bool objCLifetime() { return false; }
235241
static bool openMP() { return false; }
236-
static bool opGlobalViewAttr() { return false; }
237242
static bool opTBAA() { return false; }
238243
static bool peepholeProtection() { return false; }
239244
static bool pgoUse() { return false; }
@@ -260,6 +265,7 @@ struct MissingFeatures {
260265
static bool appleKext() { return false; }
261266
static bool dtorCleanups() { return false; }
262267
static bool vtableInitialization() { return false; }
268+
static bool vtableRelativeLayout() { return false; }
263269
static bool msvcBuiltins() { return false; }
264270
static bool vlas() { return false; }
265271

0 commit comments

Comments
 (0)