+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.
+
2019-12-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92834
+2019-12-09 Sudakshina Das <sudi.das@arm.com>
+
+ * gcc.dg/vect/vect-shift-5.c: New test.
+
2019-12-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92834
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+
+typedef unsigned int uint32_t;
+typedef short unsigned int uint16_t;
+
+int foo (uint32_t arr[4][4])
+{
+ int sum = 0;
+ for(int i = 0; i < 4; i++)
+ {
+ sum += ((arr[0][i] >> 10) * 20) + ((arr[1][i] >> 11) & 53)
+ + ((arr[2][i] >> 12) * 7) + ((arr[3][i] >> 13) ^ 43);
+ }
+ return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1;
+}
+
+/* { dg-final { scan-tree-dump {vectorizable_shift ===[\n\r][^\n]*prologue_cost = 0} "vect" } } */
{
STMT_VINFO_TYPE (stmt_info) = shift_vec_info_type;
DUMP_VECT_SCOPE ("vectorizable_shift");
- vect_model_simple_cost (stmt_info, ncopies, dt, ndts, slp_node, cost_vec);
+ vect_model_simple_cost (stmt_info, ncopies, dt,
+ scalar_shift_arg ? 1 : ndts, slp_node, cost_vec);
return true;
}