[clang] 0638028 - [3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolicies for clarity
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 24 00:07:38 PST 2023
Author: eopXD
Date: 2023-01-24T00:07:33-08:00
New Revision: 063802843c20a49cf53a1fd380565ebfe29ee83f
URL: https://github.com/llvm/llvm-project/commit/063802843c20a49cf53a1fd380565ebfe29ee83f
DIFF: https://github.com/llvm/llvm-project/commit/063802843c20a49cf53a1fd380565ebfe29ee83f.diff
LOG: [3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolicies for clarity
This is the 3rd commit of a patch-set that aims to change the default policy
for RVV intrinsics from TAMU to TAMA.
Please refer to the cover letter in the 1st commit (D141573) for an
overview.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D141575
Added:
Modified:
clang/lib/Support/RISCVVIntrinsicUtils.cpp
Removed:
################################################################################
diff --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp
index 93ade07b583b7..18b8ca54b7b6a 100644
--- a/clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ b/clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -13,6 +13,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <numeric>
#include <optional>
@@ -992,16 +993,18 @@ RVVIntrinsic::getSupportedMaskedPolicies(bool HasTailPolicy,
Policy::PolicyType::Undisturbed), // TUMU
Policy(Policy::PolicyType::Agnostic,
Policy::PolicyType::Undisturbed)}; // TAMU
-
- if (HasTailPolicy)
+ if (HasTailPolicy && !HasMaskPolicy)
return {Policy(Policy::PolicyType::Undisturbed,
Policy::PolicyType::Agnostic, true), // TUM
Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Agnostic,
true)}; // TAM
-
- return {
- Policy(Policy::PolicyType::Omit, Policy::PolicyType::Agnostic), // MA
- Policy(Policy::PolicyType::Omit, Policy::PolicyType::Undisturbed)}; // MU
+ if (!HasTailPolicy && HasMaskPolicy)
+ return {
+ Policy(Policy::PolicyType::Omit, Policy::PolicyType::Agnostic), // MA
+ Policy(Policy::PolicyType::Omit,
+ Policy::PolicyType::Undisturbed)}; // MU
+ llvm_unreachable("An RVV instruction should not be without both tail policy "
+ "and mask policy");
}
void RVVIntrinsic::updateNamesAndPolicy(bool IsMasked, bool HasPolicy,
More information about the cfe-commits
mailing list