[llvm] [AArch64][GlobalISel] Select UMULL instruction (PR #65469)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 05:47:38 PDT 2023


aemerson wrote:

> That matches how this patch currently works, and I think the testcase works with it. There is a call to fewerElementsVector, it just gets complex with the way larger vectors are expanded and the order nodes are visited during legalization.

Indeed, I see that now. Not sure how I managed to see non-scalarization behaviour, must have done something wrong on my end.
 
> ...
> 
> I think there are several ways to try and get this to work, they each have some difficulties.
> 
>     * Do it post-legalization by letting the v2i64 mul scalarize and getting it to recombine later. I don't think this would work very well as it's often too difficult or impossible to reliably recombine the scalarized muls.
Yep, agreed on this.
> 
>     * Do it during legalization like this patch does. It just needs to deal with the case where the larger types are being split as operation is being legalized, and still generate something that is optimal. From what I can tell this seems to work (minus my comment about multi-use extends).
I'm generally ok with this now that I'm no longer blind and see the fewerElementsVector being called.
> 
>     * Do it pre-legalization (or during legalization) but generate UMULL for all type sizes, then have separate legalization for UMULL to split it to legal vectors.
Personally: prefer not to introduce target specific ops before legalization.
> 
>     * Pretend all v2i64 mul are legal and do the legalization of them in AArch64PostLegalizerLowering? The rest of GlobalISel then might believe that v2s64 mul are legal.
This could actually work. Our definition of legal is that the instructions can be "selected", which is a somewhat fuzzier concept than just "`-run-pass=instruction-select` doesn't abort". An instruction doesn't have to have native instruction to be "legal", and our concept of "selection" basically means the mandatory post-legalization pipeline. So as long as the combination of PostLegalizationLowering + InstructionSelect can handle an operation, that to me makes the operation legal. I think this method feels cleaner architecturally to me than the others.




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


More information about the llvm-commits mailing list