[PATCH] D121771: [RISCV] Add basic cost model for vector casting

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 23:40:29 PDT 2022


kito-cheng added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:227
+    if (auto SrcVTy = dyn_cast<VectorType>(Src)) {
+      if (!ST->useRVVForFixedLengthVectors())
+        return BaseT::getCastInstrCost(Opcode, Dst, Src, CCH, CostKind, I);
----------------
Maybe check `FixedVectorType` rather than `VectorType`? I assume you only intend to handle fixed vector size since you checking `useRVVForFixedLengthVectors` here?


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:252
+                             SrcVTy->getElementType(), CCH, CostKind, I);
+        // There is no free vecotr casting.
+        return (Cost == 0) ? 1 : Cost;
----------------
vecotr - > vector


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121771



More information about the llvm-commits mailing list