Skip to content

Commit 9b93ba6

Browse files
committed
merge main into amd-staging
2 parents f392ebc + 1a0121c commit 9b93ba6

File tree

267 files changed

+7716
-2046
lines changed

Some content is hidden

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

267 files changed

+7716
-2046
lines changed

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ TARGET_BUILTIN(__builtin_amdgcn_exp2_bf16, "yy", "nc", "bf16-trans-insts")
702702
TARGET_BUILTIN(__builtin_amdgcn_sin_bf16, "yy", "nc", "bf16-trans-insts")
703703
TARGET_BUILTIN(__builtin_amdgcn_cos_bf16, "yy", "nc", "bf16-trans-insts")
704704

705+
TARGET_BUILTIN(__builtin_amdgcn_cvt_sr_pk_bf16_f32, "V2yffi", "nc", "bf16-cvt-insts")
705706
TARGET_BUILTIN(__builtin_amdgcn_cvt_f16_fp8, "hiIi", "nc", "gfx1250-insts")
706707
TARGET_BUILTIN(__builtin_amdgcn_cvt_f16_bf8, "hiIi", "nc", "gfx1250-insts")
707708
TARGET_BUILTIN(__builtin_amdgcn_cvt_pk_f16_fp8, "V2hs", "nc", "gfx1250-insts")

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5450,6 +5450,8 @@ def mextended_const : Flag<["-"], "mextended-const">, Group<m_wasm_Features_Grou
54505450
def mno_extended_const : Flag<["-"], "mno-extended-const">, Group<m_wasm_Features_Group>;
54515451
def mfp16 : Flag<["-"], "mfp16">, Group<m_wasm_Features_Group>;
54525452
def mno_fp16 : Flag<["-"], "mno-fp16">, Group<m_wasm_Features_Group>;
5453+
def mgc : Flag<["-"], "mgc">, Group<m_wasm_Features_Group>;
5454+
def mno_gc : Flag<["-"], "mno-gc">, Group<m_wasm_Features_Group>;
54535455
def mmultimemory : Flag<["-"], "mmultimemory">, Group<m_wasm_Features_Group>;
54545456
def mno_multimemory : Flag<["-"], "mno-multimemory">, Group<m_wasm_Features_Group>;
54555457
def mmultivalue : Flag<["-"], "mmultivalue">, Group<m_wasm_Features_Group>;

