This patch makes the VEC_SERIES code use valid_for_const_vector_p instead of CONSTANT_P, to match what we already do for VEC_DUPLICATE. This showed up as a failure in gcc.c-torture/execute/pr28982b.c for -m32 on x86_64-linux-gnu after later patches.
Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64-linux-gnu, and with a before-and-after comparison of testsuite output for a range of targets. Applied as obvious. Richard 2017-12-28 Richard Sandiford <richard.sandif...@linaro.org> gcc/ * emit-rtl.c (gen_const_vec_series): Use valid_for_const_vector_p instead of CONSTANT_P. (gen_vec_series): Likewise. * simplify-rtx.c (simplify_binary_operation_1): Likewise. Index: gcc/emit-rtl.c =================================================================== --- gcc/emit-rtl.c 2017-12-23 09:29:19.465366872 +0000 +++ gcc/emit-rtl.c 2017-12-28 16:55:49.382742760 +0000 @@ -5949,7 +5949,8 @@ const_vec_series_p_1 (const_rtx x, rtx * rtx gen_const_vec_series (machine_mode mode, rtx base, rtx step) { - gcc_assert (CONSTANT_P (base) && CONSTANT_P (step)); + gcc_assert (valid_for_const_vector_p (mode, base) + && valid_for_const_vector_p (mode, step)); int nunits = GET_MODE_NUNITS (mode); rtvec v = rtvec_alloc (nunits); @@ -5970,7 +5971,8 @@ gen_vec_series (machine_mode mode, rtx b { if (step == const0_rtx) return gen_vec_duplicate (mode, base); - if (CONSTANT_P (base) && CONSTANT_P (step)) + if (valid_for_const_vector_p (mode, base) + && valid_for_const_vector_p (mode, step)) return gen_const_vec_series (mode, base, step); return gen_rtx_VEC_SERIES (mode, base, step); } Index: gcc/simplify-rtx.c =================================================================== --- gcc/simplify-rtx.c 2017-12-23 09:29:19.493365821 +0000 +++ gcc/simplify-rtx.c 2017-12-28 16:55:49.383742722 +0000 @@ -3590,7 +3590,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)) + if (valid_for_const_vector_p (mode, op0) + && valid_for_const_vector_p (mode, op1)) return gen_const_vec_series (mode, op0, op1); return 0;