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.
It isn't appropriate to remove a target-independent diagnostic and replace it with a target-specific one (even if it's just in the name). I think it makes sense to update both err_shufflevector_non_vector and err_shufflevector_incompatible_vector to take an argument for the name of the builtin, but not to replace it with a target-specific one.
I would recommend renaming it to something like:
err_shufflevector_non_vector -> err_vec_builtin_non_vector
err_shufflevector_incompatible_vector -> err_vec_builtin_incompatible_vector
and add the parameter.