clang/lib/AST/Decl.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5988,11 +5988,10 @@ bool clang::IsArmStreamingFunction(const FunctionDecl *FD,
59885988
if (FD->hasAttr<ArmLocallyStreamingAttr>())
59895989
return true;
59905990

5991-
if (const Type *Ty = FD->getType().getTypePtrOrNull())
5992-
if (const auto *FPT = Ty->getAs<FunctionProtoType>())
5993-
if (FPT->getAArch64SMEAttributes() &
5994-
FunctionType::SME_PStateSMEnabledMask)
5995-
return true;
5991+
assert(!FD->getType().isNull() && "Expected a valid FunctionDecl");
5992+
if (const auto *FPT = FD->getType()->getAs<FunctionProtoType>())
5993+
if (FPT->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
5994+
return true;
59965995

59975996
return false;
59985997
}

clang/lib/Basic/Targets/WebAssembly.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
5959
.Case("exception-handling", HasExceptionHandling)
6060
.Case("extended-const", HasExtendedConst)
6161
.Case("fp16", HasFP16)
62+
.Case("gc", HasGC)
6263
.Case("multimemory", HasMultiMemory)
6364
.Case("multivalue", HasMultivalue)
6465
.Case("mutable-globals", HasMutableGlobals)
6566
.Case("nontrapping-fptoint", HasNontrappingFPToInt)
6667
.Case("reference-types", HasReferenceTypes)
67-
.Case("gc", HasGC)
6868
.Case("relaxed-simd", SIMDLevel >= RelaxedSIMD)
6969
.Case("sign-ext", HasSignExt)
7070
.Case("simd128", SIMDLevel >= SIMD128)
@@ -99,6 +99,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
9999
Builder.defineMacro("__wasm_multimemory__");
100100
if (HasFP16)
101101
Builder.defineMacro("__wasm_fp16__");
102+
if (HasGC)
103+
Builder.defineMacro("__wasm_gc__");
102104
if (HasMultivalue)
103105
Builder.defineMacro("__wasm_multivalue__");
104106
if (HasMutableGlobals)
@@ -107,8 +109,6 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
107109
Builder.defineMacro("__wasm_nontrapping_fptoint__");
108110
if (HasReferenceTypes)
109111
Builder.defineMacro("__wasm_reference_types__");
110-
if (HasGC)
111-
Builder.defineMacro("__wasm_gc__");
112112
if (SIMDLevel >= RelaxedSIMD)
113113
Builder.defineMacro("__wasm_relaxed_simd__");
114114
if (HasSignExt)
@@ -194,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
194194
Features["exception-handling"] = true;
195195
Features["extended-const"] = true;
196196
Features["fp16"] = true;
197+
Features["gc"] = true;
197198
Features["multimemory"] = true;
198199
Features["tail-call"] = true;
199200
Features["wide-arithmetic"] = true;
@@ -270,6 +271,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
270271
HasFP16 = false;
271272
continue;
272273
}
274+
if (Feature == "+gc") {
275+
HasGC = true;
276+
continue;
277+
}
278+
if (Feature == "-gc") {
279+
HasGC = false;
280+
continue;
281+
}
273282
if (Feature == "+multimemory") {
274283
HasMultiMemory = true;
275284
continue;
@@ -310,14 +319,6 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
310319
HasReferenceTypes = false;
311320
continue;
312321
}
313-
if (Feature == "+gc") {
314-
HasGC = true;
315-
continue;
316-
}
317-
if (Feature == "-gc") {
318-
HasGC = false;
319-
continue;
320-
}
321322
if (Feature == "+relaxed-simd") {
322323
SIMDLevel = std::max(SIMDLevel, RelaxedSIMD);
323324
continue;

clang/lib/Basic/Targets/WebAssembly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
6464
bool HasExceptionHandling = false;
6565
bool HasExtendedConst = false;
6666
bool HasFP16 = false;
67+
bool HasGC = false;
6768
bool HasMultiMemory = false;
6869
bool HasMultivalue = false;
6970
bool HasMutableGlobals = false;
7071
bool HasNontrappingFPToInt = false;
7172
bool HasReferenceTypes = false;
72-
bool HasGC = false;
7373
bool HasSignExt = false;
7474
bool HasTailCall = false;
7575
bool HasWideArithmetic = false;

clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ class ComplexExprEmitter : public StmtVisitor<ComplexExprEmitter, mlir::Value> {
9191
}
9292

9393
mlir::Value VisitUnaryDeref(const Expr *e);
94+
95+
mlir::Value VisitUnaryPlus(const UnaryOperator *e);
96+
97+
mlir::Value VisitPlusMinus(const UnaryOperator *e, cir::UnaryOpKind kind,
98+
QualType promotionType);
99+
100+
mlir::Value VisitUnaryMinus(const UnaryOperator *e);
101+
94102
mlir::Value VisitUnaryNot(const UnaryOperator *e);
95103

96104
struct BinOpInfo {
@@ -282,6 +290,41 @@ mlir::Value ComplexExprEmitter::emitCast(CastKind ck, Expr *op,
282290
llvm_unreachable("unknown cast resulting in complex value");
283291
}
284292

293+
mlir::Value ComplexExprEmitter::VisitUnaryPlus(const UnaryOperator *e) {
294+
QualType promotionTy = getPromotionType(e->getSubExpr()->getType());
295+
mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Plus, promotionTy);
296+
if (!promotionTy.isNull()) {
297+
cgf.cgm.errorNYI("ComplexExprEmitter::VisitUnaryPlus emitUnPromotedValue");
298+
return {};
299+
}
300+
return result;
301+
}
302+
303+
mlir::Value ComplexExprEmitter::VisitPlusMinus(const UnaryOperator *e,
304+
cir::UnaryOpKind kind,
305+
QualType promotionType) {
306+
assert(kind == cir::UnaryOpKind::Plus ||
307+
kind == cir::UnaryOpKind::Minus &&
308+
"Invalid UnaryOp kind for ComplexType Plus or Minus");
309+
310+
mlir::Value op;
311+
if (!promotionType.isNull())
312+
op = cgf.emitPromotedComplexExpr(e->getSubExpr(), promotionType);
313+
else
314+
op = Visit(e->getSubExpr());
315+
return builder.createUnaryOp(cgf.getLoc(e->getExprLoc()), kind, op);
316+
}
317+
318+
mlir::Value ComplexExprEmitter::VisitUnaryMinus(const UnaryOperator *e) {
319+
QualType promotionTy = getPromotionType(e->getSubExpr()->getType());
320+
mlir::Value result = VisitPlusMinus(e, cir::UnaryOpKind::Minus, promotionTy);
321+
if (!promotionTy.isNull()) {
322+
cgf.cgm.errorNYI("ComplexExprEmitter::VisitUnaryMinus emitUnPromotedValue");
323+
return {};
324+
}
325+
return result;
326+
}
327+
285328
mlir::Value ComplexExprEmitter::emitConstant(
286329
const CIRGenFunction::ConstantEmission &constant, Expr *e) {
287330
assert(constant && "not a constant");
@@ -538,9 +581,17 @@ mlir::Value ComplexExprEmitter::emitPromoted(const Expr *e,
538581
default:
539582
break;
540583
}
541-
} else if (isa<UnaryOperator>(e)) {
542-
cgf.cgm.errorNYI("emitPromoted UnaryOperator");
543-
return {};
584+
} else if (const auto *unaryOp = dyn_cast<UnaryOperator>(e)) {
585+
switch (unaryOp->getOpcode()) {
586+
case UO_Minus:
587+
case UO_Plus: {
588+
auto kind = unaryOp->getOpcode() == UO_Plus ? cir::UnaryOpKind::Plus
589+
: cir::UnaryOpKind::Minus;
590+
return VisitPlusMinus(unaryOp, kind, promotionTy);
591+
}
592+
default:
593+
break;
594+
}
544595
}
545596

546597
mlir::Value result = Visit(const_cast<Expr *>(e));

clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ void LoweringPreparePass::lowerUnaryOp(cir::UnaryOp op) {
155155

156156
case cir::UnaryOpKind::Plus:
157157
case cir::UnaryOpKind::Minus:
158-
llvm_unreachable("Complex unary Plus/Minus NYI");
158+
resultReal = builder.createUnaryOp(loc, opKind, operandReal);
159+
resultImag = builder.createUnaryOp(loc, opKind, operandImag);
159160
break;
160161

161162
case cir::UnaryOpKind::Not:

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static llvm::StringRef GetUBSanTrapForHandler(SanitizerHandler ID) {
9393
LIST_SANITIZER_CHECKS
9494
#undef SANITIZER_CHECK
9595
}
96+
llvm_unreachable("unhandled switch case");
9697
}
9798

9899
/// CreateTempAlloca - This creates a alloca and inserts it into the entry

clang/lib/Format/IntegerLiteralSeparatorFixer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ std::pair<tooling::Replacements, unsigned>
4545
IntegerLiteralSeparatorFixer::process(const Environment &Env,
4646
const FormatStyle &Style) {
4747
switch (Style.Language) {
48-
case FormatStyle::LK_Cpp:
49-
case FormatStyle::LK_ObjC:
50-
Separator = '\'';
51-
break;
5248
case FormatStyle::LK_CSharp:
5349
case FormatStyle::LK_Java:
5450
case FormatStyle::LK_JavaScript:
5551
Separator = '_';
5652
break;
53+
case FormatStyle::LK_Cpp:
54+
case FormatStyle::LK_ObjC:
55+
if (Style.Standard >= FormatStyle::LS_Cpp14) {
56+
Separator = '\'';
57+
break;
58+
}
59+
[[fallthrough]];
5760
default:
5861
return {};
5962
}

0 commit comments

Comments
 (0)