aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2015-09-03 13:52:17 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2015-09-03 13:52:17 +0000
commit5179d2a2137d80c429ecd01dd0aeab415ffd299e (patch)
tree0dacf1cdc1177d00d75d9e223e6b76bc69512a66 /gcc/optabs.c
parent4413ddbcb262f848946b4d71bbaafe2ee02417e0 (diff)
downloadgcc-5179d2a2137d80c429ecd01dd0aeab415ffd299e.zip
gcc-5179d2a2137d80c429ecd01dd0aeab415ffd299e.tar.gz
gcc-5179d2a2137d80c429ecd01dd0aeab415ffd299e.tar.bz2
optabs.c (expand_binop): Don't create a broadcast vector with a source element wider than the inner mode.
[gcc] 2015-09-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * optabs.c (expand_binop): Don't create a broadcast vector with a source element wider than the inner mode. [gcc/testsuite] 2015-09-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/vec-shift.c: New test. From-SVN: r227444
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e533e6e..79c6f06 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1608,6 +1608,15 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (otheroptab && optab_handler (otheroptab, mode) != CODE_FOR_nothing)
{
+ /* The scalar may have been extended to be too wide. Truncate
+ it back to the proper size to fit in the broadcast vector. */
+ machine_mode inner_mode = GET_MODE_INNER (mode);
+ if (!CONST_INT_P (op1)
+ && (GET_MODE_BITSIZE (inner_mode)
+ < GET_MODE_BITSIZE (GET_MODE (op1))))
+ op1 = force_reg (inner_mode,
+ simplify_gen_unary (TRUNCATE, inner_mode, op1,
+ GET_MODE (op1)));
rtx vop1 = expand_vector_broadcast (mode, op1);
if (vop1)
{