--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+static void addPrior(float center_x, float center_y, float width, float height,
+ bool normalized, float *dst)
+{
+ if (normalized)
+ {
+ dst[0] = (center_x - width * 0.5f);
+ dst[1] = (center_y - height * 0.5f);
+ dst[2] = (center_x + width * 0.5f);
+ dst[3] = (center_y + height * 0.5f);
+ }
+ else
+ {
+ dst[0] = center_x - width * 0.5f;
+ dst[1] = center_y - height * 0.5f;
+ dst[2] = center_x + width * 0.5f - 1.0f;
+ dst[3] = center_y + height * 0.5f - 1.0f;
+ }
+}
+void forward(float *outputPtr, int _offsetsXs, float *_offsetsX,
+ float *_offsetsY, float _stepX, float _stepY,
+ bool _bboxesNormalized, float _boxWidth, float _boxHeight)
+{
+ for (int j = 0; j < _offsetsXs; ++j)
+ {
+ float center_x = (_offsetsX[j]) * _stepX;
+ float center_y = (_offsetsY[j]) * _stepY;
+ addPrior(center_x, center_y, _boxWidth, _boxHeight, _bboxesNormalized,
+ outputPtr);
+ outputPtr += 4;
+ }
+}
static bool vectorizable_slp_permutation (vec_info *, gimple_stmt_iterator *,
slp_tree, stmt_vector_for_cost *);
static void vect_print_slp_tree (dump_flags_t, dump_location_t, slp_tree);
+static bool vect_slp_can_convert_to_external (const vec<stmt_vec_info> &);
static object_allocator<_slp_tree> *slp_tree_pool;
static slp_tree slp_first_node;
for (j = 0; j < group_size; ++j)
if (!matches[j])
break;
- if (!known_ge (j, TYPE_VECTOR_SUBPARTS (vectype)))
+ if (!known_ge (j, TYPE_VECTOR_SUBPARTS (vectype))
+ && vect_slp_can_convert_to_external (oprnd_info->def_stmts))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
node, node_instance, cost_vec);
}
+/* Verify if we can externalize a set of internal defs. */
+
+static bool
+vect_slp_can_convert_to_external (const vec<stmt_vec_info> &stmts)
+{
+ basic_block bb = NULL;
+ for (stmt_vec_info stmt : stmts)
+ if (!stmt)
+ return false;
+ /* Constant generation uses get_later_stmt which can only handle
+ defs from the same BB. */
+ else if (!bb)
+ bb = gimple_bb (stmt->stmt);
+ else if (gimple_bb (stmt->stmt) != bb)
+ return false;
+ return true;
+}
+
/* Try to build NODE from scalars, returning true on success.
NODE_INSTANCE is the SLP instance that contains NODE. */
|| !SLP_TREE_SCALAR_STMTS (node).exists ()
|| vect_contains_pattern_stmt_p (SLP_TREE_SCALAR_STMTS (node))
/* Force the mask use to be built from scalars instead. */
- || VECTOR_BOOLEAN_TYPE_P (SLP_TREE_VECTYPE (node)))
+ || VECTOR_BOOLEAN_TYPE_P (SLP_TREE_VECTYPE (node))
+ || !vect_slp_can_convert_to_external (SLP_TREE_SCALAR_STMTS (node)))
return false;
- FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
- if (!stmt_info)
- return false;
-
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"Building vector operands of %p from scalars instead\n",