Skip to content

Commit f4fe12d

Browse files
committed
merge main into amd-staging
Change-Id: I036d53fa99b26e359e5e33471b7b88db8050faa1
2 parents bf73bfb + 9d36428 commit f4fe12d

File tree

554 files changed

+21904
-6247
lines changed

Some content is hidden

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

554 files changed

+21904
-6247
lines changed

bolt/lib/Core/BinaryFunctionProfile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ void BinaryFunction::inferFallThroughCounts() {
336336
if (SuccBI.Count == 0) {
337337
SuccBI.Count = Inferred;
338338
SuccBI.MispredictedCount = BinaryBasicBlock::COUNT_INFERRED;
339-
Succ->ExecutionCount += Inferred;
339+
Succ->ExecutionCount =
340+
std::max(Succ->getKnownExecutionCount(), Inferred);
340341
}
341342
}
342343
}

bolt/test/X86/infer-fall-throughs.s

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Test that infer-fall-throughs would correctly infer the wrong fall-through
2+
## edge count in the example
3+
4+
# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
5+
# RUN: link_fdata %s %t.o %t.fdata
6+
# RUN: llvm-strip --strip-unneeded %t.o
7+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
8+
# RUN: llvm-bolt %t.exe -o %t.bolt \
9+
# RUN: --print-estimate-edge-counts --data=%t.fdata \
10+
# RUN: 2>&1 | FileCheck --check-prefix=WITHOUTINFERENCE %s
11+
# RUN: llvm-bolt %t.exe -o %t.bolt --infer-fall-throughs \
12+
# RUN: --print-estimate-edge-counts --data=%t.fdata \
13+
# RUN: 2>&1 | FileCheck --check-prefix=CORRECTINFERENCE %s
14+
15+
16+
# WITHOUTINFERENCE: Binary Function "main" after estimate-edge-counts
17+
# WITHOUTINFERENCE: {{^\.Ltmp0}}
18+
# WITHOUTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (mispreds: 0, count: 0)
19+
# WITHOUTINFERENCE: {{^\.LFT0}}
20+
# WITHOUTINFERENCE: Exec Count : 490
21+
22+
# CORRECTINFERENCE: Binary Function "main" after estimate-edge-counts
23+
# CORRECTINFERENCE: {{^\.Ltmp0}}
24+
# CORRECTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (inferred count: 490)
25+
# CORRECTINFERENCE: {{^\.LFT0}}
26+
# CORRECTINFERENCE: Exec Count : 490
27+
28+
29+
.globl main
30+
.type main, @function
31+
main:
32+
LLmain_LLstart:
33+
jmp LLstart
34+
# FDATA: 1 main #LLmain_LLstart# 1 main #LLstart# 0 500
35+
LLstart:
36+
jge LLexit
37+
# FDATA: 1 main #LLstart# 1 main #LLexit# 0 10
38+
# FDATA: 1 main #LLstart# 1 main #LLmore# 0 0
39+
LLmore:
40+
movl $5, %eax
41+
# FDATA: 1 main #LLmore# 1 main #LLexit# 0 490
42+
LLexit:
43+
ret
44+
.LLmain_end:
45+
.size main, .LLmain_end-main

clang/cmake/caches/CrossWinToARMLinux.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ endif()
108108

109109
message(STATUS "Toolchain target to build: ${LLVM_TARGETS_TO_BUILD}")
110110

111-
# Allow to override libc++ ABI version. Use 2 by default.
111+
# Allow to override libc++ ABI version (1 is default).
112112
if (NOT DEFINED LIBCXX_ABI_VERSION)
113-
set(LIBCXX_ABI_VERSION 2)
113+
set(LIBCXX_ABI_VERSION 1)
114114
endif()
115115

116116
message(STATUS "Toolchain's Libc++ ABI version: ${LIBCXX_ABI_VERSION}")
@@ -217,6 +217,8 @@ set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_SHARED
217217
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ABI_VERSION ${LIBCXX_ABI_VERSION} CACHE STRING "")
218218
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_CXX_ABI "libcxxabi" CACHE STRING "") #!!!
219219
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
220+
# Merge libc++ and libc++abi libraries into the single libc++ library file.
221+
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
220222

