The vec_xxpermdi builtin is missing from altivec.h. This has been requested by developers working on libvpx for VP9 support for Google (PR: https://bugs.llvm.org/show_bug.cgi?id=32653). Initially, I tried to define a new intrinsic to map it to the corresponding PowerPC hard instruction (XXPERMDI) directly. But there was feedback from the community that this can be done without introducing new intrinsic. This patch re-implement the vec_xxpermdi builtin by using the existing shuffleVector instruction just in the FE.
And we currently won't emit an XXPERMDI when parameters are not vectors of doubleword elements, subsequent BE optimization work needed to identify the correct shuffles so that we can emit XXPERMDI for all types of vector.