rs6000: Do not allow out of range immediate in vsplt[bhw] (PR86987)
authorSegher Boessenkool <segher@kernel.crashing.org>
Tue, 25 Sep 2018 22:09:38 +0000 (00:09 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Tue, 25 Sep 2018 22:09:38 +0000 (00:09 +0200)
commita9f6e019d15819f52b312e1b10cd460b59b57780
treea86f836eaece5938503f3dc5239a556155fc6117
parentee8505183c50f850509bf52855488259c53544fc
rs6000: Do not allow out of range immediate in vsplt[bhw] (PR86987)

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.

PR target/86987
* 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.

From-SVN: r264584
gcc/ChangeLog
gcc/config/rs6000/altivec.md
gcc/config/rs6000/rs6000.c