Skip to content

Commit 1762f42

Browse files
committed
merge main into amd-staging
2 parents 167a295 + 0b01b96 commit 1762f42

File tree

426 files changed

+13317
-2656
lines changed

Some content is hidden

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

426 files changed

+13317
-2656
lines changed

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,12 @@ jobs:
141141
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
142142
fi
143143
144-
build_flang="true"
145-
146144
if [ "$RUNNER_OS" = "Windows" ]; then
147145
# The build times out on Windows, so we need to disable LTO.
148146
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
149147
fi
150148
151149
echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
152-
echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
153150
case "${{ inputs.runs-on }}" in
154151
ubuntu-22.04*)
155152
build_runs_on="depot-${{ inputs.runs-on }}-16"

clang/include/clang/Basic/BuiltinsHexagon.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ class V<string version, VFeatures newer> : VFeatures {
2020
let Features = !strconcat("v", version, "|", newer.Features);
2121
}
2222

23-
let Features = "v79" in def V79 : VFeatures;
23+
let Features = "v81" in def V81 : VFeatures;
2424

25+
def V79 : V<"79", V81>;
2526
def V75 : V<"75", V79>;
2627
def V73 : V<"73", V75>;
2728
def V71 : V<"71", V73>;
@@ -43,8 +44,9 @@ class HVXV<string version, HVXVFeatures newer> : HVXVFeatures {
4344
let Features = !strconcat("hvxv", version, "|", newer.Features);
4445
}
4546

46-
let Features = "hvxv79" in def HVXV79 : HVXVFeatures;
47+
let Features = "hvxv81" in def HVXV81 : HVXVFeatures;
4748

49+
def HVXV79 : HVXV<"79", HVXV81>;
4850
def HVXV75 : HVXV<"75", HVXV79>;
4951
def HVXV73 : HVXV<"73", HVXV75>;
5052
def HVXV71 : HVXV<"71", HVXV73>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,9 +2418,9 @@ def err_init_conversion_failed : Error<
24182418
"cannot initialize %select{a variable|a parameter|template parameter|"
24192419
"return object|statement expression result|an "
24202420
"exception object|a member subobject|an array element|a new value|a value|a "
2421-
"base class|a constructor delegation|a vector element|a block element|a "
2422-
"block element|a complex element|a lambda capture|a compound literal "
2423-
"initializer|a related result|a parameter of CF audited function|a "
2421+
"base class|a constructor delegation|a vector element|a matrix element|a "
2422+
"block element|a block element|a complex element|a lambda capture|a compound"
2423+
" literal initializer|a related result|a parameter of CF audited function|a "
24242424
"structured binding|a member subobject}0 "
24252425
"%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
24262426
"with an %select{rvalue|lvalue}2 of incompatible type}1,3"
@@ -6545,9 +6545,9 @@ def warn_extern_init : Warning<"'extern' variable has an initializer">,
65456545
def err_variable_object_no_init : Error<
65466546
"variable-sized object may not be initialized">;
65476547
def err_excess_initializers : Error<
6548-
"excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
6548+
"excess elements in %select{array|vector|matrix|scalar|union|struct}0 initializer">;
65496549
def ext_excess_initializers : ExtWarn<
6550-
"excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
6550+
"excess elements in %select{array|vector|matrix|scalar|union|struct}0 initializer">,
65516551
InGroup<ExcessInitializers>;
65526552
def err_excess_initializers_for_sizeless_type : Error<
65536553
"excess elements in initializer for indivisible sizeless type %0">;
@@ -13148,6 +13148,7 @@ def err_riscv_attribute_interrupt_requires_extension : Error<
1314813148
"RISC-V 'interrupt' attribute '%0' requires extension '%1'">;
1314913149
def err_riscv_attribute_interrupt_invalid_combination : Error<
1315013150
"RISC-V 'interrupt' attribute contains invalid combination of interrupt types">;
13151+
def err_riscv_builtin_invalid_twiden : Error<"RISC-V XSfmm twiden must be 1, 2 or 4">;
1315113152

1315213153
def err_std_source_location_impl_not_found : Error<
1315313154
"'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called">;

