On Fri, Aug 06, 2021 at 11:55:52AM +0100, Richard Sandiford wrote: > liuhongt via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > > Hi: > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > Ok for trunk? > > I think if anything the canonicalisation should be the other way: > if the shift amount is an in-range constant, we know that it fits > within a vector element, and so the vector form should be preferred.
Yeah. And the canonicalisation needs to be documented *first*, i.e. we have to agree on it first, *before* patches doing this to simplify-rtx are acceptable. We don't do design-by-fait-accompli. Any canonicalisation also has to fit in well with other canonicalisations, or we will be better off not having canonical forms. If it turns out there is no good canonical form, we will simply have to handle both forms (or more than two perhaps). This isn't the end of the world, we have to do that already. If we can simplify things with a canonical form, that is great; if that causes too much extra work instead, it is not so great. These things have to be thought about. Segher