Hi! I've noticed that if we construct a VEC_SERIES and later propagate constants into both arguments (could happen e.g. in DEBUG_INSNs, or during combine etc.) we don't simplify that.
The following patch adds that, ok for trunk if it passes bootstrap/regtest? Or should it go into simplify_constant_binary_operation instead? In there it would better match the function name, on the other side it would slow down the function for quite a marginal case, because it doesn't have a big switch on code, but instead handles just a few cases if constant operand kinds vs. the mode. 2017-11-22 Jakub Jelinek <ja...@redhat.com> * simplify-rtx.c (simplify_binary_operation_1) <case VEC_SERIES>: Handle the case where both arguments are using gen_const_vec_series. --- gcc/simplify-rtx.c.jj 2017-11-20 11:02:42.000000000 +0100 +++ gcc/simplify-rtx.c 2017-11-22 12:30:46.808056343 +0100 @@ -3566,6 +3566,8 @@ simplify_binary_operation_1 (enum rtx_co case VEC_SERIES: if (op1 == CONST0_RTX (GET_MODE_INNER (mode))) return gen_vec_duplicate (mode, op0); + if (CONSTANT_P (op0) && CONSTANT_P (op1)) + return gen_const_vec_series (mode, op0, op1); return 0; case VEC_SELECT: @@ -6652,6 +6654,9 @@ test_vector_ops_series (machine_mode mod ASSERT_RTX_EQ (series_r_1, simplify_binary_operation (MINUS, mode, duplicate, series_0_m1)); + ASSERT_RTX_EQ (series_0_m1, + simplify_binary_operation (VEC_SERIES, mode, const0_rtx, + constm1_rtx)); } /* Verify some simplifications involving vectors. */ Jakub