clang/include/clang/Basic/FileManager.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,12 @@ class FileManager : public RefCountedBase<FileManager> {
287287
/// If path is not absolute and FileSystemOptions set the working
288288
/// directory, the path is modified to be relative to the given
289289
/// working directory.
290-
/// \returns true if \c path changed.
291-
bool FixupRelativePath(SmallVectorImpl<char> &path) const;
290+
/// \returns true if \c Path changed.
291+
bool FixupRelativePath(SmallVectorImpl<char> &Path) const {
292+
return fixupRelativePath(FileSystemOpts, Path);
293+
}
294+
static bool fixupRelativePath(const FileSystemOptions &FileSystemOpts,
295+
SmallVectorImpl<char> &Path);
292296

293297
/// Makes \c Path absolute taking into account FileSystemOptions and the
294298
/// working directory option.

clang/include/clang/Basic/riscv_sifive_vector.td

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
include "riscv_vector_common.td"
1616

17+
class IsFloat<string type> {
18+
bit val = !or(!eq(type, "x"), !eq(type, "f"), !eq(type, "d"), !eq(type, "y"));
19+
}
20+
1721
//===----------------------------------------------------------------------===//
1822
// Instruction definitions
1923
//===----------------------------------------------------------------------===//
@@ -198,3 +202,169 @@ let ManualCodegen = [{
198202
defm sf_vfnrclip_xu_f_qf : RVVVFNRCLIPBuiltinSet<"Uv", "UvFqf", "c">;
199203
}
200204
}
205+
206+
multiclass RVVSFTileLoadStoreBuiltinSet<list<string> types,
207+
list<string> RequiredFeatures = []> {
208+
let OverloadedName = NAME,
209+
Name = NAME,
210+
IRName = NAME,
211+
Log2LMUL = [0],
212+
HasMasked = false,
213+
ManualCodegen = [{IntrinsicTypes = {Ops.back()->getType()};}] in
214+
foreach type = types in {
215+
let RequiredFeatures = !listconcat(RequiredFeatures,
216+
!cond(!eq(type, "x"): ["zvfhmin"],
217+
!eq(type, "y"): ["zvfbfmin"],
218+
true: []<string>)) in {
219+
def : RVVBuiltin<"e", "0zPCe", type>;
220+
if !not(IsFloat<type>.val) then
221+
def : RVVBuiltin<"Ue", "0zPCUe", type>;
222+
}
223+
}
224+
}
225+
226+
multiclass RVVSFTileMoveBuiltinSet<list<list<string>> suffixes_prototypes,
227+
list<int> intrinsic_types,
228+
string type,
229+
list<string> RequiredFeatures = []> {
230+
foreach sp = suffixes_prototypes in
231+
let RequiredFeatures = !listconcat(RequiredFeatures,
232+
!cond(!eq(type, "x"): ["zvfhmin"],
233+
!eq(type, "y"): ["zvfbfmin"],
234+
true: []<string>)),
235+
SupportOverloading = false,
236+
HasMasked = false,
237+
Name = NAME,
238+
IRName = NAME,
239+
HasVL = true,
240+
Log2LMUL = [3],
241+
IntrinsicTypes = intrinsic_types in
242+
def : RVVBuiltin<sp[0], sp[1], type>;
243+
}
244+
245+
multiclass RVVSFTileMoveVTBuiltinSet<list<string> RequiredFeatures = []> {
246+
foreach type = ["c", "s", "i", "l"] in
247+
defm NAME :
248+
RVVSFTileMoveBuiltinSet<[["v", "vz"], ["Uv", "Uvz"]], [-1], type,
249+
RequiredFeatures>;
250+
foreach type = ["x", "y", "f", "d"] in
251+
defm NAME :
252+
RVVSFTileMoveBuiltinSet<[["v", "vz"]], [-1], type, RequiredFeatures>;
253+
}
254+
255+
multiclass RVVSFTileMoveTVBuiltinSet<list<string> RequiredFeatures = []> {
256+
let SupportOverloading = true, OverloadedName = NAME in {
257+
foreach type = ["c", "s", "i", "l"] in
258+
defm NAME :
259+
RVVSFTileMoveBuiltinSet<[["v", "0zv"], ["Uv", "0zUv"]], [1], type,
260+
RequiredFeatures>;
261+
foreach type = ["x", "y", "f", "d"] in
262+
defm NAME :
263+
RVVSFTileMoveBuiltinSet<[["v", "0zv"]], [1], type, RequiredFeatures>;
264+
}
265+
}
266+
267+
multiclass RVVOp0Op1Op2BuiltinSet<string intrinsic_name, string type_range,
268+
list<list<string>> suffixes_prototypes>
269+
: RVVBuiltinSet<intrinsic_name, type_range, suffixes_prototypes, [0, 1, 2]>;
270+
271+
multiclass RVVSFMatMulBuiltinSet<string prototype, string suffix,
272+
string type_range, list<int> widens> {
273+
foreach widen = widens in
274+
let OverloadedName = NAME,
275+
TWiden = widen,
276+
HasVL = false,
277+
Log2LMUL = [3],
278+
HasMasked = false in
279+
defm NAME : RVVOp0Op1Op2BuiltinSet<NAME, type_range,
280+
[[!strconcat("w", !cast<string>(widen)), suffix, prototype]]>;
281+
}
282+
283+
multiclass RVVSFMatMulFloatBuiltinSet<string name, string prototype, string suffix,
284+
list<string> type_range, int widen> {
285+
// Currently the XSfmm spec doesn't support w8.
286+
foreach type = type_range in
287+
let OverloadedName = name # !strconcat("_w", !cast<string>(widen)),
288+
TWiden = widen,
289+
HasVL = false,
290+
Log2LMUL = [3],
291+
Name = name # "_" # !strconcat("w", !cast<string>(widen)),
292+
HasMasked = false in
293+
defm : RVVOp0Op1BuiltinSet<name, type, [["", suffix, prototype]]>;
294+
}
295+
296+
multiclass RVVSFVTZeroBuiltinSet {
297+
let SupportOverloading = false,
298+
HasVL = false,
299+
HasMasked = false,
300+
Name = NAME,
301+
IRName = NAME,
302+
Log2LMUL = [0] in
303+
defm : RVVOp0BuiltinSet<NAME, "i", [["", "", "0Kzzzzz"]]>;
304+
}
305+
306+
multiclass RVVSFVTDiscardBuiltinSet {
307+
let SupportOverloading = false,
308+
HasVL = false,
309+
HasMasked = false,
310+
Name = NAME,
311+
IRName = NAME,
312+
Log2LMUL = [0] in
313+
defm : RVVBuiltinSet<NAME, "i", [["", "", "0"]], []>;
314+
}
315+
316+
let RequiredFeatures = ["xsfmmbase"] in {
317+
let SupportOverloading = false,
318+
HasVL = false,
319+
HasMasked = false,
320+
Log2LMUL = [0],
321+
ManualCodegen = [{IntrinsicTypes = {ResultType};}] in // Set XLEN type
322+
{
323+
// let HasBuiltinAlias = false in
324+
def sf_vsettnt : RVVBuiltin<"", "zzKzKz", "i">;
325+
def sf_vsettm : RVVBuiltin<"", "zzKzKz", "i">;
326+
let IRName = "sf_vsettnt" in
327+
def sf_vsettn : RVVBuiltin<"", "zzKzKz", "i">;
328+
def sf_vsettk : RVVBuiltin<"", "zzKzKz", "i">;
329+
}
330+
defm sf_vtzero_t : RVVSFVTZeroBuiltinSet;
331+
defm sf_vtdiscard : RVVSFVTDiscardBuiltinSet;
332+
}
333+
334+
defm sf_vtmv_v_t : RVVSFTileMoveVTBuiltinSet<["xsfmmbase"]>;
335+
defm sf_vtmv_t_v : RVVSFTileMoveTVBuiltinSet<["xsfmmbase"]>;
336+
337+
defm sf_vlte8 : RVVSFTileLoadStoreBuiltinSet<["c"], ["xsfmmbase"]>;
338+
defm sf_vlte16 : RVVSFTileLoadStoreBuiltinSet<["s", "x", "y"], ["xsfmmbase"]>;
339+
defm sf_vlte32 : RVVSFTileLoadStoreBuiltinSet<["i", "f"], ["xsfmmbase"]>;
340+
defm sf_vlte64 : RVVSFTileLoadStoreBuiltinSet<["l", "d"], ["xsfmmbase"]>;
341+
342+
defm sf_vste8 : RVVSFTileLoadStoreBuiltinSet<["c"], ["xsfmmbase"]>;
343+
defm sf_vste16 : RVVSFTileLoadStoreBuiltinSet<["s", "x", "y"], ["xsfmmbase"]>;
344+
defm sf_vste32 : RVVSFTileLoadStoreBuiltinSet<["i", "f"], ["xsfmmbase"]>;
345+
defm sf_vste64 : RVVSFTileLoadStoreBuiltinSet<["l", "d"], ["xsfmmbase"]>;
346+
347+
let RequiredFeatures = ["xsfmm32a8i"] in {
348+
defm sf_mm_u_u : RVVSFMatMulBuiltinSet<"0KzUvUvzzz", "UvUv", "c", [4]>;
349+
defm sf_mm_s_u : RVVSFMatMulBuiltinSet<"0KzvUvzzz", "vUv", "c", [4]>;
350+
defm sf_mm_u_s : RVVSFMatMulBuiltinSet<"0KzUvvzzz", "Uvv", "c", [4]>;
351+
defm sf_mm_s_s : RVVSFMatMulBuiltinSet<"0Kzvvzzz", "vv", "c", [4]>;
352+
353+
}
354+
355+
let RequiredFeatures = ["xsfmm32a16f"] in
356+
defm : RVVSFMatMulFloatBuiltinSet<"sf_mm_f_f", "0Kzvvzzz", "v", ["x", "y"], 2>;
357+
358+
let RequiredFeatures = ["xsfmm32a32f"] in
359+
defm : RVVSFMatMulFloatBuiltinSet<"sf_mm_f_f", "0Kzvvzzz", "v", ["f"], 1>;
360+
361+
let RequiredFeatures = ["xsfmm32a8f"] in
362+
foreach e1 = [5, 4] in
363+
foreach e2 = [5, 4] in
364+
let OverloadedName = "sf_mm_e" # e1 # "m" # !sub(7, e1) # "_e" # e2 # "m" # !sub(7, e2) in
365+
defm : RVVSFMatMulFloatBuiltinSet<
366+
"sf_mm_e" # e1 # "m" # !sub(7, e1) # "_e" # e2 # "m" # !sub(7, e2),
367+
"0KzUvUvzzz", "UvUv", ["c"], 4>;
368+
369+
let RequiredFeatures = ["xsfmm64a64f"] in
370+
defm : RVVSFMatMulFloatBuiltinSet<"sf_mm_f_f", "0Kzvvzzz", "v", ["d"], 1>;

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ class RVVBuiltin<string suffix, string prototype, string type_range,
247247
// Set to true if the builtin has a parameter that models floating-point
248248
// rounding mode control
249249
bit HasFRMRoundModeOp = false;
250+
251+
// TWiden for XSfmm.
252+
int TWiden = 0;
250253
}
251254

