[PATCH] D150824: [RISCV] Lower experimental_get_vector_length intrinsic to vsetvli for some cases.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 12:53:40 PDT 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1184
+
+ if (!IsScalable)
+ return true;
----------------
reames wrote:
> For fixed vectors, we should be able to statically compute this when the ElementWidth * VF is less than VLEN right? It's fine to do that in a different patch, just want to make sure I'm not missing something.
The ElementWidth doesn't have any real meaning. The vectorizer already picked a VF. The get_vector_length is asking, given that VF, how many elements fit in that type. The width of the elements or VLEN doesn't change that answer.
I guess we could return a lower number but that means we'd never use the entire type the vectorizer is emitting. That seems like we a cost model issue if we actually want to use less than the type the vectorizer picks.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1187
+
+ if (TripCountVT != MVT::i32 && TripCountVT != Subtarget.getXLenVT())
+ return true;
----------------
reames wrote:
> Why not i16? I don't see anything in the implementation which couldn't be handled via an extend?
No strong reason. Might need to add `setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::i16, Custom)` to get the legalization to be called.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150824/new/
https://reviews.llvm.org/D150824
More information about the llvm-commits
mailing list