[PATCH] D141756: [WIP][6/N][Clang][RISCV][NFC] Instructions with a mask destination register is always tail agnostic

Yueh-Ting (eop) Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 14 11:09:14 PST 2023


eopXD updated this revision to Diff 489293.
eopXD added a comment.

Rebase upon latest main.

Also [10/N] was mistakenly fused into this patch. Removed it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141756/new/

https://reviews.llvm.org/D141756

Files:
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===================================================================
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -917,9 +917,6 @@
     PolicyScheme DefaultScheme, Policy PolicyAttrs) {
   SmallVector<PrototypeDescriptor> NewPrototype(Prototype.begin(),
                                                 Prototype.end());
-  // Update PolicyAttrs if need (TA or TAMA) for compute builtin types.
-  if (PolicyAttrs.isMAPolicy())
-    PolicyAttrs.TailPolicy = Policy::PolicyType::Agnostic; // TAMA
   bool HasPassthruOp = DefaultScheme == PolicyScheme::HasPassthruOperand;
   if (IsMasked) {
     // If HasMaskedOffOperand, insert result type as first input operand if
@@ -996,8 +993,8 @@
                    Policy::PolicyType::Agnostic)}; // TAM
   if (!HasTailPolicy && HasMaskPolicy)
     return {
-        Policy(Policy::PolicyType::Omit, Policy::PolicyType::Agnostic), // MA
-        Policy(Policy::PolicyType::Omit,
+        Policy(Policy::PolicyType::Agnostic, Policy::PolicyType::Agnostic), // MA
+        Policy(Policy::PolicyType::Agnostic,
                Policy::PolicyType::Undisturbed)}; // MU
   llvm_unreachable("An RVV instruction should not be without both tail policy "
                    "and mask policy");
@@ -1036,6 +1033,10 @@
       appendPolicySuffix("_tum");
     else if (PolicyAttrs.isTAMAPolicy() && !HasMaskPolicy)
       appendPolicySuffix("_tam");
+    else if (PolicyAttrs.isMUPolicy() && !HasTailPolicy)
+      appendPolicySuffix("_mu");
+    else if (PolicyAttrs.isMAPolicy() && !HasTailPolicy)
+      appendPolicySuffix("_ma");
     else if (PolicyAttrs.isTUMUPolicy())
       appendPolicySuffix("_tumu");
     else if (PolicyAttrs.isTAMUPolicy())
@@ -1048,13 +1049,7 @@
       appendPolicySuffix("_tu");
     else if (PolicyAttrs.isTAPolicy() && !IsMasked)
       appendPolicySuffix("_ta");
-    else if (PolicyAttrs.isMUPolicy() && !HasTailPolicy) {
-      appendPolicySuffix("_mu");
-      PolicyAttrs.TailPolicy = Policy::PolicyType::Agnostic;
-    } else if (PolicyAttrs.isMAPolicy() && !HasTailPolicy) {
-      appendPolicySuffix("_ma");
-      PolicyAttrs.TailPolicy = Policy::PolicyType::Agnostic;
-    } else
+    else
       llvm_unreachable("Unhandled policy condition");
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141756.489293.patch
Type: text/x-patch
Size: 2328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230114/ad45e886/attachment.bin>


More information about the cfe-commits mailing list