On 10/11/24 4:28 AM, Richard Sandiford wrote:
Kyrylo Tkachov <ktkac...@nvidia.com> writes:
Hi all,
In the testcase from patch [2/2] we want to match a vector rotate operation from
an IOR of left and right shifts by immediate. simplify-rtx has code for just
that but it looks like it's prepared to do handle only scalar operands.
In practice most of the code works for vector modes as well except the shift
amounts are checked to be CONST_INT rather than vector constants that we have
here. This is easily extended by using unwrap_const_vec_duplicate to extract
the repeating constant shift amount.
FWIW, shifting a vector by a scalar is valid rtl (at least AIUI), so the
current code does handle that case. But I agree it's missing shifting a
vector by a vector.
That's my understanding as well.
I suppose a fancy version would be to check the rotate condition for each
individual element of the vector shift amount. Checking the duplicate
case is definitely a good (and strict) improvement over the status quo
though.
And probably captures the majority of real world optimizable cases.
Hard to see the "fancy" version triggering all that much.
jeff