[PATCH] D141796: [15/15][Clang][RISCV][NFC] Set data member under Policy as constants
Yueh-Ting (eop) Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 26 05:54:13 PST 2023
eopXD updated this revision to Diff 492420.
eopXD added a comment.
Rebase to latest main.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141796/new/
https://reviews.llvm.org/D141796
Files:
clang/include/clang/Support/RISCVVIntrinsicUtils.h
clang/lib/Support/RISCVVIntrinsicUtils.cpp
Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -1017,7 +1017,6 @@
};
if (PolicyAttrs.isUnspecified()) {
- PolicyAttrs.IsUnspecified = false;
if (IsMasked) {
Name += "_m";
if (HasPolicy)
Index: clang/include/clang/Support/RISCVVIntrinsicUtils.h
===================================================================
--- clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -92,15 +92,22 @@
LLVM_MARK_AS_BITMASK_ENUM(LMUL1),
};
-struct Policy {
- bool IsUnspecified = false;
+class Policy {
+public:
enum PolicyType {
Undisturbed,
Agnostic,
};
- PolicyType TailPolicy = Agnostic;
- PolicyType MaskPolicy = Agnostic;
+
+private:
+ const bool IsUnspecified = false;
+ // The default assumption for an RVV instruction is TAMA, as an undisturbed
+ // policy generally will affect the performance of an out-of-order core.
+ const PolicyType TailPolicy = Agnostic;
+ const PolicyType MaskPolicy = Agnostic;
bool HasTailPolicy, HasMaskPolicy;
+
+public:
Policy(bool HasTailPolicy, bool HasMaskPolicy)
: IsUnspecified(true), HasTailPolicy(HasTailPolicy),
HasMaskPolicy(HasMaskPolicy) {}
@@ -422,7 +429,6 @@
return IntrinsicTypes;
}
Policy getPolicyAttrs() const {
- assert(PolicyAttrs.IsUnspecified == false);
return PolicyAttrs;
}
unsigned getPolicyAttrsBits() const {
@@ -431,8 +437,6 @@
// The 1st bit simulates the `vma` of RVV
// int PolicyAttrs = 0;
- assert(PolicyAttrs.IsUnspecified == false);
-
if (PolicyAttrs.isTUMAPolicy())
return 2;
if (PolicyAttrs.isTAMAPolicy())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141796.492420.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230126/3e6484e2/attachment.bin>
More information about the cfe-commits
mailing list