252255
// This is the code emitted in the header.

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ struct MissingFeatures {
231231
static bool coverageMapping() { return false; }
232232
static bool createInvariantGroup() { return false; }
233233
static bool createProfileWeightsForLoop() { return false; }
234+
static bool ctorConstLvalueToRvalueConversion() { return false; }
234235
static bool ctorMemcpyizer() { return false; }
235236
static bool cudaSupport() { return false; }
236237
static bool cxxRecordStaticMembers() { return false; }
@@ -240,6 +241,7 @@ struct MissingFeatures {
240241
static bool dataLayoutPtrHandlingBasedOnLangAS() { return false; }
241242
static bool deferredCXXGlobalInit() { return false; }
242243
static bool deleteArray() { return false; }
244+
static bool devirtualizeDestructor() { return false; }
243245
static bool devirtualizeMemberFunction() { return false; }
244246
static bool ehCleanupFlags() { return false; }
245247
static bool ehCleanupHasPrebranchedFallthrough() { return false; }

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6710,6 +6710,8 @@ def mv75 : Flag<["-"], "mv75">, Group<m_hexagon_Features_Group>,
67106710
Alias<mcpu_EQ>, AliasArgs<["hexagonv75"]>;
67116711
def mv79 : Flag<["-"], "mv79">, Group<m_hexagon_Features_Group>,
67126712
Alias<mcpu_EQ>, AliasArgs<["hexagonv79"]>;
6713+
def mv81 : Flag<["-"], "mv81">, Group<m_hexagon_Features_Group>,
6714+
Alias<mcpu_EQ>, AliasArgs<["hexagonv81"]>;
67136715
def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
67146716
HelpText<"Enable Hexagon Vector eXtensions">;
67156717
def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,

clang/include/clang/Sema/Initialization.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ class alignas(8) InitializedEntity {
9191
/// or vector.
9292
EK_VectorElement,
9393

94+
/// The entity being initialized is an element of a matrix.
95+
/// or matrix.
96+
EK_MatrixElement,
97+
9498
/// The entity being initialized is a field of block descriptor for
9599
/// the copied-in c++ object.
96100
EK_BlockElement,
@@ -205,8 +209,8 @@ class alignas(8) InitializedEntity {
205209
/// virtual base.
206210
llvm::PointerIntPair<const CXXBaseSpecifier *, 1> Base;
207211

208-
/// When Kind == EK_ArrayElement, EK_VectorElement, or
209-
/// EK_ComplexElement, the index of the array or vector element being
212+
/// When Kind == EK_ArrayElement, EK_VectorElement, EK_MatrixElement,
213+
/// or EK_ComplexElement, the index of the array or vector element being
210214
/// initialized.
211215
unsigned Index;
212216

@@ -536,15 +540,15 @@ class alignas(8) InitializedEntity {
536540
/// element's index.
537541
unsigned getElementIndex() const {
538542
assert(getKind() == EK_ArrayElement || getKind() == EK_VectorElement ||
539-
getKind() == EK_ComplexElement);
543+
getKind() == EK_MatrixElement || getKind() == EK_ComplexElement);
540544
return Index;
541545
}
542546

543547
/// If this is already the initializer for an array or vector
544548
/// element, sets the element index.
545549
void setElementIndex(unsigned Index) {
546550
assert(getKind() == EK_ArrayElement || getKind() == EK_VectorElement ||
547-
getKind() == EK_ComplexElement);
551+
getKind() == EK_MatrixElement || getKind() == EK_ComplexElement);
548552
this->Index = Index;
549553
}
550554

clang/include/clang/Support/RISCVVIntrinsicUtils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ class RVVIntrinsic {
402402
std::vector<int64_t> IntrinsicTypes;
403403
unsigned NF = 1;
404404
Policy PolicyAttrs;
405+
unsigned TWiden = 0;
405406

406407
public:
407408
RVVIntrinsic(llvm::StringRef Name, llvm::StringRef Suffix,
@@ -410,8 +411,8 @@ class RVVIntrinsic {
410411
bool HasVL, PolicyScheme Scheme, bool SupportOverloading,
411412
bool HasBuiltinAlias, llvm::StringRef ManualCodegen,
412413
const RVVTypes &Types,
413-
const std::vector<int64_t> &IntrinsicTypes,
414-
unsigned NF, Policy PolicyAttrs, bool HasFRMRoundModeOp);
414+
const std::vector<int64_t> &IntrinsicTypes, unsigned NF,
415+
Policy PolicyAttrs, bool HasFRMRoundModeOp, unsigned TWiden);
415416
~RVVIntrinsic() = default;
416417

417418
RVVTypePtr getOutputType() const { return OutputType; }
@@ -435,6 +436,7 @@ class RVVIntrinsic {
435436
llvm::StringRef getManualCodegen() const { return ManualCodegen; }
436437
PolicyScheme getPolicyScheme() const { return Scheme; }
437438
unsigned getNF() const { return NF; }
439+
unsigned getTWiden() const { return TWiden; }
438440
const std::vector<int64_t> &getIntrinsicTypes() const {
439441
return IntrinsicTypes;
440442
}

0 commit comments

Comments
 (0)