[llvm] [RISCV][GISEL] Add IRTranslation for shufflevector on scalable vector types (PR #80378)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 08:04:10 PST 2024


michaelmaitland wrote:

> > > SelectionDAG doesn't support ISD::SHUFFLEVECTOR for scalable vectors. It only supports ISD::SPLAT_VECTOR. Are we trying to do something different for GISel for some reason?
> > 
> > 
> > I intend to write a patch after this that combines g_insert_element + g_shuffle_vector into g_splat_vector where appropriate. For scalable vectors, that is in all cases since the mask index vector is always zeroinit (undef case can be treated as zeroinit).
> 
> What if the G_INSERT_ELT doesn't exist? SelectionDAG always creates an extract+splat_vector when it translates a scalable shufflevector.

Now that I think more about it, I am pretty sure that G_SHUFFLE_VECTOR for scalable vectors is the same thing as a splat, since the mask is always taking from index zero. If there is no insertelement before it, then we are splatting whatever is in index 0 of the input vector.

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


More information about the llvm-commits mailing list