[PATCH] D98934: [SVE][CostModel] Add instruction cost for operations on scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 04:11:31 PDT 2021


david-arm added a comment.

Hi @nasherm, thanks for all the good fixes here! I think it looks very close now - just have a couple of minor comments. I'm fine with most of the costs as the most important thing for now is to avoid crashing and we can refine these later if necessary. However, I think the truncation costs probably do need fixing.



================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:382
+    // Truncations on nxvmiN
+    { ISD::TRUNCATE, MVT::nxv2i1, MVT::nxv2i16, 0 },
+    { ISD::TRUNCATE, MVT::nxv2i1, MVT::nxv2i32, 0 },
----------------
I'm not sure that these instructions are 'free', i.e. a cost of 0. For SVE truncation usually involves a cmpXX instruction to generate a predicate, i.e.

  cmpne p1.d, p0/g, z0.d, z1.d

I think we probably want at least a cost of 1 here.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:536
+    { ISD::FP_TO_SINT, MVT::nxv8i64, MVT::nxv8f32, 2 },
+    { ISD::FP_TO_SINT, MVT::nxv8i16, MVT::nxv8f32, 1 },
+    { ISD::FP_TO_SINT, MVT::nxv8i8,  MVT::nxv8f32, 1 },
----------------
I think for conversions from nxv8f32->nxv8i16 there are two instructions + interleaving required here - so maybe a cost of 3?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98934



More information about the llvm-commits mailing list