+2015-03-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/65494
+ * tree-vect-slp.c (vect_build_slp_tree): Do not (re-)allocate
+ matches here.
+ (vect_analyze_slp_instance): But do that here, always and once.
+
2015-03-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* expmed.c (synth_mult): Fix comment about multiplying by T-1 and
--- /dev/null
+/* { dg-do compile } */\r
+/* { dg-additional-options "-Ofast -funroll-loops" } */\r
+\r
+typedef unsigned char uchar;\r
+typedef struct rgb_ {uchar r; uchar g; uchar b;} rgb;\r
+#define N 512\r
+rgb in[N], out[N];\r
+float c[N];\r
+void foo(int n)\r
+{\r
+ int i, j;\r
+ for (i = 0; i < n; i++) //in and out are RGB byte arrays\r
+ {\r
+ float r = 0, g = 0, b = 0;\r
+ for (j = 0; j < 5; j++)\r
+ {\r
+ r += (float)in[i + j].r * c[j];\r
+ g += (float)in[i + j].g * c[j];\r
+ b += (float)in[i + j].b * c[j];\r
+ }\r
+ out[i].r = (uchar)r;\r
+ out[i].g = (uchar)g;\r
+ out[i].b = (uchar)b;\r
+ }\r
+}\r
+\r
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { target { vect_float && vect_intfloat_cvt } } } } */\r
+/* { dg-final { cleanup-tree-dump "vect" } } */\r
bool *matches, unsigned *npermutes, unsigned *tree_size,
unsigned max_tree_size)
{
- unsigned nops, i, this_npermutes = 0, this_tree_size = 0;
+ unsigned nops, i, this_tree_size = 0;
gimple stmt;
- if (!matches)
- matches = XALLOCAVEC (bool, group_size);
- if (!npermutes)
- npermutes = &this_npermutes;
-
matches[0] = false;
stmt = SLP_TREE_SCALAR_STMTS (*node)[0];
return false;
}
- bool *matches = XALLOCAVEC (bool, group_size);
if (vect_build_slp_tree (loop_vinfo, bb_vinfo, &child,
group_size, max_nunits, loads,
vectorization_factor, matches,
loads.create (group_size);
/* Build the tree for the SLP instance. */
+ bool *matches = XALLOCAVEC (bool, group_size);
+ unsigned npermutes = 0;
if (vect_build_slp_tree (loop_vinfo, bb_vinfo, &node, group_size,
&max_nunits, &loads,
- vectorization_factor, NULL, NULL, NULL,
+ vectorization_factor, matches, &npermutes, NULL,
max_tree_size))
{
/* Calculate the unrolling factor based on the smallest type. */