[llvm] [RISCV][TTI] Reduce cost of a build_vector pattern (PR #108419)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 07:45:29 PDT 2024


preames wrote:

> We're doing a packed e16 build vector which is then converted to a mask vector.

Not quite.  I found the surrounding code, and I'm pretty sure what we originally had was a build vector of variable i1, which was *lowered to* an i16 build vector and a comparison against zero.  Which is quite odd, as this patch shouldn't be impacting the costing of a <N x i1> build_vector.

> I think we can avoid the vmv.v.i if we move the masking from the vle32.v to the vredor.vs. But that's orthogonal to this PR and I don't think the vectorized code is bad per say, so I think this is fine.

I agree on both points.  I would assume the original code had a vselect with the neutral value after the load and before the reduction.  



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


More information about the llvm-commits mailing list