This patch teaches InstCombiner how to convert a SSSE3/AVX2 byte shuffle to a builtin shuffle if the mask is constant.
Converting byte shuffle intrinsic calls to builtin shuffles can help finding more opportunities for combining shuffles later on in selection dag.
We may end up with byte shuffles with constant masks as the result of inlining.
Added test x86-pshufb.ll.
Please let me know if ok to submit.
Thanks,
Andrea
I don't think this is correct - AVX2 pshufb doesn't reuse the lower 128-bit lane it uses its own lane but with 'local' index values (0-15 representing the 16-31 of a shufflevector),
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=shuffle_epi8&expand=4700