[PATCH] D141573: [WIP][1/N][Clang][RISCV][NFC] Extract common utility to RISCVVIntrinsicUtils
Yueh-Ting (eop) Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 00:49:29 PST 2023
eopXD created this revision.
Herald added subscribers: sunshaoce, VincentWu, vkmr, frasercrmck, evandro, 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.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141573
Files:
clang/include/clang/Support/RISCVVIntrinsicUtils.h
clang/lib/Sema/SemaRISCVVectorLookup.cpp
clang/lib/Support/RISCVVIntrinsicUtils.cpp
clang/utils/TableGen/RISCVVEmitter.cpp
Index: clang/utils/TableGen/RISCVVEmitter.cpp
===================================================================
--- clang/utils/TableGen/RISCVVEmitter.cpp
+++ clang/utils/TableGen/RISCVVEmitter.cpp
@@ -528,12 +528,8 @@
StringRef MaskedIRName = R->getValueAsString("MaskedIRName");
unsigned NF = R->getValueAsInt("NF");
- // If unmasked builtin supports policy, they should be TU or TA.
- llvm::SmallVector<Policy> SupportedUnMaskedPolicies;
- SupportedUnMaskedPolicies.emplace_back(Policy(
- Policy::PolicyType::Undisturbed, Policy::PolicyType::Omit)); // TU
- SupportedUnMaskedPolicies.emplace_back(
- Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Omit)); // TA
+ SmallVector<Policy> SupportedUnMaskedPolicies =
+ RVVIntrinsic::getSupportedUnMaskedPolicies();
SmallVector<Policy> SupportedMaskedPolicies =
RVVIntrinsic::getSupportedMaskedPolicies(HasTailPolicy, HasMaskPolicy);
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -980,6 +980,12 @@
return NewPrototype;
}
+llvm::SmallVector<Policy> RVVIntrinsic::getSupportedUnMaskedPolicies() {
+ return {
+ Policy(Policy::PolicyType::Undisturbed, Policy::PolicyType::Omit), // TU
+ Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Omit)}; // TA
+}
+
llvm::SmallVector<Policy>
RVVIntrinsic::getSupportedMaskedPolicies(bool HasTailPolicy,
bool HasMaskPolicy) {
Index: clang/lib/Sema/SemaRISCVVectorLookup.cpp
===================================================================
--- clang/lib/Sema/SemaRISCVVectorLookup.cpp
+++ clang/lib/Sema/SemaRISCVVectorLookup.cpp
@@ -204,13 +204,9 @@
bool UnMaskedHasPolicy = UnMaskedPolicyScheme != PolicyScheme::SchemeNone;
bool MaskedHasPolicy = MaskedPolicyScheme != PolicyScheme::SchemeNone;
- // If unmasked builtin supports policy, they should be TU or TA.
- llvm::SmallVector<Policy> SupportedUnMaskedPolicies;
- SupportedUnMaskedPolicies.emplace_back(Policy(
- Policy::PolicyType::Undisturbed, Policy::PolicyType::Omit)); // TU
- SupportedUnMaskedPolicies.emplace_back(
- Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Omit)); // TA
- llvm::SmallVector<Policy> SupportedMaskedPolicies =
+ SmallVector<Policy> SupportedUnMaskedPolicies =
+ RVVIntrinsic::getSupportedUnMaskedPolicies();
+ SmallVector<Policy> SupportedMaskedPolicies =
RVVIntrinsic::getSupportedMaskedPolicies(Record.HasTailPolicy,
Record.HasMaskPolicy);
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -475,6 +475,8 @@
bool IsMasked, bool HasMaskedOffOperand, bool HasVL,
unsigned NF, PolicyScheme DefaultScheme,
Policy PolicyAttrs);
+
+ static llvm::SmallVector<Policy> getSupportedUnMaskedPolicies();
static llvm::SmallVector<Policy>
getSupportedMaskedPolicies(bool HasTailPolicy, bool HasMaskPolicy);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141573.488508.patch
Type: text/x-patch
Size: 3374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230112/0b03c93d/attachment.bin>
More information about the cfe-commits
mailing list