* [PATCH] Fix PR47892
@ 2011-04-20 16:00 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-04-20 16:00 UTC (permalink / raw)
To: gcc-patches
This fixes PR47892, we are failing to if-convert function calls,
even those we can vectorize. This includes pow() which we
canonicalize x*x to with -ffast-math (yeah, I know ...).
No reason to not if-convert at least const builtins.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
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.
Index: gcc/tree-if-conv.c
===================================================================
*** gcc/tree-if-conv.c (revision 172759)
--- gcc/tree-if-conv.c (working copy)
*************** if_convertible_stmt_p (gimple stmt, VEC
*** 719,724 ****
--- 719,740 ----
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))
Index: gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c (revision 0)
--- gcc/testsuite/gcc.dg/vect/fast-math-ifcvt-1.c (revision 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" } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-20 15:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 16:00 [PATCH] Fix PR47892 Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).