[PATCH] D133007: [RISCV] Add cost model for vector insert/extract element.

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 20:18:10 PDT 2022


jacquesguan added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:788
+    // For insertelement, we need the following instructions:
+    // vsetvli a2, zero, e8, m1, ta, mu (not count)
+    // vmv.s.x v8, a0
----------------
reames wrote:
> For a follow up patch...
> 
> I think we can do better here using logical ops on the mask vector.  Haven't fully worked through the sequence, but generating a mask with one bit set is fairly cheap, and then we're just doing bit toggles. 
I think you mean we could improve the codegen of insertelemet of mask vector.
I do have a revision about fixed mask insertelement https://reviews.llvm.org/D119115, but it is not approved now.
About your comment, I don't think out how to build a scalable mask vector with only a given index set now, which instructions we should use to make it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133007



More information about the llvm-commits mailing list