[llvm] [AArch64][CostModel] Model sve costs for ctpop (PR #192428)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 03:47:50 PDT 2026


================

----------------
paulwalker-arm wrote:

`getTypeLegalizationCost` returns the legal type along with a legalisation cost.  As we know `MTy` is a legal fixed length vector we know it can be held in a single SVE register.

That means we just need to convert the fixed length vector type into the scalable vector type that will be used when the operation is lowered.  There is only a single legal scalable packed vector MVT for each element type, and the known part of the element count is "how many of these elements can be stored in a 128-bit vector" because the minimum SVE vector length is 128-bit.

https://github.com/llvm/llvm-project/pull/192428


More information about the llvm-commits mailing list