[PATCH] D133955: [AArch64][CostModel] Add costs for fixed operations when using fixed vectors over SVE

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 12:32:51 PDT 2022


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1909-1911
+            MVT::getVectorVT(DstTy.getSimpleVT().getVectorElementType(),
+                             DstTy.getSimpleVT().getVectorMinNumElements(),
+                             true),
----------------
This translation from fixed length vector to scalable vector is too literal and leads to issues as shown by your tests. See
```
; FIXED-OVER-SVE2048-NEXT:  Cost Model: Found an estimated cost of 106 for instruction: %s16i32i64 = sext <16 x i32> undef to <16 x i64>
```
A cost of 106 instructions for something that will only emit a handful of instructions? (see `sext_v16i32_v16i64` from `llvm/test/CodeGen/AArch64/sve-fixed-length-int-extends.ll`).

Instead, you want to calculate the number of legal scalable vector types it takes to hold the fixed length vector.  There's probably room here for a helper function as this logic is likely to be common across all such cost functions.




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

https://reviews.llvm.org/D133955



More information about the llvm-commits mailing list