+2006-11-30 Richard Guenther <rguenther@suse.de>
+
+ * tree-vectorizer.h (vectorizable_function): Export.
+ * tree-vect-transform.c (vectorizable_function): Likewise.
+ * tree-vect-patterns.c (vect_recog_pow_pattern): Set
+ type_in to scalar type in recognition of squaring.
+ Make sure the target can vectorize sqrt in recognition
+ of sqrt, set type_in to vector type in this case.
+
2006-11-30 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (R10_REG): New constant.
+2006-11-30 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/vect/vect-pow-1.c: Rename ...
+ * gcc.dg/vect/fast-math-vect-pow-1.c: ... to this. Use
+ floats instead of doubles, check successful vectorization.
+
2006-11-29 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR target/29945
--- /dev/null
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+float x[256];
+
+void foo(void)
+{
+ int i;
+ for (i=0; i<256; ++i)
+ x[i] = x[i] * x[i];
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+++ /dev/null
-/* { dg-do compile } */
-/* { dg-options "-O2 -ftree-vectorize -ffast-math -fdump-tree-vect-details" } */
-
-double x[256];
-
-void foo(void)
-{
- int i;
- for (i=0; i<256; ++i)
- x[i] = x[i] * x[i];
-}
-
-/* { dg-final { scan-tree-dump "pattern recognized" "vect" } } */
-/* { dg-final { cleanup-tree-dump "vect" } } */
/* We now have a pow or powi builtin function call with a constant
exponent. */
- *type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
*type_out = NULL_TREE;
/* Catch squaring. */
&& tree_low_cst (exp, 0) == 2)
|| (TREE_CODE (exp) == REAL_CST
&& REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2)))
- return build2 (MULT_EXPR, TREE_TYPE (base), base, base);
+ {
+ *type_in = TREE_TYPE (base);
+ return build2 (MULT_EXPR, TREE_TYPE (base), base, base);
+ }
/* Catch square root. */
if (TREE_CODE (exp) == REAL_CST
{
tree newfn = mathfn_built_in (TREE_TYPE (base), BUILT_IN_SQRT);
tree newarglist = build_tree_list (NULL_TREE, base);
- return build_function_call_expr (newfn, newarglist);
+ *type_in = get_vectype_for_scalar_type (TREE_TYPE (base));
+ if (*type_in)
+ {
+ newfn = build_function_call_expr (newfn, newarglist);
+ if (vectorizable_function (newfn, *type_in))
+ return newfn;
+ }
}
return NULL_TREE;
true if the target has a vectorized version of the function,
or false if the function cannot be vectorized. */
-static bool
+bool
vectorizable_function (tree call, tree vectype)
{
tree fndecl = get_callee_fndecl (call);
extern bool vectorizable_type_promotion (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_type_demotion (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_assignment (tree, block_stmt_iterator *, tree *);
+extern bool vectorizable_function (tree, tree);
extern bool vectorizable_call (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_condition (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_live_operation (tree, block_stmt_iterator *, tree *);