Skip to content

Commit 6613e19

Browse files
Merge branch 'main' into vinay-issue-120736
2 parents 0be1017 + 7d166fa commit 6613e19

File tree

325 files changed

+14018
-2279
lines changed

Some content is hidden

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

325 files changed

+14018
-2279
lines changed

clang/include/clang/Basic/BuiltinsHexagon.def

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
1818
#endif
1919

20+
#pragma push_macro("V79")
21+
#define V79 "v79"
2022
#pragma push_macro("V75")
21-
#define V75 "v75"
23+
#define V75 "v75|" V79
2224
#pragma push_macro("V73")
2325
#define V73 "v73|" V75
2426
#pragma push_macro("V71")
@@ -42,8 +44,10 @@
4244
#pragma push_macro("V5")
4345
#define V5 "v5|" V55
4446

47+
#pragma push_macro("HVXV79")
48+
#define HVXV79 "hvxv79"
4549
#pragma push_macro("HVXV75")
46-
#define HVXV75 "hvxv75"
50+
#define HVXV75 "hvxv75|" HVXV79
4751
#pragma push_macro("HVXV73")
4852
#define HVXV73 "hvxv73|" HVXV75
4953
#pragma push_macro("HVXV71")
@@ -148,6 +152,7 @@ TARGET_BUILTIN(__builtin_HEXAGON_V6_vrmpyub_rtt_acc_128B,"V64iV64iV32iLLi","", "
148152
#pragma pop_macro("HVXV71")
149153
#pragma pop_macro("HVXV73")
150154
#pragma pop_macro("HVXV75")
155+
#pragma pop_macro("HVXV79")
151156

152157
#pragma pop_macro("V5")
153158
#pragma pop_macro("V55")
@@ -161,6 +166,7 @@ TARGET_BUILTIN(__builtin_HEXAGON_V6_vrmpyub_rtt_acc_128B,"V64iV64iV32iLLi","", "
161166
#pragma pop_macro("V71")
162167
#pragma pop_macro("V73")
163168
#pragma pop_macro("V75")
169+
#pragma pop_macro("V79")
164170

165171
#undef BUILTIN
166172
#undef TARGET_BUILTIN

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6226,6 +6226,8 @@ def mv73 : Flag<["-"], "mv73">, Group<m_hexagon_Features_Group>,
62266226
Alias<mcpu_EQ>, AliasArgs<["hexagonv73"]>;
62276227
def mv75 : Flag<["-"], "mv75">, Group<m_hexagon_Features_Group>,
62286228
Alias<mcpu_EQ>, AliasArgs<["hexagonv75"]>;
6229+
def mv79 : Flag<["-"], "mv79">, Group<m_hexagon_Features_Group>,
6230+
Alias<mcpu_EQ>, AliasArgs<["hexagonv79"]>;
62296231
def mhexagon_hvx : Flag<["-"], "mhvx">, Group<m_hexagon_Features_HVX_Group>,
62306232
HelpText<"Enable Hexagon Vector eXtensions">;
62316233
def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">,

clang/lib/Basic/Targets/Hexagon.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
8181
} else if (CPU == "hexagonv75") {
8282
Builder.defineMacro("__HEXAGON_V75__");
8383
Builder.defineMacro("__HEXAGON_ARCH__", "75");
84+
} else if (CPU == "hexagonv79") {
85+
Builder.defineMacro("__HEXAGON_V79__");
86+
Builder.defineMacro("__HEXAGON_ARCH__", "79");
8487
}
8588

8689
if (hasFeature("hvx-length64b")) {
@@ -239,6 +242,7 @@ static constexpr CPUSuffix Suffixes[] = {
239242
{{"hexagonv68"}, {"68"}}, {{"hexagonv69"}, {"69"}},
240243
{{"hexagonv71"}, {"71"}}, {{"hexagonv71t"}, {"71t"}},
241244
{{"hexagonv73"}, {"73"}}, {{"hexagonv75"}, {"75"}},
245+
{{"hexagonv79"}, {"79"}},
242246
};
243247

244248
std::optional<unsigned> HexagonTargetInfo::getHexagonCPURev(StringRef Name) {

clang/lib/Basic/Targets/OSTargets.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,9 @@ template <typename Target>
790790
class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo<Target> {
791791
protected:
792792
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
793-
MacroBuilder &Builder) const override {}
793+
MacroBuilder &Builder) const override {
794+
Builder.defineMacro("__UEFI__");
795+
}
794796

795797
public:
796798
UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)

clang/lib/CodeGen/Targets/AArch64.cpp

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class AArch64ABIInfo : public ABIInfo {
5252

5353
bool isIllegalVectorType(QualType Ty) const;
5454

55+
bool passAsAggregateType(QualType Ty) const;
5556
bool passAsPureScalableType(QualType Ty, unsigned &NV, unsigned &NP,
5657
SmallVectorImpl<llvm::Type *> &CoerceToSeq) const;
5758

@@ -337,6 +338,10 @@ ABIArgInfo AArch64ABIInfo::coerceAndExpandPureScalableAggregate(
337338
NSRN += NVec;
338339
NPRN += NPred;
339340

341+
// Handle SVE vector tuples.
342+
if (Ty->isSVESizelessBuiltinType())
343+
return ABIArgInfo::getDirect();
344+
340345
llvm::Type *UnpaddedCoerceToType =
341346
UnpaddedCoerceToSeq.size() == 1
342347
? UnpaddedCoerceToSeq[0]
@@ -362,7 +367,7 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn,
362367
if (isIllegalVectorType(Ty))
363368
return coerceIllegalVector(Ty, NSRN, NPRN);
364369

365-
if (!isAggregateTypeForABI(Ty)) {
370+
if (!passAsAggregateType(Ty)) {
366371
// Treat an enum type as its underlying type.
367372
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
368373
Ty = EnumTy->getDecl()->getIntegerType();
@@ -417,7 +422,7 @@ ABIArgInfo AArch64ABIInfo::classifyArgumentType(QualType Ty, bool IsVariadicFn,
417422
// elsewhere for GNU compatibility.
418423
uint64_t Size = getContext().getTypeSize(Ty);
419424
bool IsEmpty = isEmptyRecord(getContext(), Ty, true);
420-
if (IsEmpty || Size == 0) {
425+
if (!Ty->isSVESizelessBuiltinType() && (IsEmpty || Size == 0)) {
421426
if (!getContext().getLangOpts().CPlusPlus || isDarwinPCS())
422427
return ABIArgInfo::getIgnore();
423428

@@ -504,7 +509,7 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(QualType RetTy,
504509
if (RetTy->isVectorType() && getContext().getTypeSize(RetTy) > 128)
505510
return getNaturalAlignIndirect(RetTy);
506511

507-
if (!isAggregateTypeForABI(RetTy)) {
512+
if (!passAsAggregateType(RetTy)) {
508513
// Treat an enum type as its underlying type.
509514
if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
510515
RetTy = EnumTy->getDecl()->getIntegerType();
@@ -519,7 +524,8 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(QualType RetTy,
519524
}
520525

521526
uint64_t Size = getContext().getTypeSize(RetTy);
522-
if (isEmptyRecord(getContext(), RetTy, true) || Size == 0)
527+
if (!RetTy->isSVESizelessBuiltinType() &&
528+
(isEmptyRecord(getContext(), RetTy, true) || Size == 0))
523529
return ABIArgInfo::getIgnore();
524530

525531
const Type *Base = nullptr;
@@ -654,6 +660,15 @@ bool AArch64ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate()
654660
return true;
655661
}
656662

663+
bool AArch64ABIInfo::passAsAggregateType(QualType Ty) const {
664+
if (Kind == AArch64ABIKind::AAPCS && Ty->isSVESizelessBuiltinType()) {
665+
const auto *BT = Ty->getAs<BuiltinType>();
666+
return !BT->isSVECount() &&
667+
getContext().getBuiltinVectorTypeInfo(BT).NumVectors > 1;
668+
}
669+
return isAggregateTypeForABI(Ty);
670+
}
671+
657672
// Check if a type needs to be passed in registers as a Pure Scalable Type (as
658673
// defined by AAPCS64). Return the number of data vectors and the number of
659674
// predicate vectors in the type, into `NVec` and `NPred`, respectively. Upon
@@ -719,37 +734,38 @@ bool AArch64ABIInfo::passAsPureScalableType(
719734
return true;
720735
}
721736

722-
const auto *VT = Ty->getAs<VectorType>();
723-
if (!VT)
724-
return false;
737+
if (const auto *VT = Ty->getAs<VectorType>()) {
738+
if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
739+
++NPred;
740+
if (CoerceToSeq.size() + 1 > 12)
741+
return false;
742+
CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
743+
return true;
744+
}
725745

726-
if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
727-
++NPred;
728-
if (CoerceToSeq.size() + 1 > 12)
729-
return false;
730-
CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
731-
return true;
732-
}
746+
if (VT->getVectorKind() == VectorKind::SveFixedLengthData) {
747+
++NVec;
748+
if (CoerceToSeq.size() + 1 > 12)
749+
return false;
750+
CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
751+
return true;
752+
}
733753

734-
if (VT->getVectorKind() == VectorKind::SveFixedLengthData) {
735-
++NVec;
736-
if (CoerceToSeq.size() + 1 > 12)
737-
return false;
738-
CoerceToSeq.push_back(convertFixedToScalableVectorType(VT));
739-
return true;
754+
return false;
740755
}
741756

742-
if (!VT->isBuiltinType())
757+
if (!Ty->isBuiltinType())
743758
return false;
744759

745-
switch (cast<BuiltinType>(VT)->getKind()) {
760+
bool isPredicate;
761+
switch (Ty->getAs<BuiltinType>()->getKind()) {
746762
#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
747763
case BuiltinType::Id: \
748-
++NVec; \
764+
isPredicate = false; \
749765
break;
750766
#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
751767
case BuiltinType::Id: \
752-
++NPred; \
768+
isPredicate = true; \
753769
break;
754770
#define SVE_TYPE(Name, Id, SingletonId)
755771
#include "clang/Basic/AArch64SVEACLETypes.def"
@@ -761,6 +777,10 @@ bool AArch64ABIInfo::passAsPureScalableType(
761777
getContext().getBuiltinVectorTypeInfo(cast<BuiltinType>(Ty));
762778
assert(Info.NumVectors > 0 && Info.NumVectors <= 4 &&
763779
"Expected 1, 2, 3 or 4 vectors!");
780+
if (isPredicate)
781+
NPred += Info.NumVectors;
782+
else
783+
NVec += Info.NumVectors;
764784
auto VTy = llvm::ScalableVectorType::get(CGT.ConvertType(Info.ElementType),
765785
Info.EC.getKnownMinValue());
766786

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
15611561
StaticRuntimes.push_back("ubsan_minimal");
15621562
} else {
15631563
StaticRuntimes.push_back("ubsan_standalone");
1564-
if (SanArgs.linkCXXRuntimes())
1565-
StaticRuntimes.push_back("ubsan_standalone_cxx");
15661564
}
15671565
}
15681566
if (SanArgs.needsSafeStackRt()) {
@@ -1572,11 +1570,13 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
15721570
if (!(SanArgs.needsSharedRt() && SanArgs.needsUbsanRt())) {
15731571
if (SanArgs.needsCfiRt())
15741572
StaticRuntimes.push_back("cfi");
1575-
if (SanArgs.needsCfiDiagRt()) {
1573+
if (SanArgs.needsCfiDiagRt())
15761574
StaticRuntimes.push_back("cfi_diag");
1577-
if (SanArgs.linkCXXRuntimes())
1578-
StaticRuntimes.push_back("ubsan_standalone_cxx");
1579-
}
1575+
}
1576+
if (SanArgs.linkCXXRuntimes() && !SanArgs.requiresMinimalRuntime() &&
1577+
((!SanArgs.needsSharedRt() && SanArgs.needsUbsanRt()) ||
1578+
SanArgs.needsCfiDiagRt())) {
1579+
StaticRuntimes.push_back("ubsan_standalone_cxx");
15801580
}
15811581
if (SanArgs.needsStatsRt()) {
15821582
NonWholeStaticRuntimes.push_back("stats");

clang/lib/Headers/avx10_2_512convertintrin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,13 @@ static __inline __m512h __DEFAULT_FN_ATTRS512 _mm512_cvtpbf8_ph(__m256i __A) {
308308
}
309309

310310
static __inline __m512h __DEFAULT_FN_ATTRS512
311-
_mm512_mask_cvtpbf8_ph(__m512h __S, __mmask16 __U, __m256i __A) {
311+
_mm512_mask_cvtpbf8_ph(__m512h __S, __mmask32 __U, __m256i __A) {
312312
return _mm512_castsi512_ph(
313313
_mm512_mask_slli_epi16((__m512i)__S, __U, _mm512_cvtepi8_epi16(__A), 8));
314314
}
315315

316316
static __inline __m512h __DEFAULT_FN_ATTRS512
317-
_mm512_maskz_cvtpbf8_ph(__mmask16 __U, __m256i __A) {
317+
_mm512_maskz_cvtpbf8_ph(__mmask32 __U, __m256i __A) {
318318
return _mm512_castsi512_ph(
319319
_mm512_slli_epi16(_mm512_maskz_cvtepi8_epi16(__U, __A), 8));
320320
}

clang/lib/Headers/avx10_2convertintrin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,13 @@ static __inline__ __m256h __DEFAULT_FN_ATTRS256 _mm256_cvtpbf8_ph(__m128i __A) {
580580
}
581581

582582
static __inline__ __m256h __DEFAULT_FN_ATTRS256
583-
_mm256_mask_cvtpbf8_ph(__m256h __S, __mmask8 __U, __m128i __A) {
583+
_mm256_mask_cvtpbf8_ph(__m256h __S, __mmask16 __U, __m128i __A) {
584584
return _mm256_castsi256_ph(
585585
_mm256_mask_slli_epi16((__m256i)__S, __U, _mm256_cvtepi8_epi16(__A), 8));
586586
}
587587

588588
static __inline__ __m256h __DEFAULT_FN_ATTRS256
589-
_mm256_maskz_cvtpbf8_ph(__mmask8 __U, __m128i __A) {
589+
_mm256_maskz_cvtpbf8_ph(__mmask16 __U, __m128i __A) {
590590
return _mm256_castsi256_ph(
591591
_mm256_slli_epi16(_mm256_maskz_cvtepi8_epi16(__U, __A), 8));
592592
}

0 commit comments

Comments
 (0)