[PATCH] D132296: [RISCV] Add cost model for compare and select instructions.

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 04:48:12 PDT 2022


jacquesguan added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:591
+        VecPred == CmpInst::FCMP_OLT || VecPred == CmpInst::FCMP_OLE ||
+        VecPred == CmpInst::FCMP_UNE) {
+      return LT.first * 1;
----------------
reames wrote:
> The fcmp handling isn't right for the case where you have a vector hardware without float or double.  This is the same problem I ran into on the intrinsic costing side.  
Thanks a lot, if the target do not support the input floating point vector type(need to scalarize), I change it to use the base function.
The way the base function calculates the cost (ScalarizeCost + ElementNum * ScalarCost for fixed vector, InvalidCost for scalable vector) is right. But the cost of scalar fp compare instruction is also wrong (now is alway 1, but actually some need external call and some need more instruction) for RISCV, so we still get wrong result now. 
I leave a TODO for scalar compare cost, need to create a cost list maybe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132296



More information about the llvm-commits mailing list