On 9/18/24 12:45 AM, Eikansh Gupta wrote:
The pattern `a rrotate (32-b)` should be optimized to `a lrotate b`.
The same is also true for `a lrotate (32-b)`. It can be optimized to
`a rrotate b`.

This patch adds following patterns:
a rrotate (32-b) -> a lrotate b
a lrotate (32-b) -> a rrotate b

        PR tree-optimization/109906

gcc/ChangeLog:

        * match.pd (a rrotate (32-b) -> a lrotate b): New pattern
        (a lrotate (32-b) -> a rrotate b): New pattern

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/pr109906.c: New test.
Note I think the testcase is specific to 32bit int targets. You probably need to use a target selector to limit it appropriately.

/* { dg-require-effective-target int32 } */
Is probably the magic selector you want...


And you need to indicate where it was bootstrapped and regression tested.

I think the match.pd bits are fine. So it's really just a matter of dotting i's and crossing t's on process and testsuite adjustment.
Jeff

Reply via email to