diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-30 14:30:00 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-11-30 14:30:00 +0000 |
commit | 4957645dcb9d4a3b980a487c3b33f93cb378a326 (patch) | |
tree | af44eced0f1123048c473eb4dc1a457dd2088947 /gcc/tree-vect-patterns.c | |
parent | 8a355d81c3be6ea2e6f9cfae2d5b5ff1a28349b2 (diff) | |
download | gcc-4957645dcb9d4a3b980a487c3b33f93cb378a326.tar.gz |
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.
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119362 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 3e40fc79b5a..6d5d3dcf35c 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -466,7 +466,6 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out) /* 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. */ @@ -474,7 +473,10 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out) && 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 @@ -482,7 +484,13 @@ vect_recog_pow_pattern (tree last_stmt, tree *type_in, tree *type_out) { 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; |