[GCC, Vect] Fix costing for vector shifts
While looking at the vectorization for following example, we realized that
even though vectorizable_shift function was distinguishing vector shifted
by vector from vector shifted by scalar, while modelling the cost it would
always add the cost of building a vector constant despite not needing it for
vector shifted by scalar.
This patch fixes this by using scalar_shift_arg to determine whether we need
to build a vector for the second operand or not. This causes the test case
below to now vectorize.
gcc/ChangeLog:
2019-12-09 Sudakshina Das <sudi.das@arm.com>
Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-stmt.c (vectorizable_shift): Condition ndts for
vect_model_simple_cost call on scalar_shift_arg.
gcc/testsuite/ChangeLog:
2019-12-09 Sudakshina Das <sudi.das@arm.com>
* gcc.dg/vect/vect-shift-5.c: New test.
Co-Authored-By: Richard Sandiford <richard.sandiford@arm.com>
From-SVN: r279114