[PATCH] D129994: [RISCV] Add cost modelling for vector widenning integer reduction.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 10:26:20 PDT 2022


reames requested changes to this revision.
reames added a comment.
This revision now requires changes to proceed.

Thanks for the rework of the API, much improved!

I'd still *prefer* a vectorizer test here, but won't strictly require one.



================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:397
+
+  switch (ISD) {
+  case ISD::ADD:
----------------
It's not really clear to me why you bother to translate to ISD here.  The code would be much clearer as:


```
if (Opcode != Add && Opcode != FAdd)
  return ...
if (width check fails)
  return ...

std::pair<InstructionCost, MVT> LT = TLI->getTypeLegalizationCost(DL, ValTy);
return (LT.first - 1) +
             getArithmeticReductionCost(Opcode, ValTy, FMF, CostKind);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129994



More information about the llvm-commits mailing list