[llvm] [GlobalISel] Add support to moreElementsVector for G_SEXT, G_ZEXT and G_ANYEXT (PR #85038)

Dhruv Chawla via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 21:08:03 PDT 2024


dc03-work wrote:

> > > Would it be possible to replace `.maxNumElements()` with `.clampNumElements()` in AArch64LegalizerInfo.cpp? Currently moreElements only gets called by `.moreElementsToNextPow2()` for the EXTEND instructions This might help with legalizing quite a few of the failing EXTEND instructions that has been showing up like: `%1:_(<4 x s16>) = G_ZEXT %0:_(<4 x s8>)`
> > 
> > 
> > Hmm, what would the lower bound be in this case?
> 
> The idea would be to (where we can), generally always produce legal types after legalization. Clamp all vector types to 64bit or 128bit, and after legalization only those types would remain, with the intermediate legalization artefacts combined away. So v8i8, v4i16, v2i32 (v1i64 isn't as important in this case).

I don't think legal vector arguments to *ext can be 128 bits wide, so this would basically mean clamping them to always be 64 bits wide. I think this should be a separate patch.

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


More information about the llvm-commits mailing list