MatzeB wrote:

> I have always expected shuffles to be canonicalized to make the lowest mask 
> lane the first operand. I believe the AArch64 and Arm matching functions rely 
> on that at the moment. https://godbolt.org/z/1rr1E8v1K

Thanks for pointing this out! So definitely cannot land the change as-is. I 
would still argue it is generally the right thing to do: We definitely need to 
normalize by some rule to enable CSE and hit better code generation path (as 
your example also demonstrates).

Normalizing for low complexity on RHS comes from working on #113746 which 
slightly simplifies things when we can assume constants being always on the 
RHS. And this also being a well established pattern for arithmetic operations 
(add, mul, bitops). But I think that doesn't rule out normalizing for something 
different at ISel time.

Let me investigate the situation for the popular targets. FWIW: I don't 
strictly need this rule for my immediate work; this is more of a drive-by fix 
that seemed worth doing to me. So happy to drop this change if people aren't 
comfortable with it...

https://github.com/llvm/llvm-project/pull/113212
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to