The piece of code tries to use splat+shift to lower build_vector with repeating bit pattern. And immediate field of vector splat is only 5 bits (-16~15). It iterates over them one by one to find which shifts/rotates to number in build_vector.
This patch removes code to try matching constant with algebraic right-shift because that's meaningless - any negative number's algebraic right-shift won't produce result smaller than itself. Also, (int)((unsigned)i >> j) means logical shift-right in C.
Have you been able to look at these at all? PR47942 mentions that we have no code coverage for the vsldoi 2/3 cases