4vtomat created this revision. Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson. Herald added a project: All. 4vtomat requested review of this revision. Herald added subscribers: cfe-commits, wangpc, eopXD, MaskRay. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D157474 Files: clang/lib/Sema/SemaRISCVVectorLookup.cpp Index: clang/lib/Sema/SemaRISCVVectorLookup.cpp =================================================================== --- clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -202,10 +202,20 @@ void RISCVIntrinsicManagerImpl::ConstructRVVIntrinsics( ArrayRef<RVVIntrinsicRecord> Recs, IntrinsicKind K) { const TargetInfo &TI = Context.getTargetInfo(); - bool HasRV64 = TI.hasFeature("64bit"); + static const std::pair<const char *, uint8_t> 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<PrototypeDescriptor> 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))))
Index: clang/lib/Sema/SemaRISCVVectorLookup.cpp =================================================================== --- clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -202,10 +202,20 @@ void RISCVIntrinsicManagerImpl::ConstructRVVIntrinsics( ArrayRef<RVVIntrinsicRecord> Recs, IntrinsicKind K) { const TargetInfo &TI = Context.getTargetInfo(); - bool HasRV64 = TI.hasFeature("64bit"); + static const std::pair<const char *, uint8_t> 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<PrototypeDescriptor> 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))))
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits