[flang-commits] [lldb] [clang] [clang-tools-extra] [libcxxabi] [libc] [flang] [llvm] [lld] [libcxx] [compiler-rt] [TTI][RISCV]Improve costs for fixed vector whole reg extract/insert. (PR #80164)

Alexey Bataev via flang-commits flang-commits at lists.llvm.org
Mon Feb 5 12:29:41 PST 2024


================
@@ -326,6 +326,48 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
     switch (Kind) {
     default:
       break;
+    case TTI::SK_ExtractSubvector:
+      if (isa<FixedVectorType>(SubTp) &&
+          LT.second.getVectorElementType() != MVT::i1) {
+        unsigned TpRegs = getRegUsageForType(Tp);
+        unsigned NumElems =
+            divideCeil(Tp->getElementCount().getFixedValue(), TpRegs);
+        // Whole vector extract - just the vector itself + (possible) vsetvli.
+        // TODO: consider adding the cost for vsetvli.
+        if (Index == 0 || (ST->getRealMaxVLen() == ST->getRealMinVLen() &&
+                           NumElems * LT.second.getScalarSizeInBits() ==
+                               ST->getRealMinVLen() &&
+                           Index % NumElems == 0))
----------------
alexey-bataev wrote:

Added couple, hope it works

https://github.com/llvm/llvm-project/pull/80164


More information about the flang-commits mailing list