[PATCH] D121771: [RISCV] Add basic cost model for vector casting
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 20:32:11 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:246
+ case ISD::UINT_TO_FP: {
+ auto Cost =
+ getCastInstrCost(Opcode, DstVTy->getElementType(),
----------------
fakepaper56 wrote:
> craig.topper wrote:
> > Is there any point in getting the scalar cost? Seems like its always 1 and doesn't have a real connection to how the vector ISA works.
> >
> > I'm also questioning the accuracy of some of the scalar numbers. i8->float requires a pair of shifts to clear the upper bits before doing an iXLen->float conversion for example. So if we were to fix that, it would be wrong for vectors.
> My point to use scalar cost is just it is simple to implement and enough to make vectorizer think vectorizing casting instructions is profitable in most cases.
>
> I had written a version by vector instruction count. The logic is a little complex and I am not sure when to consider vsetvli and even lmul. I think maybe we should refine it to a table having some magic number like X86 and Arm, so I just provide the simple design now.
Please add a FIXME to document what is missing.
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