mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:50:26 +08:00
tree-vectorizer.h (vectorizable_function): Export.
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. From-SVN: r119362
This commit is contained in:
parent
3c4ace25d7
commit
c6b1b49b1e
@ -1,3 +1,12 @@
|
||||
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.
|
||||
|
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
14
gcc/testsuite/gcc.dg/vect/fast-math-vect-pow-1.c
Normal file
14
gcc/testsuite/gcc.dg/vect/fast-math-vect-pow-1.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* { 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" } } */
|
@ -1,14 +0,0 @@
|
||||
/* { 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" } } */
|
@ -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;
|
||||
|
@ -1570,7 +1570,7 @@ vectorizable_reduction (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
|
||||
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);
|
||||
|
@ -398,6 +398,7 @@ extern bool vectorizable_operation (tree, block_stmt_iterator *, tree *);
|
||||
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 *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user