Skip to content

Commit b2a0abc

Browse files
authored
Merge branch 'main' into warning
2 parents 3a2b57b + a91ebcd commit b2a0abc

File tree

283 files changed

+12472
-7156
lines changed

Some content is hidden

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

283 files changed

+12472
-7156
lines changed

clang/include/clang/Basic/AArch64SVEACLETypes.def

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@
9797
SVE_TYPE(Name, Id, SingletonId)
9898
#endif
9999

100+
#ifndef AARCH64_VECTOR_TYPE
101+
#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
102+
SVE_TYPE(Name, Id, SingletonId)
103+
#endif
104+
105+
#ifndef AARCH64_VECTOR_TYPE_MFLOAT
106+
#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, ElBits, NF) \
107+
AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId)
108+
#endif
109+
110+
100111
//===- Vector point types -----------------------------------------------===//
101112

102113
SVE_VECTOR_TYPE_INT("__SVInt8_t", "__SVInt8_t", SveInt8, SveInt8Ty, 16, 8, 1, true)
@@ -190,11 +201,16 @@ SVE_PREDICATE_TYPE_ALL("__clang_svboolx4_t", "svboolx4_t", SveBoolx4, SveBoolx4T
190201

191202
SVE_OPAQUE_TYPE("__SVCount_t", "__SVCount_t", SveCount, SveCountTy)
192203

204+
AARCH64_VECTOR_TYPE_MFLOAT("__MFloat8x8_t", "__MFloat8x8_t", MFloat8x8, MFloat8x8Ty, 8, 8, 1)
205+
AARCH64_VECTOR_TYPE_MFLOAT("__MFloat8x16_t", "__MFloat8x16_t", MFloat8x16, MFloat8x16Ty, 16, 8, 1)
206+
193207
#undef SVE_VECTOR_TYPE
194208
#undef SVE_VECTOR_TYPE_BFLOAT
195209
#undef SVE_VECTOR_TYPE_FLOAT
196210
#undef SVE_VECTOR_TYPE_INT
197211
#undef SVE_PREDICATE_TYPE
198212
#undef SVE_PREDICATE_TYPE_ALL
199213
#undef SVE_OPAQUE_TYPE
214+
#undef AARCH64_VECTOR_TYPE_MFLOAT
215+
#undef AARCH64_VECTOR_TYPE
200216
#undef SVE_TYPE

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ def err_sls_hardening_arm_not_supported : Error<
502502
def warn_drv_large_data_threshold_invalid_code_model: Warning<
503503
"'%0' only applies to medium and large code models">,
504504
InGroup<UnusedCommandLineArgument>;
505+
def warn_drv_math_errno_enabled_after_veclib: Warning<
506+
"math errno enabled by '%0' after it was implicitly disabled by '%1',"
507+
" this may limit the utilization of the vector library">,
508+
InGroup<MathErrnoEnabledWithVecLib>;
505509

506510
def note_drv_command_failed_diag_msg : Note<
507511
"diagnostic msg: %0">;

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def FloatZeroConversion : DiagGroup<"float-zero-conversion">;
125125
def FloatConversion :
126126
DiagGroup<"float-conversion", [FloatOverflowConversion,
127127
FloatZeroConversion]>;
128+
def MathErrnoEnabledWithVecLib : DiagGroup<"math-errno-enabled-with-veclib">;
128129

129130
def FrameAddress : DiagGroup<"frame-address">;
130131
def FreeNonHeapObject : DiagGroup<"free-nonheap-object">;

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,6 +3411,9 @@ def fno_experimental_isel : Flag<["-"], "fno-experimental-isel">, Group<f_clang_
34113411
def fveclib : Joined<["-"], "fveclib=">, Group<f_Group>,
34123412
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
34133413
HelpText<"Use the given vector functions library">,
3414+
HelpTextForVariants<[ClangOption, CC1Option],
3415+
"Use the given vector functions library. "
3416+
"Note: -fveclib={ArmPL,SLEEF} implies -fno-math-errno">,
34143417
Values<"Accelerate,libmvec,MASSV,SVML,SLEEF,Darwin_libsystem_m,ArmPL,AMDLIBM,none">,
34153418
NormalizedValuesScope<"llvm::driver::VectorLibrary">,
34163419
NormalizedValues<["Accelerate", "LIBMVEC", "MASSV", "SVML", "SLEEF",
@@ -5394,6 +5397,10 @@ def mfrecipe : Flag<["-"], "mfrecipe">, Group<m_loongarch_Features_Group>,
53945397
HelpText<"Enable frecipe.{s/d} and frsqrte.{s/d}">;
53955398
def mno_frecipe : Flag<["-"], "mno-frecipe">, Group<m_loongarch_Features_Group>,
53965399
HelpText<"Disable frecipe.{s/d} and frsqrte.{s/d}">;
5400+
def mlam_bh : Flag<["-"], "mlam-bh">, Group<m_loongarch_Features_Group>,
5401+
HelpText<"Enable amswap_[db].{b/h} and amadd_[db].{b/h}">;
5402+
def mno_lam_bh : Flag<["-"], "mno-lam-bh">, Group<m_loongarch_Features_Group>,
5403+
HelpText<"Disable amswap_[db].{b/h} and amadd_[db].{b/h}">;
53975404
def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group<m_loongarch_Features_Group>,
53985405
HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">;
53995406
def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group<m_loongarch_Features_Group>,

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ enum PredefinedTypeIDs {
11491149
///
11501150
/// Type IDs for non-predefined types will start at
11511151
/// NUM_PREDEF_TYPE_IDs.
1152-
const unsigned NUM_PREDEF_TYPE_IDS = 509;
1152+
const unsigned NUM_PREDEF_TYPE_IDS = 511;
11531153

11541154
// Ensure we do not overrun the predefined types we reserved
11551155
// in the enum PredefinedTypeIDs above.

clang/lib/AST/ASTContext.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,12 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
22392239
Width = 0; \
22402240
Align = 16; \
22412241
break;
2242+
#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
2243+
ElBits, NF) \
2244+
case BuiltinType::Id: \
2245+
Width = NumEls * ElBits * NF; \
2246+
Align = NumEls * ElBits; \
2247+
break;
22422248
#include "clang/Basic/AArch64SVEACLETypes.def"
22432249
#define PPC_VECTOR_TYPE(Name, Id, Size) \
22442250
case BuiltinType::Id: \
@@ -4361,6 +4367,11 @@ ASTContext::getBuiltinVectorTypeInfo(const BuiltinType *Ty) const {
43614367
#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
43624368
case BuiltinType::Id: \
43634369
return {BoolTy, llvm::ElementCount::getScalable(NumEls), NF};
4370+
#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4371+
ElBits, NF) \
4372+
case BuiltinType::Id: \
4373+
return {getIntTypeForBitwidth(ElBits, false), \
4374+
llvm::ElementCount::getFixed(NumEls), NF};
43644375
#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId)
43654376
#include "clang/Basic/AArch64SVEACLETypes.def"
43664377

@@ -4427,6 +4438,7 @@ QualType ASTContext::getScalableVectorType(QualType EltTy, unsigned NumElts,
44274438
if (EltTy->isBooleanType() && NumElts == (NumEls * NF) && NumFields == 1) \
44284439
return SingletonId;
44294440
#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId)
4441+
#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId)
44304442
#include "clang/Basic/AArch64SVEACLETypes.def"
44314443
} else if (Target->hasRISCVVTypes()) {
44324444
uint64_t EltTySize = getTypeSize(EltTy);

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,11 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
34303430
type_name = MangledName; \
34313431
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
34323432
break;
3433+
#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
3434+
case BuiltinType::Id: \
3435+
type_name = MangledName; \
3436+
Out << (type_name == Name ? "u" : "") << type_name.size() << type_name; \
3437+
break;
34333438
#include "clang/Basic/AArch64SVEACLETypes.def"
34343439
#define PPC_VECTOR_TYPE(Name, Id, Size) \
34353440
case BuiltinType::Id: \

clang/lib/AST/Type.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,9 +2484,19 @@ bool Type::isSVESizelessBuiltinType() const {
24842484
if (const BuiltinType *BT = getAs<BuiltinType>()) {
24852485
switch (BT->getKind()) {
24862486
// SVE Types
2487-
#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2487+
#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2488+
case BuiltinType::Id: \
2489+
return true;
2490+
#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2491+
case BuiltinType::Id: \
2492+
return true;
2493+
#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2494+
case BuiltinType::Id: \
2495+
return true;
2496+
#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2497+
case BuiltinType::Id: \
2498+
return false;
24882499
#include "clang/Basic/AArch64SVEACLETypes.def"
2489-
return true;
24902500
default:
24912501
return false;
24922502
}

clang/lib/Basic/Targets/LoongArch.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts,
205205
// TODO: As more features of the V1.1 ISA are supported, a unified "v1.1"
206206
// arch feature set will be used to include all sub-features belonging to
207207
// the V1.1 ISA version.
208-
if (HasFeatureFrecipe)
208+
if (HasFeatureFrecipe && HasFeatureLAM_BH)
209209
Builder.defineMacro("__loongarch_arch",
210210
Twine('"') + "la64v1.1" + Twine('"'));
211211
else
@@ -236,6 +236,9 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts,
236236
if (HasFeatureFrecipe)
237237
Builder.defineMacro("__loongarch_frecipe", Twine(1));
238238

239+
if (HasFeatureLAM_BH)
240+
Builder.defineMacro("__loongarch_lam_bh", Twine(1));
241+
239242
StringRef ABI = getABI();
240243
if (ABI == "lp64d" || ABI == "lp64f" || ABI == "lp64s")
241244
Builder.defineMacro("__loongarch_lp64");
@@ -312,6 +315,8 @@ bool LoongArchTargetInfo::handleTargetFeatures(
312315
HasUnalignedAccess = false;
313316
else if (Feature == "+frecipe")
314317
HasFeatureFrecipe = true;
318+
else if (Feature == "+lam-bh")
319+
HasFeatureLAM_BH = true;
315320
}
316321
return true;
317322
}

clang/lib/Basic/Targets/LoongArch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
3030
bool HasFeatureLSX;
3131
bool HasFeatureLASX;
3232
bool HasFeatureFrecipe;
33+
bool HasFeatureLAM_BH;
3334

3435
public:
3536
LoongArchTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
@@ -39,6 +40,7 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
3940
HasFeatureLSX = false;
4041
HasFeatureLASX = false;
4142
HasFeatureFrecipe = false;
43+
HasFeatureLAM_BH = false;
4244
LongDoubleWidth = 128;
4345
LongDoubleAlign = 128;
4446
LongDoubleFormat = &llvm::APFloat::IEEEquad();

0 commit comments

Comments
 (0)