From 377d2604e1ddff695cbabc50703ea34ac5df8dea Mon Sep 17 00:00:00 2001 From: eopXD Date: Sat, 14 Jan 2023 08:06:19 -0800 Subject: [PATCH] [11/15][Clang][RISCV][NFC] Remove Policy::PolicyType::Omit The attribute can be removed now as preceding patches have removed its users. This is the 11th 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: craig.topper, kito-cheng Differential Revision: https://reviews.llvm.org/D141768 --- clang/include/clang/Support/RISCVVIntrinsicUtils.h | 4 +- clang/lib/Support/RISCVVIntrinsicUtils.cpp | 57 ++++++++++++---------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h index e1571d7..e3dd4d2 100644 --- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h +++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h @@ -97,7 +97,6 @@ struct Policy { enum PolicyType { Undisturbed, Agnostic, - Omit, // No policy required. }; PolicyType TailPolicy = Agnostic; PolicyType MaskPolicy = Undisturbed; @@ -105,6 +104,9 @@ struct Policy { Policy(bool HasTailPolicy, bool HasMaskPolicy) : IsUnspecified(true), HasTailPolicy(HasTailPolicy), HasMaskPolicy(HasMaskPolicy) {} + Policy(PolicyType TailPolicy, bool HasTailPolicy, bool HasMaskPolicy) + : TailPolicy(TailPolicy), HasTailPolicy(HasTailPolicy), + HasMaskPolicy(HasMaskPolicy) {} Policy(PolicyType TailPolicy, PolicyType MaskPolicy, bool HasTailPolicy, bool HasMaskPolicy) : TailPolicy(TailPolicy), MaskPolicy(MaskPolicy), diff --git a/clang/lib/Support/RISCVVIntrinsicUtils.cpp b/clang/lib/Support/RISCVVIntrinsicUtils.cpp index e93c553..2ad037b 100644 --- a/clang/lib/Support/RISCVVIntrinsicUtils.cpp +++ b/clang/lib/Support/RISCVVIntrinsicUtils.cpp @@ -969,10 +969,10 @@ llvm::SmallVector RVVIntrinsic::computeBuiltinTypes( llvm::SmallVector RVVIntrinsic::getSupportedUnMaskedPolicies(bool HasTailPolicy, bool HasMaskPolicy) { - return {Policy(Policy::PolicyType::Undisturbed, Policy::PolicyType::Omit, - HasTailPolicy, HasMaskPolicy), // TU - Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Omit, - HasTailPolicy, HasMaskPolicy)}; // TA + return { + Policy(Policy::PolicyType::Undisturbed, HasTailPolicy, + HasMaskPolicy), // TU + Policy(Policy::PolicyType::Agnostic, HasTailPolicy, HasMaskPolicy)}; // TA } llvm::SmallVector @@ -1034,28 +1034,33 @@ void RVVIntrinsic::updateNamesAndPolicy(bool IsMasked, bool HasPolicy, BuiltinName += "_ta"; } } else { - if (PolicyAttrs.isTUMAPolicy() && !PolicyAttrs.hasMaskPolicy()) - appendPolicySuffix("_tum"); - else if (PolicyAttrs.isTAMAPolicy() && !PolicyAttrs.hasMaskPolicy()) - appendPolicySuffix("_tam"); - else if (PolicyAttrs.isMUPolicy() && !PolicyAttrs.hasTailPolicy()) - appendPolicySuffix("_mu"); - else if (PolicyAttrs.isMAPolicy() && !PolicyAttrs.hasTailPolicy()) - appendPolicySuffix("_ma"); - else if (PolicyAttrs.isTUMUPolicy()) - appendPolicySuffix("_tumu"); - else if (PolicyAttrs.isTAMUPolicy()) - appendPolicySuffix("_tamu"); - else if (PolicyAttrs.isTUMAPolicy()) - appendPolicySuffix("_tuma"); - else if (PolicyAttrs.isTAMAPolicy()) - appendPolicySuffix("_tama"); - else if (PolicyAttrs.isTUPolicy() && !IsMasked) - appendPolicySuffix("_tu"); - else if (PolicyAttrs.isTAPolicy() && !IsMasked) - appendPolicySuffix("_ta"); - else - llvm_unreachable("Unhandled policy condition"); + if (IsMasked) { + if (PolicyAttrs.isTUMAPolicy() && !PolicyAttrs.hasMaskPolicy()) + appendPolicySuffix("_tum"); + else if (PolicyAttrs.isTAMAPolicy() && !PolicyAttrs.hasMaskPolicy()) + appendPolicySuffix("_tam"); + else if (PolicyAttrs.isMUPolicy() && !PolicyAttrs.hasTailPolicy()) + appendPolicySuffix("_mu"); + else if (PolicyAttrs.isMAPolicy() && !PolicyAttrs.hasTailPolicy()) + appendPolicySuffix("_ma"); + else if (PolicyAttrs.isTUMUPolicy()) + appendPolicySuffix("_tumu"); + else if (PolicyAttrs.isTAMUPolicy()) + appendPolicySuffix("_tamu"); + else if (PolicyAttrs.isTUMAPolicy()) + appendPolicySuffix("_tuma"); + else if (PolicyAttrs.isTAMAPolicy()) + appendPolicySuffix("_tama"); + else + llvm_unreachable("Unhandled policy condition"); + } else { + if (PolicyAttrs.isTUPolicy()) + appendPolicySuffix("_tu"); + else if (PolicyAttrs.isTAPolicy()) + appendPolicySuffix("_ta"); + else + llvm_unreachable("Unhandled policy condition"); + } } } -- 2.7.4