The original AltiVec manuals had the immediate lane number in the splat instructions as a 5-bit number, but anything too big has no defined meaning, and gas will choke on it too. This patch disallows it in the instruction patterns as well as in the builtins. This solves PR86987.
- config/rs6000/altivec.md (altivec_vspltb): Use const_0_to_15_operand instead of u5bit_cint_operand. (*altivec_vspltb_internal): Ditto. (altivec_vspltb_direct): Ditto. (altivec_vsplth): Use const_0_to_7_operand instead of u5bit_cint_operand. (*altivec_vsplth_internal): Ditto. (altivec_vsplth_direct): Ditto. (altivec_vspltw): Use const_0_to_3_operand instead of u5bit_cint_operand. (*altivec_vspltw_internal): Ditto. (altivec_vspltw_direct): Ditto. (altivec_vspltsf): Ditto. (*altivec_vspltsf_internal): Ditto.
- config/rs6000/rs6000.c (rs6000_expand_binop_builtin): Handle the
various splats with the proper size immediate. Reorder the various cases by ascending size of immediate, and put all such together.
7961f40be4b rs6000: Do not allow out of range immediate in vsplt[bhw] (PR86987)
gcc/ChangeLog | 21 +++++++++++++
gcc/config/rs6000/altivec.md | 22 +++++++-------
gcc/config/rs6000/rs6000.c | 70 +++++++++++++++++++++++++++++++-------------
3 files changed, 82 insertions(+), 31 deletions(-)