+2007-10-22 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/33834
+ PR tree-optimization/33835
+ * tree-vect-analyze.c (vect_analyze_operations): RELEVANT and LIVE stmts
+ need to be checked for success seperately.
+ * tree-vect-transform.c (vectorizable_call, vectorizable_conversion):
+ Remove the check that stmt is not LIVE.
+ (vectorizable_assignment, vectorizable_induction): Likewise.
+ (vectorizable_operation, vectorizable_type_demotion): Likewise.
+ (vectorizable_type_promotion, vectorizable_load, vectorizable_store):
+ Likewise.
+ (vectorizable_live_operation): Check that op is not NULL.
+
2007-10-22 Janis Johnson <janis187@us.ibm.com>
* doc/invoke.texi (Optimization Options): In the summary, show
+2007-10-22 Martin Michlmayr <tbm@cyrius.com>
+ Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/33834
+ PR tree-optimization/33835
+ * g++.dg/vect/pr33834_1.cc: New test.
+ * g++.dg/vect/pr33834_2.cc: New test.
+ * g++.dg/vect/pr33835.cc: New test.
+
2007-10-22 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/pr33644.c: New test.
--- /dev/null
+/* { dg-do compile } */
+
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+extern double cos (double x);
+extern double sin (double x);
+
+class bend_class
+{
+ double *s_A;
+public:
+ void set_s_A (double s_A0)
+ {
+ s_A[0] = s_A0;
+ }
+};
+class bend_set
+{
+ bend_class *bend_array;
+public:
+ void set_s_A (int index, double s_A0)
+ {
+ bend_array[index].set_s_A (s_A0);
+ }
+ void compute_s (void)
+ {
+ int i, j;
+ double val;
+ double tmp[3];
+ for (i = 0; i < 5; ++i)
+ {
+ val = i;
+ for (j = 0; j < 2; ++j)
+ tmp[j] = cos (val);
+ set_s_A (i, tmp[0]);
+ tmp[j] = cos (val) / sin (val);
+ }
+ }
+};
+class internals
+{
+ bend_set bend;
+ void compute_s (void);
+};
+void
+internals::compute_s (void)
+{
+ bend.compute_s ();
+}
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftree-vectorize" } */
+
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+extern int sscanf (__const char *__restrict __s,
+ __const char *__restrict __format, ...);
+unsigned char got_elevation_pattern;
+struct site
+{
+ float antenna_pattern[361][1001];
+}
+LR;
+void
+LoadPAT (char *filename)
+{
+ int x, y;
+ char string[255];
+ float elevation, amplitude, elevation_pattern[361][1001];
+ for (x = 0; filename[x] != '.' ; x++)
+ sscanf (string, "%f %f", &elevation, &litude);
+ for (y = 0; y <= 1000; y++)
+ {
+ if (got_elevation_pattern)
+ elevation = elevation_pattern[x][y];
+ else
+ elevation = 1.0;
+ LR.antenna_pattern[x][y] = elevation;
+ }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
--- /dev/null
+/* { dg-do compile } */
+
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+extern double cos (double x);
+
+class bend_class
+{
+ double *s_A;
+public:
+ void set_s_A (double s_A0)
+ {
+ s_A[0] = s_A0;
+ }
+};
+class bend_set
+{
+ bend_class *bend_array;
+public:
+ void set_s_A (int index, double s_A0)
+ {
+ bend_array[index].set_s_A (s_A0);
+ }
+ void compute_s (void)
+ {
+ int i, j;
+ double val;
+ double tmp[3];
+ for (i = 0; i < 5; ++i)
+ {
+ val = i;
+ for (j = 0; j < 2; ++j)
+ tmp[j] = cos (val);
+ set_s_A (i, tmp[0]);
+ tmp[j] = cos (val);
+ }
+ }
+};
+class internals
+{
+ bend_set bend;
+ void compute_s (void);
+};
+void
+internals::compute_s (void)
+{
+ bend.compute_s ();
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
need_to_vectorize = true;
}
- ok = (vectorizable_type_promotion (stmt, NULL, NULL)
+ ok = true;
+ if (STMT_VINFO_RELEVANT_P (stmt_info)
+ || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
+ ok = (vectorizable_type_promotion (stmt, NULL, NULL)
|| vectorizable_type_demotion (stmt, NULL, NULL)
|| vectorizable_conversion (stmt, NULL, NULL, NULL)
|| vectorizable_operation (stmt, NULL, NULL, NULL)
|| vectorizable_condition (stmt, NULL, NULL)
|| vectorizable_reduction (stmt, NULL, NULL));
+ if (!ok)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ {
+ fprintf (vect_dump, "not vectorized: relevant stmt not ");
+ fprintf (vect_dump, "supported: ");
+ print_generic_expr (vect_dump, stmt, TDF_SLIM);
+ }
+ return false;
+ }
+
/* Stmts that are (also) "live" (i.e. - that are used out of the loop)
need extra handling, except for vectorizable reductions. */
if (STMT_VINFO_LIVE_P (stmt_info)
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
- ok |= vectorizable_live_operation (stmt, NULL, NULL);
+ ok = vectorizable_live_operation (stmt, NULL, NULL);
if (!ok)
{
if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
{
- fprintf (vect_dump, "not vectorized: stmt not supported: ");
+ fprintf (vect_dump, "not vectorized: live stmt not ");
+ fprintf (vect_dump, "supported: ");
print_generic_expr (vect_dump, stmt, TDF_SLIM);
}
return false;
inner-loop: *(BASE+INIT). (The first location is actually
BASE+INIT+OFFSET, but we add OFFSET separately later. */
tree inner_base = build_fold_indirect_ref
- (fold_build2 (PLUS_EXPR, TREE_TYPE (base), base, init));
+ (fold_build2 (PLUS_EXPR,
+ TREE_TYPE (base), base, init));
if (vect_print_dump_info (REPORT_DETAILS))
{
if (STMT_SLP_TYPE (stmt_info))
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is STMT a vectorizable call? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- /* FORNOW: not yet supported. */
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is vectorizable assignment? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def);
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- /* FORNOW: not yet supported. */
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
if (TREE_CODE (phi) != PHI_NODE)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is STMT a vectorizable binary/unary operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is STMT a vectorizable type-demotion operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is STMT a vectorizable type-promotion operation? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is vectorizable store? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
return false;
- /* FORNOW: not yet supported. */
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "value used after loop.");
- return false;
- }
-
/* Is vectorizable load? */
if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
return false;
for (i = 0; i < op_type; i++)
{
op = TREE_OPERAND (operation, i);
- if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
+ if (op && !vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt))
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "use not simple.");