221223
# Avoid searching for the python3 interpreter during the runtimes configuration for the cross builds.
222224
# It starts searching the python3 package using the target's sysroot path, that usually is not compatible with the build host.

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ Resolutions to C++ Defect Reports
157157
- ``nullptr`` is now promoted to ``void*`` when passed to a C-style variadic function.
158158
(`CWG722: Can nullptr be passed to an ellipsis? <https://cplusplus.github.io/CWG/issues/722.html>`_)
159159

160+
- Allow ``void{}`` as a prvalue of type ``void``.
161+
(`CWG2351: void{} <https://cplusplus.github.io/CWG/issues/2351.html>`_).
162+
160163
C Language Changes
161164
------------------
162165

clang/include/clang/AST/ExprCXX.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,8 +2176,9 @@ class LambdaExpr final : public Expr,
21762176
const_child_range children() const;
21772177
};
21782178

2179-
/// An expression "T()" which creates a value-initialized rvalue of type
2180-
/// T, which is a non-class type. See (C++98 [5.2.3p2]).
2179+
/// An expression "T()" which creates an rvalue of a non-class type T.
2180+
/// For non-void T, the rvalue is value-initialized.
2181+
/// See (C++98 [5.2.3p2]).
21812182
class CXXScalarValueInitExpr : public Expr {
21822183
friend class ASTStmtReader;
21832184

clang/include/clang/Basic/BuiltinsX86.def

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,50 @@ TARGET_BUILTIN(__builtin_ia32_vcvttps2ibs512_mask, "V16UiV16fV16UiUsIi", "nV:512
22172217
TARGET_BUILTIN(__builtin_ia32_vcvttps2iubs128_mask, "V4UiV4fV4UiUc", "nV:128:", "avx10.2-256")
22182218
TARGET_BUILTIN(__builtin_ia32_vcvttps2iubs256_mask, "V8UiV8fV8UiUcIi", "nV:256:", "avx10.2-256")
22192219
TARGET_BUILTIN(__builtin_ia32_vcvttps2iubs512_mask, "V16UiV16fV16UiUsIi", "nV:512:", "avx10.2-512")
2220+
2221+
// AVX10.2 CONVERT
2222+
TARGET_BUILTIN(__builtin_ia32_vcvt2ps2phx128_mask, "V8xV4fV4fV8xUc", "ncV:128:", "avx10.2-256")
2223+
TARGET_BUILTIN(__builtin_ia32_vcvt2ps2phx256_mask, "V16xV8fV8fV16xUsIi", "ncV:256:", "avx10.2-256")
2224+
TARGET_BUILTIN(__builtin_ia32_vcvt2ps2phx512_mask, "V32xV16fV16fV32xUiIi", "ncV:512:", "avx10.2-512")
2225+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8_128_mask, "V16cV16cV8xV16cUc", "nV:128:", "avx10.2-256")
2226+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8_256_mask, "V16cV32cV16xV16cUs", "nV:256:", "avx10.2-256")
2227+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8_512_mask, "V32cV64cV32xV32cUi", "nV:512:", "avx10.2-512")
2228+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8s_128_mask, "V16cV16cV8xV16cUc", "nV:128:", "avx10.2-256")
2229+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8s_256_mask, "V16cV32cV16xV16cUs", "nV:256:", "avx10.2-256")
2230+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2bf8s_512_mask, "V32cV64cV32xV32cUi", "nV:512:", "avx10.2-512")
2231+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8_128_mask, "V16cV16cV8xV16cUc", "nV:128:", "avx10.2-256")
2232+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8_256_mask, "V16cV32cV16xV16cUs", "nV:256:", "avx10.2-256")
2233+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8_512_mask, "V32cV64cV32xV32cUi", "nV:512:", "avx10.2-512")
2234+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8s_128_mask, "V16cV16cV8xV16cUc", "nV:128:", "avx10.2-256")
2235+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8s_256_mask, "V16cV32cV16xV16cUs", "nV:256:", "avx10.2-256")
2236+
TARGET_BUILTIN(__builtin_ia32_vcvtbiasph2hf8s_512_mask, "V32cV64cV32xV32cUi", "nV:512:", "avx10.2-512")
2237+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8_128, "V16cV8xV8x", "nV:128:", "avx10.2-256")
2238+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8_256, "V32cV16xV16x", "nV:256:", "avx10.2-256")
2239+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8_512, "V64cV32xV32x", "nV:512:", "avx10.2-512")
2240+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8s_128, "V16cV8xV8x", "nV:128:", "avx10.2-256")
2241+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8s_256, "V32cV16xV16x", "nV:256:", "avx10.2-256")
2242+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2bf8s_512, "V64cV32xV32x", "nV:512:", "avx10.2-512")
2243+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8_128, "V16cV8xV8x", "nV:128:", "avx10.2-256")
2244+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8_256, "V32cV16xV16x", "nV:256:", "avx10.2-256")
2245+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8_512, "V64cV32xV32x", "nV:512:", "avx10.2-512")
2246+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8s_128, "V16cV8xV8x", "nV:128:", "avx10.2-256")
2247+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8s_256, "V32cV16xV16x", "nV:256:", "avx10.2-256")
2248+
TARGET_BUILTIN(__builtin_ia32_vcvtne2ph2hf8s_512, "V64cV32xV32x", "nV:512:", "avx10.2-512")
2249+
TARGET_BUILTIN(__builtin_ia32_vcvthf8_2ph128_mask, "V8xV16cV8xUc", "nV:128:", "avx10.2-256")
2250+
TARGET_BUILTIN(__builtin_ia32_vcvthf8_2ph256_mask, "V16xV16cV16xUs", "nV:256:", "avx10.2-256")
2251+
TARGET_BUILTIN(__builtin_ia32_vcvthf8_2ph512_mask, "V32xV32cV32xUi", "nV:512:", "avx10.2-512")
2252+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8_128_mask, "V16cV8xV16cUc", "nV:128:", "avx10.2-256")
2253+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8_256_mask, "V16cV16xV16cUs", "nV:256:", "avx10.2-256")
2254+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8_512_mask, "V32cV32xV32cUi", "nV:512:", "avx10.2-512")
2255+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8s_128_mask, "V16cV8xV16cUc", "nV:128:", "avx10.2-256")
2256+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8s_256_mask, "V16cV16xV16cUs", "nV:256:", "avx10.2-256")
2257+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2bf8s_512_mask, "V32cV32xV32cUi", "nV:512:", "avx10.2-512")
2258+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8_128_mask, "V16cV8xV16cUc", "nV:128:", "avx10.2-256")
2259+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8_256_mask, "V16cV16xV16cUs", "nV:256:", "avx10.2-256")
2260+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8_512_mask, "V32cV32xV32cUi", "nV:512:", "avx10.2-512")
2261+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8s_128_mask, "V16cV8xV16cUc", "nV:128:", "avx10.2-256")
2262+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8s_256_mask, "V16cV16xV16cUs", "nV:256:", "avx10.2-256")
2263+
TARGET_BUILTIN(__builtin_ia32_vcvtneph2hf8s_512_mask, "V32cV32xV32cUi", "nV:512:", "avx10.2-512")
22202264
#undef BUILTIN
22212265
#undef TARGET_BUILTIN
22222266
#undef TARGET_HEADER_BUILTIN

