The VEC_LSHIFT_EXPR tree code, and the corresponding vec_shl_optab, seem to have
been added for completeness, providing a counterpart to VEC_RSHIFT_EXPR and
vec_shr_optab. However, whereas VEC_RSHIFT_EXPRs are generated (only) by the
vectorizer, VEC_LSHIFT_EXPR expressions are not generated at all, so there seems
little point in maintaining it.
Bootstrapped on x86_64-unknown-linux-gnu.
aarch64.exp+vect.exp on aarch64-none-elf and aarch64_be-none-elf.
gcc/ChangeLog:
* expr.c (expand_expr_real_2): Remove code handling VEC_LSHIFT_EXPR.
* fold-const.c (const_binop): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* tree-inline.c (estimate_operator_cost, dump_generic_node,
op_code_prio, op_symbol_code): Likewise.
* tree-vect-generic.c (expand_vector_operations_1): Likewise.
* optabs.c (optab_for_tree_code): Likewise.
(expand_vec_shift_expr): Likewise, update comment.
* tree.def: Delete VEC_LSHIFT_EXPR, remove comment.
* optabs.h (expand_vec_shift_expr): Remove comment re. VEC_LSHIFT_EXPR.
* optabs.def: Remove vec_shl_optab.
* doc/md.texi: Remove references to vec_shr_m.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index f6da5d632f441544fdacafc266e9cf17083a825a..6b46b08538c01190215a174773dfcb1109134873 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -4592,7 +4592,6 @@ expand_debug_expr (tree exp)
case REDUC_MIN_EXPR:
case REDUC_PLUS_EXPR:
case VEC_COND_EXPR:
- case VEC_LSHIFT_EXPR:
case VEC_PACK_FIX_TRUNC_EXPR:
case VEC_PACK_SAT_EXPR:
case VEC_PACK_TRUNC_EXPR:
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index a78aea2f3f6e35b0d89719a42d734e62a2f5bd65..f94e0f62c622d43e2df0d0619fb1eba74c415165 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -4883,10 +4883,9 @@ operand 1. Add operand 1 to operand 2 and place the widened result in
operand 0. (This is used express accumulation of elements into an accumulator
of a wider mode.)
-@cindex @code{vec_shl_@var{m}} instruction pattern
@cindex @code{vec_shr_@var{m}} instruction pattern
-@item @samp{vec_shl_@var{m}}, @samp{vec_shr_@var{m}}
-Whole vector left/right shift in bits.
+@item @samp{vec_shr_@var{m}}
+Whole vector right shift in bits.
Operand 1 is a vector to be shifted.
Operand 2 is an integer shift amount in bits, which must be a multiple of the
element size.
diff --git a/gcc/expr.c b/gcc/expr.c
index 11930ca121e4e1f3807261a2e5b0ca4f6723176d..30ea87af3ef102d7071c6c29db37df875af316f5 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9053,7 +9053,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
return temp;
}
- case VEC_LSHIFT_EXPR:
case VEC_RSHIFT_EXPR:
{
target = expand_vec_shift_expr (ops, target);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b8baa94d37a74ebb824e2a4d03f2a10befcdf749..bd4ba5f0c64c710df9fa36d4059f7b08e949fae0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1406,8 +1406,7 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
int count = TYPE_VECTOR_SUBPARTS (type), i;
tree *elts = XALLOCAVEC (tree, count);
- if (code == VEC_LSHIFT_EXPR
- || code == VEC_RSHIFT_EXPR)
+ if (code == VEC_RSHIFT_EXPR)
{
if (!tree_fits_uhwi_p (arg2))
return NULL_TREE;
@@ -1419,11 +1418,10 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
if (shiftc >= outerc || (shiftc % innerc) != 0)
return NULL_TREE;
int offset = shiftc / innerc;
- /* The direction of VEC_[LR]SHIFT_EXPR is endian dependent.
- For reductions, compiler emits VEC_RSHIFT_EXPR always,
- for !BYTES_BIG_ENDIAN picks first vector element, but
- for BYTES_BIG_ENDIAN last element from the vector. */
- if ((code == VEC_RSHIFT_EXPR) ^ (!BYTES_BIG_ENDIAN))
+ /* The direction of VEC_RSHIFT_EXPR is endian dependent.
+ For reductions, if !BYTES_BIG_ENDIAN then compiler picks first
+ vector element, but last element if BYTES_BIG_ENDIAN. */
+ if (BYTES_BIG_ENDIAN)
offset = -offset;
tree zero = build_zero_cst (TREE_TYPE (type));
for (i = 0; i < count; i++)
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e422bcce18d06a39b26547b510c35858efc2303e..9c5b5daa6f2b51bda5ba92fcd61534f1dd55e646 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -515,9 +515,6 @@ optab_for_tree_code (enum tree_code code, const_tree type,
case REDUC_PLUS_EXPR:
return reduc_plus_scal_optab;
- case VEC_LSHIFT_EXPR:
- return vec_shl_optab;
-
case VEC_RSHIFT_EXPR:
return vec_shr_optab;
@@ -765,7 +762,7 @@ force_expand_binop (enum machine_mode mode, optab binoptab,
return true;
}
-/* Generate insns for VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR. */
+/* Generate insns for VEC_RSHIFT_EXPR. */
rtx
expand_vec_shift_expr (sepops ops, rtx target)
@@ -776,21 +773,10 @@ expand_vec_shift_expr (sepops ops, rtx target)
enum machine_mode mode = TYPE_MODE (ops->type);
tree vec_oprnd = ops->op0;
tree shift_oprnd = ops->op1;
- optab shift_optab;
- switch (ops->code)
- {
- case VEC_RSHIFT_EXPR:
- shift_optab = vec_shr_optab;
- break;
- case VEC_LSHIFT_EXPR:
- shift_optab = vec_shl_optab;
- break;
- default:
- gcc_unreachable ();
- }
+ gcc_assert (ops->code == VEC_RSHIFT_EXPR);
- icode = optab_handler (shift_optab, mode);
+ icode = optab_handler (vec_shr_optab, mode);
gcc_assert (icode != CODE_FOR_nothing);
rtx_op1 = expand_normal (vec_oprnd);
diff --git a/gcc/optabs.def b/gcc/optabs.def
index 131ea048b012b073345be3b426d4ac8f33061809..a07e1639ed680ad49765cfe7b2df020df06f4e29 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -276,7 +276,6 @@ OPTAB_D (vec_perm_const_optab, "vec_perm_const$a")
OPTAB_D (vec_perm_optab, "vec_perm$a")
OPTAB_D (vec_realign_load_optab, "vec_realign_load_$a")
OPTAB_D (vec_set_optab, "vec_set$a")
-OPTAB_D (vec_shl_optab, "vec_shl_$a")
OPTAB_D (vec_shr_optab, "vec_shr_$a")
OPTAB_D (vec_unpacks_float_hi_optab, "vec_unpacks_float_hi_$a")
OPTAB_D (vec_unpacks_float_lo_optab, "vec_unpacks_float_lo_$a")
diff --git a/gcc/optabs.h b/gcc/optabs.h
index d9f4900620a13d74fc3dfb1bac9bcb34416012de..1085047721ed1350866de3b1c981531a3095d93e 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -240,7 +240,7 @@ bool expand_vec_cond_expr_p (tree, tree);
/* Generate code for VEC_COND_EXPR. */
extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx);
-/* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
+/* Generate code for VEC_RSHIFT_EXPR. */
extern rtx expand_vec_shift_expr (sepops, rtx);
/* Return true if target supports vector operations for VEC_PERM_EXPR. */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1ea2e256b09b25331810a57a9c35e5cc875d0404..7b73090f26b001db400c436dae8a250c0d06a6dc 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3648,7 +3648,6 @@ verify_gimple_assign_binary (gimple stmt)
return false;
}
- case VEC_LSHIFT_EXPR:
case VEC_RSHIFT_EXPR:
{
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b6ecaa4b25a9a7f907ace67332ae6b1540189c4c..ca5a676a2c5b93c6e7adfdc6b5e3d96847c797dc 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3689,7 +3689,6 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights,
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
- case VEC_LSHIFT_EXPR:
case VEC_RSHIFT_EXPR:
case BIT_IOR_EXPR:
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index aee03319cf0bb8fa06fb420d111461b036749164..2d18d56115bcc0873f88973865cf98164c466491 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1836,7 +1836,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
- case VEC_LSHIFT_EXPR:
case VEC_RSHIFT_EXPR:
case WIDEN_LSHIFT_EXPR:
case BIT_IOR_EXPR:
@@ -3001,7 +3000,6 @@ op_code_prio (enum tree_code code)
case REDUC_MAX_EXPR:
case REDUC_MIN_EXPR:
case REDUC_PLUS_EXPR:
- case VEC_LSHIFT_EXPR:
case VEC_RSHIFT_EXPR:
case VEC_UNPACK_HI_EXPR:
case VEC_UNPACK_LO_EXPR:
@@ -3112,9 +3110,6 @@ op_symbol_code (enum tree_code code)
case RROTATE_EXPR:
return "r>>";
- case VEC_LSHIFT_EXPR:
- return "v<<";
-
case VEC_RSHIFT_EXPR:
return "v>>";
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index f631c99cc0b2a5af244033162f86bb409575d494..b9a0aea6ddd58f972e05fbd506981a10687b349b 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1595,7 +1595,7 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
if (compute_type == type)
return;
- gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
+ gcc_assert (code != VEC_RSHIFT_EXPR);
new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
/* Leave expression untouched for later expansion. */
diff --git a/gcc/tree.def b/gcc/tree.def
index 5406ffe67c53ff3f12920ca8c965cf0740a079c2..ff56bfc18bc00e8dac2dfc072fd4fa878a0f2a04 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -1238,11 +1238,10 @@ DEFTREECODE (WIDEN_LSHIFT_EXPR, "widen_lshift_expr", tcc_binary, 2)
before adding operand three. */
DEFTREECODE (FMA_EXPR, "fma_expr", tcc_expression, 3)
-/* Whole vector left/right shift in bits.
+/* Whole vector right shift in bits.
Operand 0 is a vector to be shifted.
Operand 1 is an integer shift amount in bits, which must be a multiple of the
element size. */
-DEFTREECODE (VEC_LSHIFT_EXPR, "vec_lshift_expr", tcc_binary, 2)
DEFTREECODE (VEC_RSHIFT_EXPR, "vec_rshift_expr", tcc_binary, 2)
/* Widening vector multiplication.