From: eopXD Date: Sat, 7 Jan 2023 08:17:08 +0000 (-0800) Subject: [3/15][Clang][RISCV][NFC] Clarify edge cases of RVVIntrinsic::getSupportedMaskedPolic... X-Git-Tag: upstream/17.0.6~19858 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=063802843c20a49cf53a1fd380565ebfe29ee83f;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp index 93ade07..18b8ca5 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 #include @@ -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,