On Tue, Mar 24, 2020 at 10:45 AM Stefan Schulze Frielinghaus <stefa...@linux.ibm.com> wrote: > > On Mon, Mar 23, 2020 at 04:44:56PM +0100, Richard Biener wrote: > > On Mon, Mar 23, 2020 at 4:34 PM Jakub Jelinek <ja...@redhat.com> wrote: > > > > > > On Mon, Mar 23, 2020 at 04:29:12PM +0100, Richard Biener wrote: > > > > I wonder if we can leverage the bswap pass for rotate detection > > > > (see find_bswap_or_nop which matches the symbolic number > > > > against either 1:1 or byte-swapped variants, to be added would be > > > > rotate and shift patterns). > > > > > > That pass can only handle cases where the shift counts are multiple of > > > BITS_PER_UNIT, the whole infrastructure is based on being able to track > > > movements of bytes. > > > > That's true, but also an artifact of the symbolic number encoding. > > I'm pretty new to match.pd and in general to GCC. Is there something > which speaks against solving this in match.pd? If so and the bswap pass > is also not the right place, do you have something else in mind?
For match.pd the patterns tend to be unwieldly so currently this is pattern-matched in tree-ssa-forwprop.c:simplify_rotate which is the place I'd see to extend. Richard.