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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 09:37:14 PST 2024


topperc 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.

Yes the only scalable shufflevector supported is a splat of element 0. The different between ISD::SHUFFLE_VECTOR and ISD::SPLAT_VECTOR is that ISD::SHUFFLE_VECTOR takes a vector input and ISD::SPLAT_VECTOR takes a scalar input.

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


More information about the llvm-commits mailing list