diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp --- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -202,10 +202,20 @@ void RISCVIntrinsicManagerImpl::ConstructRVVIntrinsics( ArrayRef Recs, IntrinsicKind K) { const TargetInfo &TI = Context.getTargetInfo(); - bool HasRV64 = TI.hasFeature("64bit"); + static const std::pair FeatureCheckList[] = { + {"64bit", RVV_REQ_RV64}, + {"xsfvcp", RVV_REQ_Xsfvcp}}; + // Construction of RVVIntrinsicRecords need to sync with createRVVIntrinsics // in RISCVVEmitter.cpp. for (auto &Record : Recs) { + // Check requirements. + if (llvm::any_of(FeatureCheckList, [&](const auto &Item) { + return (Record.RequiredExtensions & Item.second) == Item.second && + !TI.hasFeature(Item.first); + })) + continue; + // Create Intrinsics for each type and LMUL. BasicType BaseType = BasicType::Unknown; ArrayRef BasicProtoSeq = @@ -251,11 +261,6 @@ if ((BaseTypeI & Record.TypeRangeMask) != BaseTypeI) continue; - // Check requirement. - if (((Record.RequiredExtensions & RVV_REQ_RV64) == RVV_REQ_RV64) && - !HasRV64) - continue; - // Expanded with different LMUL. for (int Log2LMUL = -3; Log2LMUL <= 3; Log2LMUL++) { if (!(Record.Log2LMULMask & (1 << (Log2LMUL + 3))))