diff options
author | Richard Guenther <rguenther@suse.de> | 2011-04-20 15:50:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-04-20 15:50:26 +0000 |
commit | d7978bff88f8db16bf28b247d4882c49eaccd623 (patch) | |
tree | 7c56f6bd15fe4c1e8050bc6fbe899c1f27ee8cd1 /gcc | |
parent | 9d12f71a54d11f490dca17c9d1f8a8fdf442dcb9 (diff) | |
download | gcc-d7978bff88f8db16bf28b247d4882c49eaccd623.zip gcc-d7978bff88f8db16bf28b247d4882c49eaccd623.tar.gz gcc-d7978bff88f8db16bf28b247d4882c49eaccd623.tar.bz2 |
re PR c/47892 (Fails to vectorize comparison code, if-conversion fails)
2011-04-20 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47892
* tree-if-conv.c (if_convertible_stmt_p): Const builtins
are if-convertible.
* gcc.dg/vect/fast-math-ifcvt-1.c: New testcase.
From-SVN: r172774
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c | 18 | ||||
-rw-r--r-- | gcc/tree-if-conv.c | 16 |
4 files changed, 45 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a459c7..cf5ae0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/47892 + * tree-if-conv.c (if_convertible_stmt_p): Const builtins + are if-convertible. + 2011-04-20 Eric Botcazou <ebotcazou@adacore.com> * config/alpha/vms.h (ASM_OUTPUT_ADDR_DIFF_ELT): Do not redefine. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4b42d9..5c792f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-04-20 Richard Guenther <rguenther@suse.de> + PR tree-optimization/47892 + * gcc.dg/vect/fast-math-ifcvt-1.c: New testcase. + +2011-04-20 Richard Guenther <rguenther@suse.de> + PR middle-end/48695 * g++.dg/torture/pr48695.C: New testcase. diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c b/gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c new file mode 100644 index 0000000..ba22d8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c @@ -0,0 +1,18 @@ +/* PR 47892 */ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_float } */ +/* { dg-require-effective-target vect_condition } */ + +void +bestseries9 (float * __restrict__ arr, int len) +{ + int i; + for (i = 0; i < len; ++i) + { + float or = arr[i]; + arr[i] = (or > 0.0f) * (2 - or * or); + } +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 7ca6dee..450ddb2 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -719,6 +719,22 @@ if_convertible_stmt_p (gimple stmt, VEC (data_reference_p, heap) *refs) case GIMPLE_ASSIGN: return if_convertible_gimple_assign_stmt_p (stmt, refs); + case GIMPLE_CALL: + { + tree fndecl = gimple_call_fndecl (stmt); + if (fndecl) + { + int flags = gimple_call_flags (stmt); + if ((flags & ECF_CONST) + && !(flags & ECF_LOOPING_CONST_OR_PURE) + /* We can only vectorize some builtins at the moment, + so restrict if-conversion to those. */ + && DECL_BUILT_IN (fndecl)) + return true; + } + return false; + } + default: /* Don't know what to do with 'em so don't do anything. */ if (dump_file && (dump_flags & TDF_DETAILS)) |