clang/include/clang/Sema/Sema.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13071,12 +13071,19 @@ class Sema final : public SemaBase {
1307113071
/// ForConstraintInstantiation indicates we should continue looking when
1307213072
/// encountering a lambda generic call operator, and continue looking for
1307313073
/// arguments on an enclosing class template.
13074+
///
13075+
/// \param SkipForSpecialization when specified, any template specializations
13076+
/// in a traversal would be ignored.
13077+
/// \param ForDefaultArgumentSubstitution indicates we should continue looking
13078+
/// when encountering a specialized member function template, rather than
13079+
/// returning immediately.
1307413080
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(
1307513081
const NamedDecl *D, const DeclContext *DC = nullptr, bool Final = false,
1307613082
std::optional<ArrayRef<TemplateArgument>> Innermost = std::nullopt,
1307713083
bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr,
1307813084
bool ForConstraintInstantiation = false,
13079-
bool SkipForSpecialization = false);
13085+
bool SkipForSpecialization = false,
13086+
bool ForDefaultArgumentSubstitution = false);
1308013087

1308113088
/// RAII object to handle the state changes required to synthesize
1308213089
/// a function body.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,7 @@ bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) {
25562556

25572557
if (DiscardResult)
25582558
return this->emitPopPtr(E);
2559-
return true;
2559+
return this->emitFinishInit(E);
25602560
}
25612561

25622562
if (T->isArrayType()) {

clang/lib/AST/ByteCode/EvalEmitter.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,16 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
165165
if (ConvertResultToRValue) {
166166
if (!Ptr.isZero() && !Ptr.isDereferencable())
167167
return false;
168+
169+
if (S.getLangOpts().CPlusPlus11 && Ptr.isBlockPointer() &&
170+
!CheckFinalLoad(S, OpPC, Ptr)) {
171+
return false;
172+
}
173+
168174
// Never allow reading from a non-const pointer, unless the memory
169175
// has been created in this evaluation.
170-
if (!Ptr.isZero() && Ptr.isBlockPointer() &&
171-
Ptr.block()->getEvalID() != Ctx.getEvalID() &&
172-
(!CheckLoad(S, OpPC, Ptr, AK_Read) || !Ptr.isConst()))
176+
if (!Ptr.isZero() && !Ptr.isConst() && Ptr.isBlockPointer() &&
177+
Ptr.block()->getEvalID() != Ctx.getEvalID())
173178
return false;
174179

175180
if (std::optional<APValue> V =

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,31 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
559559
return true;
560560
}
561561

562+
/// This is not used by any of the opcodes directly. It's used by
563+
/// EvalEmitter to do the final lvalue-to-rvalue conversion.
564+
bool CheckFinalLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
565+
if (!CheckLive(S, OpPC, Ptr, AK_Read))
566+
return false;
567+
if (!CheckConstant(S, OpPC, Ptr))
568+
return false;
569+
570+
if (!CheckDummy(S, OpPC, Ptr, AK_Read))
571+
return false;
572+
if (!CheckExtern(S, OpPC, Ptr))
573+
return false;
574+
if (!CheckRange(S, OpPC, Ptr, AK_Read))
575+
return false;
576+
if (!CheckActive(S, OpPC, Ptr, AK_Read))
577+
return false;
578+
if (!CheckInitialized(S, OpPC, Ptr, AK_Read))
579+
return false;
580+
if (!CheckTemporary(S, OpPC, Ptr, AK_Read))
581+
return false;
582+
if (!CheckMutable(S, OpPC, Ptr))
583+
return false;
584+
return true;
585+
}
586+
562587
bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
563588
if (!CheckLive(S, OpPC, Ptr, AK_Assign))
564589
return false;

clang/lib/AST/ByteCode/Interp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ bool CheckMutable(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
9292
/// Checks if a value can be loaded from a block.
9393
bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
9494
AccessKinds AK = AK_Read);
95+
bool CheckFinalLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
9596

9697
bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
9798
AccessKinds AK);

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14443,33 +14443,59 @@ Value *CodeGenFunction::EmitRISCVCpuSupports(const CallExpr *E) {
1444314443
if (!getContext().getTargetInfo().validateCpuSupports(FeatureStr))
1444414444
return Builder.getFalse();
1444514445

14446-
// Note: We are making an unchecked assumption that the size of the
14447-
// feature array is >= 1. This holds for any version of compiler-rt
14448-
// which defines this interface.
14449-
llvm::ArrayType *ArrayOfInt64Ty = llvm::ArrayType::get(Int64Ty, 1);
14446+
return EmitRISCVCpuSupports(ArrayRef<StringRef>(FeatureStr));
14447+
}
14448+
14449+
static Value *loadRISCVFeatureBits(unsigned Index, CGBuilderTy &Builder,
14450+
CodeGenModule &CGM) {
14451+
llvm::Type *Int32Ty = Builder.getInt32Ty();
14452+
llvm::Type *Int64Ty = Builder.getInt64Ty();
14453+
llvm::ArrayType *ArrayOfInt64Ty =
14454+
llvm::ArrayType::get(Int64Ty, llvm::RISCVISAInfo::FeatureBitSize);
1445014455
llvm::Type *StructTy = llvm::StructType::get(Int32Ty, ArrayOfInt64Ty);
1445114456
llvm::Constant *RISCVFeaturesBits =
1445214457
CGM.CreateRuntimeVariable(StructTy, "__riscv_feature_bits");
14453-
auto *GV = cast<llvm::GlobalValue>(RISCVFeaturesBits);
14454-
GV->setDSOLocal(true);
14455-
14456-
auto LoadFeatureBit = [&](unsigned Index) {
14457-
// Create GEP then load.
14458-
Value *IndexVal = llvm::ConstantInt::get(Int32Ty, Index);
14459-
llvm::Value *GEPIndices[] = {Builder.getInt32(0), Builder.getInt32(1),
14460-
IndexVal};
14461-
Value *Ptr =
14462-
Builder.CreateInBoundsGEP(StructTy, RISCVFeaturesBits, GEPIndices);
14463-
Value *FeaturesBit =
14464-
Builder.CreateAlignedLoad(Int64Ty, Ptr, CharUnits::fromQuantity(8));
14465-
return FeaturesBit;
14466-
};
14458+
cast<llvm::GlobalValue>(RISCVFeaturesBits)->setDSOLocal(true);
14459+
Value *IndexVal = llvm::ConstantInt::get(Int32Ty, Index);
14460+
llvm::Value *GEPIndices[] = {Builder.getInt32(0), Builder.getInt32(1),
14461+
IndexVal};
14462+
Value *Ptr =
14463+
Builder.CreateInBoundsGEP(StructTy, RISCVFeaturesBits, GEPIndices);
14464+
Value *FeaturesBit =
14465+
Builder.CreateAlignedLoad(Int64Ty, Ptr, CharUnits::fromQuantity(8));
14466+
return FeaturesBit;
14467+
}
14468+
14469+
Value *CodeGenFunction::EmitRISCVCpuSupports(ArrayRef<StringRef> FeaturesStrs) {
14470+
const unsigned RISCVFeatureLength = llvm::RISCVISAInfo::FeatureBitSize;
14471+
uint64_t RequireBitMasks[RISCVFeatureLength] = {0};
14472+
14473+
for (auto Feat : FeaturesStrs) {
14474+
auto [GroupID, BitPos] = RISCVISAInfo::getRISCVFeaturesBitsInfo(Feat);
14475+
14476+
// If there isn't BitPos for this feature, skip this version.
14477+
// It also report the warning to user during compilation.
14478+
if (BitPos == -1)
14479+
return Builder.getFalse();
1446714480

14468-
auto [GroupID, BitPos] = RISCVISAInfo::getRISCVFeaturesBitsInfo(FeatureStr);
14469-
assert(BitPos != -1 && "validation should have rejected this feature");
14470-
Value *MaskV = Builder.getInt64(1ULL << BitPos);
14471-
Value *Bitset = Builder.CreateAnd(LoadFeatureBit(GroupID), MaskV);
14472-
return Builder.CreateICmpEQ(Bitset, MaskV);
14481+
RequireBitMasks[GroupID] |= (1ULL << BitPos);
14482+
}
14483+
14484+
Value *Result = nullptr;
14485+
for (unsigned Idx = 0; Idx < RISCVFeatureLength; Idx++) {
14486+
if (RequireBitMasks[Idx] == 0)
14487+
continue;
14488+
14489+
Value *Mask = Builder.getInt64(RequireBitMasks[Idx]);
14490+
Value *Bitset =
14491+
Builder.CreateAnd(loadRISCVFeatureBits(Idx, Builder, CGM), Mask);
14492+
Value *CmpV = Builder.CreateICmpEQ(Bitset, Mask);
14493+
Result = (!Result) ? CmpV : Builder.CreateAnd(Result, CmpV);
14494+
}
14495+
14496+
assert(Result && "Should have value here.");
14497+
14498+
return Result;
1447314499
}
1447414500

1447514501
Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,

0 commit comments

Comments
 (0)